yh-i18n 1.2.8 → 1.3.0

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/index.js CHANGED
@@ -25,12 +25,11 @@ import el_tr from "element-plus/dist/locale/tr.mjs";
25
25
 
26
26
  // 自动根据浏览器系统语言设置语言
27
27
  const navLang = navigator.language;
28
- const localLang = navLang === "zh_CN" || navLang === "en_US" ? navLang : false;
29
- const initlang = localStorage.local || localLang || "zh_CN";
28
+ const initlang = localStorage.translateLanguage || navLang || "zh_CN";
30
29
 
31
30
  export let i18n = null;
32
- const isDev = import.meta.env.DEV;
33
31
  window.translateReady = !!localStorage.translateReady || false;
32
+ const isDev = window.translateReady;
34
33
  function addTranslate(key) {
35
34
  if (key.indexOf("vxe") === -1) {
36
35
  try {
@@ -73,6 +72,7 @@ export const useI18nStore = defineStore("i18nStore", () => {
73
72
  */
74
73
  function setLang(l) {
75
74
  lang.value = l;
75
+ localStorage.translateLanguage = l;
76
76
  if (i18n) {
77
77
  i18n.global.locale = l;
78
78
  }
package/language.vue CHANGED
@@ -33,7 +33,7 @@ import { useI18nStore, ct } from "yh-i18n";
33
33
  import { storeToRefs } from "pinia";
34
34
  import { ref, watch } from "vue";
35
35
 
36
- const isDev = ref(import.meta.env.DEV);
36
+ const isDev = ref(window.translateReady);
37
37
 
38
38
  const i18nStore = useI18nStore();
39
39
  const isCollect = ref(window.translateReady);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "yh-i18n",
3
- "version": "1.2.8",
3
+ "version": "1.3.0",
4
4
  "description": "对于国际化的封装",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -8,10 +8,10 @@
8
8
  "pub:aliyun": "npm publish --registry https://packages.aliyun.com/60765e0161a945067837bb5f/npm/npm-registry/ --no-git-checks"
9
9
  },
10
10
  "dependencies": {
11
- "exceljs": "4.4.0",
12
- "vue-i18n": "9.8.0"
11
+ "exceljs": "4.4.0"
13
12
  },
14
13
  "peerDependencies": {
14
+ "vue-i18n": "9.8.0",
15
15
  "vue": "3.2.47",
16
16
  "vxe-table": "4.3.10",
17
17
  "element-plus": "2.3.8"