@gm-pc/locales 1.25.0-beta.0 → 1.25.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.d.ts CHANGED
@@ -1,9 +1,9 @@
1
- type language = 'zh' | 'zh-HK' | 'en' | 'th'
2
-
3
- declare function getLocale(word: string): string
4
-
5
- declare function setLocale(language: language): void
6
-
7
- declare function setLocaleAndStorage(language: language): void
8
-
9
- export { getLocale, setLocale, setLocaleAndStorage }
1
+ type language = 'zh' | 'zh-HK' | 'en' | 'th'
2
+
3
+ declare function getLocale(word: string): string
4
+
5
+ declare function setLocale(language: language): void
6
+
7
+ declare function setLocaleAndStorage(language: language): void
8
+
9
+ export { getLocale, setLocale, setLocaleAndStorage }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gm-pc/locales",
3
- "version": "1.25.0-beta.0",
3
+ "version": "1.25.0",
4
4
  "description": "",
5
5
  "author": "liyatang <liyatang@qq.com>",
6
6
  "homepage": "https://github.com/gmfe/gm-pc#readme",
@@ -20,5 +20,5 @@
20
20
  "bugs": {
21
21
  "url": "https://github.com/gmfe/gm-pc/issues"
22
22
  },
23
- "gitHead": "e89cf336258d6b3ae239a7f2f82070d274df4884"
23
+ "gitHead": "807f3c85b9645ce15d6ee00818c04aea936a5880"
24
24
  }
package/src/index.js CHANGED
@@ -1,36 +1,36 @@
1
- /* 此文件由脚本自动生成 */
2
- import lng1 from './lng/zh.json'
3
- import lng2 from './lng/zh-HK.json'
4
- import lng3 from './lng/en.json'
5
- import lng4 from './lng/th.json'
6
-
7
- const LOCALES_LNG = '_gm-pc_locales_lng_'
8
- const moduleMap = {
9
- zh: lng1,
10
- 'zh-HK': lng2,
11
- en: lng3,
12
- th: lng4,
13
- }
14
- let _language = window.localStorage.getItem(LOCALES_LNG) || 'zh'
15
-
16
- const setLocaleAndStorage = (lng) => {
17
- setLocale(lng)
18
- window.localStorage.setItem(LOCALES_LNG, lng)
19
- }
20
-
21
- const setLocale = (lng) => {
22
- _language = lng
23
- }
24
-
25
- const getLocale = (text) => {
26
- const languageMap = moduleMap[_language] || moduleMap.zh
27
- let result = languageMap[text]
28
-
29
- if (!result) {
30
- result = text.split('__').pop()
31
- }
32
-
33
- return result
34
- }
35
-
36
- export { getLocale, setLocale, setLocaleAndStorage }
1
+ /* 此文件由脚本自动生成 */
2
+ import lng1 from './lng/zh.json'
3
+ import lng2 from './lng/zh-HK.json'
4
+ import lng3 from './lng/en.json'
5
+ import lng4 from './lng/th.json'
6
+
7
+ const LOCALES_LNG = '_gm-pc_locales_lng_'
8
+ const moduleMap = {
9
+ zh: lng1,
10
+ 'zh-HK': lng2,
11
+ en: lng3,
12
+ th: lng4,
13
+ }
14
+ let _language = window.localStorage.getItem(LOCALES_LNG) || 'zh'
15
+
16
+ const setLocaleAndStorage = (lng) => {
17
+ setLocale(lng)
18
+ window.localStorage.setItem(LOCALES_LNG, lng)
19
+ }
20
+
21
+ const setLocale = (lng) => {
22
+ _language = lng
23
+ }
24
+
25
+ const getLocale = (text) => {
26
+ const languageMap = moduleMap[_language] || moduleMap.zh
27
+ let result = languageMap[text]
28
+
29
+ if (!result) {
30
+ result = text.split('__').pop()
31
+ }
32
+
33
+ return result
34
+ }
35
+
36
+ export { getLocale, setLocale, setLocaleAndStorage }
package/src/lng/en.json CHANGED
@@ -1,61 +1,61 @@
1
- {
2
- "1月": "Jan",
3
- "2月": "Feb",
4
- "3月": "Mar",
5
- "4月": "Apr",
6
- "5月": "May",
7
- "6月": "Jun",
8
- "7月": "Jul",
9
- "8月": "Aug",
10
- "9月": "Sep",
11
- "10月": "Oct",
12
- "11月": "Nov",
13
- "12月": "Dec",
14
- "week__日": "Su",
15
- "week__一": "Mo",
16
- "week__二": "Tu",
17
- "week__三": "We",
18
- "week__四": "Th",
19
- "week__五": "Fr",
20
- "week__六": "Sa",
21
- "提示": "Tips",
22
- "取消": "Cancel",
23
- "确定": "OK",
24
- "操作": "Operation",
25
- "保存": "Save",
26
- "确认": "OK",
27
- "没有更多数据了": "No data here",
28
- "上一页": "Previous",
29
- "下一页": "Next",
30
- "显示": "Show",
31
- "共": "A total of",
32
- "条": " ",
33
- "收拢详细信息": "Collapse details",
34
- "展开详细信息": "Expand details",
35
- "已选中所有": "",
36
- "全选": "Select all",
37
- "待选择": "ItemsSource",
38
- "搜索": "Search",
39
- "已选择": "Target",
40
- "请填写": "Please enter",
41
- "请填写邮件地址": "Please enter email address",
42
- "请填写网址": "Please enter URL",
43
- "请填写数字": "Please enter number",
44
- "请填写正数": "Please enter positive number",
45
- "请填写字母或数字": "Please enter number or letter",
46
- "表头设置": "Table header setting",
47
- "勾选当前页内容": "Check the current page",
48
- "勾选所有页内容": "Check all page content",
49
- "项": "items",
50
- "详情": "details",
51
- "删除": "delete",
52
- "编辑": "edit",
53
- "自定义颜色": "Custom colors",
54
- "红色": "Red",
55
- "橙色": "Orange",
56
- "黄色": "Yellow",
57
- "绿色": "Green",
58
- "蓝色": "Blue",
59
- "紫色": "Purple",
60
- "灰色": "Gray"
61
- }
1
+ {
2
+ "1月": "Jan",
3
+ "2月": "Feb",
4
+ "3月": "Mar",
5
+ "4月": "Apr",
6
+ "5月": "May",
7
+ "6月": "Jun",
8
+ "7月": "Jul",
9
+ "8月": "Aug",
10
+ "9月": "Sep",
11
+ "10月": "Oct",
12
+ "11月": "Nov",
13
+ "12月": "Dec",
14
+ "week__日": "Su",
15
+ "week__一": "Mo",
16
+ "week__二": "Tu",
17
+ "week__三": "We",
18
+ "week__四": "Th",
19
+ "week__五": "Fr",
20
+ "week__六": "Sa",
21
+ "提示": "Tips",
22
+ "取消": "Cancel",
23
+ "确定": "OK",
24
+ "操作": "Operation",
25
+ "保存": "Save",
26
+ "确认": "OK",
27
+ "没有更多数据了": "No data here",
28
+ "上一页": "Previous",
29
+ "下一页": "Next",
30
+ "显示": "Show",
31
+ "共": "A total of",
32
+ "条": " ",
33
+ "收拢详细信息": "Collapse details",
34
+ "展开详细信息": "Expand details",
35
+ "已选中所有": "",
36
+ "全选": "Select all",
37
+ "待选择": "ItemsSource",
38
+ "搜索": "Search",
39
+ "已选择": "Target",
40
+ "请填写": "Please enter",
41
+ "请填写邮件地址": "Please enter email address",
42
+ "请填写网址": "Please enter URL",
43
+ "请填写数字": "Please enter number",
44
+ "请填写正数": "Please enter positive number",
45
+ "请填写字母或数字": "Please enter number or letter",
46
+ "表头设置": "Table header setting",
47
+ "勾选当前页内容": "Check the current page",
48
+ "勾选所有页内容": "Check all page content",
49
+ "项": "items",
50
+ "详情": "details",
51
+ "删除": "delete",
52
+ "编辑": "edit",
53
+ "自定义颜色": "Custom colors",
54
+ "红色": "Red",
55
+ "橙色": "Orange",
56
+ "黄色": "Yellow",
57
+ "绿色": "Green",
58
+ "蓝色": "Blue",
59
+ "紫色": "Purple",
60
+ "灰色": "Gray"
61
+ }
package/src/lng/th.json CHANGED
@@ -1,49 +1,49 @@
1
- {
2
- "1月": "",
3
- "2月": "",
4
- "3月": "",
5
- "4月": "",
6
- "5月": "",
7
- "6月": "",
8
- "7月": "",
9
- "8月": "",
10
- "9月": "",
11
- "10月": "",
12
- "11月": "",
13
- "12月": "",
14
- "week__日": "",
15
- "week__一": "",
16
- "week__二": "",
17
- "week__三": "",
18
- "week__四": "",
19
- "week__五": "",
20
- "week__六": "",
21
- "提示": "",
22
- "取消": "",
23
- "确定": "",
24
- "操作": "",
25
- "保存": "",
26
- "确认": "",
27
- "没有数据": "",
28
- "上一页": "",
29
- "下一页": "",
30
- "显示": "",
31
- "共": "",
32
- "条": "",
33
- "收拢详细信息": "",
34
- "展开详细信息": "",
35
- "已选中所有": "",
36
- "全选": "",
37
- "待选择": "",
38
- "搜索": "",
39
- "已选择": "",
40
- "请填写": "",
41
- "请填写邮件地址": "",
42
- "请填写网址": "",
43
- "请填写数字": "",
44
- "请填写正数": "",
45
- "请填写字母或数字": "",
46
- "详情": "",
47
- "删除": "",
48
- "编辑": ""
49
- }
1
+ {
2
+ "1月": "",
3
+ "2月": "",
4
+ "3月": "",
5
+ "4月": "",
6
+ "5月": "",
7
+ "6月": "",
8
+ "7月": "",
9
+ "8月": "",
10
+ "9月": "",
11
+ "10月": "",
12
+ "11月": "",
13
+ "12月": "",
14
+ "week__日": "",
15
+ "week__一": "",
16
+ "week__二": "",
17
+ "week__三": "",
18
+ "week__四": "",
19
+ "week__五": "",
20
+ "week__六": "",
21
+ "提示": "",
22
+ "取消": "",
23
+ "确定": "",
24
+ "操作": "",
25
+ "保存": "",
26
+ "确认": "",
27
+ "没有数据": "",
28
+ "上一页": "",
29
+ "下一页": "",
30
+ "显示": "",
31
+ "共": "",
32
+ "条": "",
33
+ "收拢详细信息": "",
34
+ "展开详细信息": "",
35
+ "已选中所有": "",
36
+ "全选": "",
37
+ "待选择": "",
38
+ "搜索": "",
39
+ "已选择": "",
40
+ "请填写": "",
41
+ "请填写邮件地址": "",
42
+ "请填写网址": "",
43
+ "请填写数字": "",
44
+ "请填写正数": "",
45
+ "请填写字母或数字": "",
46
+ "详情": "",
47
+ "删除": "",
48
+ "编辑": ""
49
+ }
@@ -1,57 +1,57 @@
1
- {
2
- "1月": "1月",
3
- "2月": "2月",
4
- "3月": "3月",
5
- "4月": "4月",
6
- "5月": "5月",
7
- "6月": "6月",
8
- "7月": "7月",
9
- "8月": "8月",
10
- "9月": "9月",
11
- "10月": "10月",
12
- "11月": "11月",
13
- "12月": "12月",
14
- "week__日": "日",
15
- "week__一": "一",
16
- "week__二": "二",
17
- "week__三": "三",
18
- "week__四": "四",
19
- "week__五": "五",
20
- "week__六": "六",
21
- "提示": "提示",
22
- "取消": "取消",
23
- "确定": "確定",
24
- "操作": "操作",
25
- "保存": "保存",
26
- "确认": "確認",
27
- "没有更多数据了": "沒有更多數據了",
28
- "上一页": "上一頁",
29
- "下一页": "下一頁",
30
- "显示": "顯示",
31
- "共": "共",
32
- "条": "條",
33
- "收拢详细信息": "收攏詳細信息",
34
- "展开详细信息": "展開詳細信息",
35
- "已选中所有": "已選中所有",
36
- "全选": "全選",
37
- "待选择": "待選擇",
38
- "搜索": "搜索",
39
- "已选择": "已選擇",
40
- "请填写": "請填寫",
41
- "请填写邮件地址": "請填寫郵件地址",
42
- "请填写网址": "請填寫網址",
43
- "请填写数字": "請填寫數字",
44
- "请填写正数": "請填寫正數",
45
- "请填写字母或数字": "請填寫字母或數字",
46
- "详情": "詳情",
47
- "删除": "刪除",
48
- "编辑": "編輯",
49
- "自定义颜色": "自定義顏色",
50
- "红色": "紅色",
51
- "橙色": "橙色",
52
- "黄色": "黃色",
53
- "绿色": "綠色",
54
- "蓝色": "藍色",
55
- "紫色": "紫色",
56
- "灰色": "灰色"
57
- }
1
+ {
2
+ "1月": "1月",
3
+ "2月": "2月",
4
+ "3月": "3月",
5
+ "4月": "4月",
6
+ "5月": "5月",
7
+ "6月": "6月",
8
+ "7月": "7月",
9
+ "8月": "8月",
10
+ "9月": "9月",
11
+ "10月": "10月",
12
+ "11月": "11月",
13
+ "12月": "12月",
14
+ "week__日": "日",
15
+ "week__一": "一",
16
+ "week__二": "二",
17
+ "week__三": "三",
18
+ "week__四": "四",
19
+ "week__五": "五",
20
+ "week__六": "六",
21
+ "提示": "提示",
22
+ "取消": "取消",
23
+ "确定": "確定",
24
+ "操作": "操作",
25
+ "保存": "保存",
26
+ "确认": "確認",
27
+ "没有更多数据了": "沒有更多數據了",
28
+ "上一页": "上一頁",
29
+ "下一页": "下一頁",
30
+ "显示": "顯示",
31
+ "共": "共",
32
+ "条": "條",
33
+ "收拢详细信息": "收攏詳細信息",
34
+ "展开详细信息": "展開詳細信息",
35
+ "已选中所有": "已選中所有",
36
+ "全选": "全選",
37
+ "待选择": "待選擇",
38
+ "搜索": "搜索",
39
+ "已选择": "已選擇",
40
+ "请填写": "請填寫",
41
+ "请填写邮件地址": "請填寫郵件地址",
42
+ "请填写网址": "請填寫網址",
43
+ "请填写数字": "請填寫數字",
44
+ "请填写正数": "請填寫正數",
45
+ "请填写字母或数字": "請填寫字母或數字",
46
+ "详情": "詳情",
47
+ "删除": "刪除",
48
+ "编辑": "編輯",
49
+ "自定义颜色": "自定義顏色",
50
+ "红色": "紅色",
51
+ "橙色": "橙色",
52
+ "黄色": "黃色",
53
+ "绿色": "綠色",
54
+ "蓝色": "藍色",
55
+ "紫色": "紫色",
56
+ "灰色": "灰色"
57
+ }
package/src/lng/zh.json CHANGED
@@ -1 +1 @@
1
- {}
1
+ {}
package/src/stories.js CHANGED
@@ -1,26 +1,26 @@
1
- import React from 'react'
2
- import { storiesOf } from '@storybook/react'
3
- import { setLocale } from './index'
4
- import { observable } from 'mobx'
5
-
6
- const l = localStorage.getItem('_gm-pc_' + 'lng')
7
-
8
- const store = observable({
9
- lng: (l ? JSON.parse(l) : '') || 'zh'
10
- })
11
-
12
-
13
- storiesOf('locales/locales', module).add('default', () => (
14
- <select
15
- value={store.lng}
16
- onChange={e => {
17
- localStorage.setItem('_gm-pc_' + 'lng', JSON.stringify(e.target.value))
18
- setLocale(e.target.value)
19
- store.lng = e.target.value
20
- }}
21
- style={{ verticalAlign: 'middle' }}
22
- >
23
- <option value='en'>English</option>
24
- <option value='zh'>中文</option>
25
- </select>
26
- ))
1
+ import React from 'react'
2
+ import { storiesOf } from '@storybook/react'
3
+ import { setLocale } from './index'
4
+ import { observable } from 'mobx'
5
+
6
+ const l = localStorage.getItem('_gm-pc_' + 'lng')
7
+
8
+ const store = observable({
9
+ lng: (l ? JSON.parse(l) : '') || 'zh'
10
+ })
11
+
12
+
13
+ storiesOf('locales/locales', module).add('default', () => (
14
+ <select
15
+ value={store.lng}
16
+ onChange={e => {
17
+ localStorage.setItem('_gm-pc_' + 'lng', JSON.stringify(e.target.value))
18
+ setLocale(e.target.value)
19
+ store.lng = e.target.value
20
+ }}
21
+ style={{ verticalAlign: 'middle' }}
22
+ >
23
+ <option value='en'>English</option>
24
+ <option value='zh'>中文</option>
25
+ </select>
26
+ ))