Skip to content

Commit 32b120a

Browse files
committed
refactor: use protected setter for isInitialized
1 parent 0ed6ece commit 32b120a

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

packages/runtime-core/src/i18n.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,17 +44,25 @@ export abstract class BaseTranslator<T extends { [key: string]: unknown } = { [k
4444
protected currentDocumentLanguage: Language | null;
4545
protected fallbackLanguage: Language;
4646
protected handleLanguageChange: LanguageChangeHandler | null;
47-
public isInitialized: boolean;
4847
protected translations: T;
48+
#isInitialized: boolean;
4949

5050
constructor({ fallbackLanguage, translations }: TranslatorOptions<T>) {
5151
this.currentDocumentLanguage = null;
5252
this.fallbackLanguage = fallbackLanguage ?? 'en';
5353
this.handleLanguageChange = null;
54-
this.isInitialized = false;
54+
this.#isInitialized = false;
5555
this.translations = translations;
5656
}
5757

58+
get isInitialized() {
59+
return this.#isInitialized;
60+
}
61+
62+
protected set isInitialized(value: boolean) {
63+
this.#isInitialized = value;
64+
}
65+
5866
@InitializedOnly
5967
set onLanguageChange(handler: LanguageChangeHandler) {
6068
this.handleLanguageChange = handler;

0 commit comments

Comments
 (0)