@kuankuan/assist-2026 0.1.13 → 0.1.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/i18n.d.ts +1 -0
- package/dist/i18n.js +3 -1
- package/package.json +1 -1
- package/src/i18n.ts +3 -1
package/dist/i18n.d.ts
CHANGED
|
@@ -13,6 +13,7 @@ export default class I18nInstance {
|
|
|
13
13
|
}[];
|
|
14
14
|
readonly language: Ref<string>;
|
|
15
15
|
readonly i18n: I18n<any, Record<string, unknown>, Record<string, unknown>, string, false>;
|
|
16
|
+
readonly settingLanguage: Ref<string>;
|
|
16
17
|
constructor(messages: unknown, langs: string[], storageKey?: string, languageNameMap?: Record<string, string>);
|
|
17
18
|
t(key: string): string;
|
|
18
19
|
tRef(key: string): import("vue").ComputedRef<string>;
|
package/dist/i18n.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createI18n } from 'vue-i18n';
|
|
2
|
-
import { computed, ref, watch } from 'vue';
|
|
2
|
+
import { computed, readonly, ref, watch } from 'vue';
|
|
3
3
|
import storageRef from './ref/storageRef';
|
|
4
4
|
function getBrowserLanguage() {
|
|
5
5
|
return (navigator?.languages || [navigator.language]).map((i) => i.toLowerCase());
|
|
@@ -37,6 +37,7 @@ export default class I18nInstance {
|
|
|
37
37
|
language;
|
|
38
38
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
39
39
|
i18n;
|
|
40
|
+
settingLanguage;
|
|
40
41
|
constructor(messages, langs, storageKey = '_vue_i18n_main_locale', languageNameMap = languageNameMapPreset) {
|
|
41
42
|
this.messages = messages;
|
|
42
43
|
this.langs = langs;
|
|
@@ -49,6 +50,7 @@ export default class I18nInstance {
|
|
|
49
50
|
name: this.languageName(i),
|
|
50
51
|
}));
|
|
51
52
|
this.localSettingLanguage = storageRef(this.storageKey, '_auto');
|
|
53
|
+
this.settingLanguage = readonly(this.localSettingLanguage);
|
|
52
54
|
this.browserLanguage = computed(() => getBrowserLanguageInLangs(browserLanguageSetting.value));
|
|
53
55
|
this.language = computed({
|
|
54
56
|
get() {
|
package/package.json
CHANGED
package/src/i18n.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createI18n, I18n } from 'vue-i18n';
|
|
2
|
-
import { computed, ref, watch, type Ref } from 'vue';
|
|
2
|
+
import { computed, readonly, ref, watch, type Ref } from 'vue';
|
|
3
3
|
import storageRef from './ref/storageRef';
|
|
4
4
|
|
|
5
5
|
function getBrowserLanguage() {
|
|
@@ -37,6 +37,7 @@ export default class I18nInstance {
|
|
|
37
37
|
public readonly language: Ref<string>;
|
|
38
38
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
39
39
|
public readonly i18n: I18n<any, Record<string, unknown>, Record<string, unknown>, string, false>;
|
|
40
|
+
public readonly settingLanguage: Ref<string>;
|
|
40
41
|
|
|
41
42
|
constructor(
|
|
42
43
|
public readonly messages: unknown,
|
|
@@ -51,6 +52,7 @@ export default class I18nInstance {
|
|
|
51
52
|
name: this.languageName(i),
|
|
52
53
|
}));
|
|
53
54
|
this.localSettingLanguage = storageRef(this.storageKey, '_auto');
|
|
55
|
+
this.settingLanguage = readonly(this.localSettingLanguage);
|
|
54
56
|
this.browserLanguage = computed(() => getBrowserLanguageInLangs(browserLanguageSetting.value));
|
|
55
57
|
this.language = computed({
|
|
56
58
|
get() {
|