ronds-metadata 1.0.83 → 1.0.84

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.
@@ -1,2 +1 @@
1
- export declare const initLocaleMessage: () => void;
2
1
  export { setLocale, getLocale } from '../../framework/locale';
@@ -1,10 +1,8 @@
1
1
  import zhCN from './zh-CN';
2
2
  import enUS from './en-US';
3
3
  import { initLocale } from '../../framework/locale';
4
- export var initLocaleMessage = function initLocaleMessage() {
5
- initLocale({
6
- 'zh-CN': zhCN,
7
- 'en-US': enUS
8
- });
9
- };
4
+ initLocale({
5
+ 'zh-CN': zhCN,
6
+ 'en-US': enUS
7
+ });
10
8
  export { setLocale, getLocale } from '../../framework/locale';
package/es/config.js CHANGED
@@ -3,17 +3,17 @@ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
3
3
  /*
4
4
  * @Author: wangxian
5
5
  * @Date: 2021-09-18 14:15:04
6
- * @LastEditTime: 2022-05-09 15:52:41
6
+ * @LastEditTime: 2022-05-10 08:41:39
7
7
  */
8
8
  import { BehaviorSubject } from 'rxjs/internal/BehaviorSubject';
9
9
  import { distinctUntilChanged } from 'rxjs/internal/operators/distinctUntilChanged';
10
10
  import { map } from 'rxjs/internal/operators/map';
11
- import { initLocaleMessage } from './comps/locales/index';
11
+ import { setLocale } from './comps/locales/index';
12
12
  import * as jq from './framework/libs/jquery.min.js';
13
- import { setLocale } from './framework/locale/index';
13
+ import { localeKey } from './framework/locale';
14
14
  window.jQuery = window.jQuery || jq;
15
15
  var defaultConfig = {
16
- locale: 'zh-CN',
16
+ locale: window.localStorage.getItem(localeKey) || 'zh-CN',
17
17
  theme: 'normal',
18
18
  msgpack: false,
19
19
  openLoading: true,
@@ -24,7 +24,6 @@ export var globalSettingStream = new BehaviorSubject(defaultConfig);
24
24
  globalSettingStream.pipe(map(function (p) {
25
25
  return p.locale;
26
26
  }), distinctUntilChanged()).subscribe(function (p) {
27
- initLocaleMessage();
28
27
  setLocale(p);
29
28
  });
30
29
  globalSettingStream.pipe(map(function (p) {
@@ -1,4 +1,5 @@
1
1
  import DI18n from './dil8/index';
2
+ export declare const localeKey = "epm_locale";
2
3
  declare let di18n: DI18n;
3
4
  export declare function initLocale(messages: Record<'zh-CN' | 'en-US', Record<string, string>>): void;
4
5
  export declare function setLocale(l: 'zh-CN' | 'en-US'): void;
@@ -1,6 +1,7 @@
1
1
  import DI18n from './dil8/index';
2
+ export var localeKey = 'epm_locale';
2
3
  var di18n = new DI18n({
3
- locale: 'zh-CN',
4
+ locale: window.localStorage.getItem(localeKey) || 'zh-CN',
4
5
  isReplace: false,
5
6
  messages: {}
6
7
  });
@@ -8,6 +9,7 @@ export function initLocale(messages) {
8
9
  di18n.setMessages(messages);
9
10
  }
10
11
  export function setLocale(l) {
12
+ window.localStorage.setItem(localeKey, l || '');
11
13
  di18n.setLocale(l);
12
14
  }
13
15
  export function getLocale() {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "public": true,
3
3
  "name": "ronds-metadata",
4
- "version": "1.0.83",
4
+ "version": "1.0.84",
5
5
  "scripts": {
6
6
  "start": "dumi dev",
7
7
  "docs:build": "dumi build",