plain-design 1.0.0-beta.48 → 1.0.0-beta.49

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "plain-design",
3
- "version": "1.0.0-beta.48",
3
+ "version": "1.0.0-beta.49",
4
4
  "description": "",
5
5
  "main": "dist/plain-design.min.js",
6
6
  "module": "dist/plain-design.commonjs.min.js",
@@ -79,6 +79,8 @@ type UnionToIntersection<T> = (T extends any ? ((t: T) => void) : never) extends
79
79
  export function createI18n<Locale extends Record<string, any>, OM = ObjectMap<Locale>, K extends keyof OM = keyof OM>(defaultLocale: Locale): UnionToIntersection<K extends keyof OM ? ((k: K, params?: Record<string, any>) => { d: <D = unknown>(defaultLang?: D) => OM[K] | D }) : never> & {
80
80
  setLocale: (locale: any) => void,
81
81
  setDefaultLocale: (defaultLocale: any) => void,
82
+ getLocale: () => Locale,
83
+ getDefaultLocale: () => Locale,
82
84
  } {
83
85
 
84
86
  const state = reactive({
@@ -121,6 +123,20 @@ export function createI18n<Locale extends Record<string, any>, OM = ObjectMap<Lo
121
123
  */
122
124
  const setDefaultLocale = (defaultLocale: Locale) => state.defaultLocale = defaultLocale as any;
123
125
 
126
+ /**
127
+ * 获取当前语言
128
+ * @author 韦胜健
129
+ * @date 2024.4.20 8:49
130
+ */
131
+ const getLocale = () => state.locale;
132
+
133
+ /**
134
+ * 获取默认语言
135
+ * @author 韦胜健
136
+ * @date 2024.4.20 8:49
137
+ */
138
+ const getDefaultLocale = () => state.defaultLocale;
139
+
124
140
  /**
125
141
  * 取值
126
142
  * @author 韦胜健
@@ -144,5 +160,5 @@ export function createI18n<Locale extends Record<string, any>, OM = ObjectMap<Lo
144
160
  };
145
161
  };
146
162
 
147
- return Object.assign(getter, { setLocale, setDefaultLocale }) as any;
163
+ return Object.assign(getter, { setLocale, setDefaultLocale, getLocale, getDefaultLocale }) as any;
148
164
  }