File tree Expand file tree Collapse file tree
packages/runtime-core/src Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -28,6 +28,13 @@ export type TranslationKey<T extends { [key: string]: unknown }, Key = keyof T>
2828/** @public */
2929export type LanguageChangeHandler = ( this : void , language : Language ) => void ;
3030
31+ /** @public */
32+ export type TranslatorOptions < T extends { [ key : string ] : unknown } > = {
33+ fallbackLanguage ?: Language ;
34+ translations : T ;
35+ } ;
36+
37+ /** @public */
3138export abstract class BaseTranslator < T extends { [ key : string ] : unknown } = { [ key : string ] : unknown } > {
3239 protected abstract currentDocumentLanguage : Language | null ;
3340 protected abstract fallbackLanguage : Language ;
@@ -47,7 +54,7 @@ export class Translator<T extends { [key: string]: unknown }> extends BaseTransl
4754 protected handleLanguageChange : LanguageChangeHandler | null ;
4855 protected translations : T ;
4956
50- constructor ( options : { fallbackLanguage ?: Language ; translations : T } ) {
57+ constructor ( options : TranslatorOptions < T > ) {
5158 super ( ) ;
5259 this . currentDocumentLanguage = null ;
5360 this . fallbackLanguage = options . fallbackLanguage ?? 'en' ;
You can’t perform that action at this time.
0 commit comments