@refinitiv-ui/phrasebook 5.5.0-alpha.1 → 5.5.0-alpha.2
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/lib/index.d.ts +2 -0
- package/lib/index.js +1 -0
- package/lib/locale/de/calendar.d.ts +18 -0
- package/lib/locale/de/calendar.js +20 -0
- package/lib/locale/de/color-dialog.d.ts +8 -0
- package/lib/locale/de/color-dialog.js +11 -0
- package/lib/locale/de/combo-box.d.ts +6 -0
- package/lib/locale/de/combo-box.js +8 -0
- package/lib/locale/de/dialog.d.ts +5 -0
- package/lib/locale/de/dialog.js +8 -0
- package/lib/locale/de/pagination.d.ts +6 -0
- package/lib/locale/de/pagination.js +12 -0
- package/lib/locale/de/password-field.d.ts +5 -0
- package/lib/locale/de/password-field.js +7 -0
- package/lib/locale/de/search-field.d.ts +4 -0
- package/lib/locale/de/search-field.js +6 -0
- package/lib/locale/de/shared.d.ts +7 -0
- package/lib/locale/de/shared.js +10 -0
- package/lib/locale/de/time-picker.d.ts +10 -0
- package/lib/locale/de/time-picker.js +12 -0
- package/lib/locale/de/tree-select.d.ts +13 -0
- package/lib/locale/de/tree-select.js +13 -0
- package/lib/locale/en/calendar.d.ts +18 -0
- package/lib/locale/en/calendar.js +20 -0
- package/lib/locale/en/color-dialog.d.ts +8 -0
- package/lib/locale/en/color-dialog.js +11 -0
- package/lib/locale/en/combo-box.d.ts +6 -0
- package/lib/locale/en/combo-box.js +8 -0
- package/lib/locale/en/dialog.d.ts +5 -0
- package/lib/locale/en/dialog.js +7 -0
- package/lib/locale/en/pagination.d.ts +6 -0
- package/lib/locale/en/pagination.js +12 -0
- package/lib/locale/en/password-field.d.ts +5 -0
- package/lib/locale/en/password-field.js +7 -0
- package/lib/locale/en/search-field.d.ts +4 -0
- package/lib/locale/en/search-field.js +6 -0
- package/lib/locale/en/shared.d.ts +7 -0
- package/lib/locale/en/shared.js +10 -0
- package/lib/locale/en/time-picker.d.ts +10 -0
- package/lib/locale/en/time-picker.js +12 -0
- package/lib/locale/en/tree-select.d.ts +13 -0
- package/lib/locale/en/tree-select.js +13 -0
- package/lib/locale/ja/calendar.d.ts +18 -0
- package/lib/locale/ja/calendar.js +20 -0
- package/lib/locale/ja/color-dialog.d.ts +8 -0
- package/lib/locale/ja/color-dialog.js +11 -0
- package/lib/locale/ja/combo-box.d.ts +6 -0
- package/lib/locale/ja/combo-box.js +8 -0
- package/lib/locale/ja/dialog.d.ts +5 -0
- package/lib/locale/ja/dialog.js +8 -0
- package/lib/locale/ja/pagination.d.ts +6 -0
- package/lib/locale/ja/pagination.js +12 -0
- package/lib/locale/ja/password-field.d.ts +5 -0
- package/lib/locale/ja/password-field.js +7 -0
- package/lib/locale/ja/search-field.d.ts +4 -0
- package/lib/locale/ja/search-field.js +6 -0
- package/lib/locale/ja/shared.d.ts +7 -0
- package/lib/locale/ja/shared.js +10 -0
- package/lib/locale/ja/time-picker.d.ts +10 -0
- package/lib/locale/ja/time-picker.js +12 -0
- package/lib/locale/ja/tree-select.d.ts +13 -0
- package/lib/locale/ja/tree-select.js +13 -0
- package/lib/locale/zh/calendar.d.ts +18 -0
- package/lib/locale/zh/calendar.js +20 -0
- package/lib/locale/zh/color-dialog.d.ts +8 -0
- package/lib/locale/zh/color-dialog.js +11 -0
- package/lib/locale/zh/combo-box.d.ts +6 -0
- package/lib/locale/zh/combo-box.js +8 -0
- package/lib/locale/zh/dialog.d.ts +5 -0
- package/lib/locale/zh/dialog.js +8 -0
- package/lib/locale/zh/pagination.d.ts +6 -0
- package/lib/locale/zh/pagination.js +12 -0
- package/lib/locale/zh/password-field.d.ts +5 -0
- package/lib/locale/zh/password-field.js +7 -0
- package/lib/locale/zh/search-field.d.ts +4 -0
- package/lib/locale/zh/search-field.js +6 -0
- package/lib/locale/zh/shared.d.ts +7 -0
- package/lib/locale/zh/shared.js +10 -0
- package/lib/locale/zh/time-picker.d.ts +10 -0
- package/lib/locale/zh/time-picker.js +12 -0
- package/lib/locale/zh/tree-select.d.ts +13 -0
- package/lib/locale/zh/tree-select.js +13 -0
- package/lib/locale/zh-hant/calendar.d.ts +18 -0
- package/lib/locale/zh-hant/calendar.js +20 -0
- package/lib/locale/zh-hant/color-dialog.d.ts +8 -0
- package/lib/locale/zh-hant/color-dialog.js +11 -0
- package/lib/locale/zh-hant/combo-box.d.ts +6 -0
- package/lib/locale/zh-hant/combo-box.js +8 -0
- package/lib/locale/zh-hant/dialog.d.ts +5 -0
- package/lib/locale/zh-hant/dialog.js +8 -0
- package/lib/locale/zh-hant/pagination.d.ts +6 -0
- package/lib/locale/zh-hant/pagination.js +12 -0
- package/lib/locale/zh-hant/password-field.d.ts +5 -0
- package/lib/locale/zh-hant/password-field.js +7 -0
- package/lib/locale/zh-hant/search-field.d.ts +4 -0
- package/lib/locale/zh-hant/search-field.js +6 -0
- package/lib/locale/zh-hant/shared.d.ts +7 -0
- package/lib/locale/zh-hant/shared.js +10 -0
- package/lib/locale/zh-hant/time-picker.d.ts +10 -0
- package/lib/locale/zh-hant/time-picker.js +12 -0
- package/lib/locale/zh-hant/tree-select.d.ts +13 -0
- package/lib/locale/zh-hant/tree-select.js +13 -0
- package/lib/translation.d.ts +52 -0
- package/lib/translation.js +84 -0
- package/lib/types.d.ts +4 -0
- package/lib/types.js +1 -0
- package/package.json +3 -3
- package/tsconfig.tsbuildinfo +1 -0
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Phrasebook } from '../../translation.js';
|
|
2
|
+
const translations = {
|
|
3
|
+
BEFORE_MIDDAY: 'Before Midday',
|
|
4
|
+
AFTER_MIDDAY: 'After Midday',
|
|
5
|
+
TOGGLE_TIME_PERIOD: 'Toggle Time Period',
|
|
6
|
+
SELECT_HOURS: '{value, select, null {Select hours} other {{value, plural, =1 {# hour} other {# hours}}}}',
|
|
7
|
+
SELECT_MINUTES: '{value, select, null {Select minutes} other {{value, plural, =1 {# minute} other {# minutes}}}}',
|
|
8
|
+
SELECT_SECONDS: '{value, select, null {Select seconds} other {{value, plural, =1 {# second} other {# seconds}}}}',
|
|
9
|
+
SELECTED: '{value, select, null {Selected none. Choose time} other {Selected time is: {showSeconds, select, true {{amPm, select, true {{value, time, ::hmsa}} other {{value, time, ::Hms}}}} other {{amPm, select, true {{value, time, ::hma}} other {{value, time, ::Hm}}}}}}}'
|
|
10
|
+
};
|
|
11
|
+
Phrasebook.define('ja', 'ef-time-picker', translations);
|
|
12
|
+
export default translations;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import './shared.js';
|
|
2
|
+
declare const translations: {
|
|
3
|
+
FULL_LIST: string;
|
|
4
|
+
SELECTED: string;
|
|
5
|
+
EXPAND_COLLAPSE: string;
|
|
6
|
+
SELECT_CONTROL: string;
|
|
7
|
+
DONE: string;
|
|
8
|
+
SELECTED_NUM: string;
|
|
9
|
+
MATCHES_NUM: string;
|
|
10
|
+
MULTIPLE_ITEMS: string;
|
|
11
|
+
NO_OPTIONS: string;
|
|
12
|
+
};
|
|
13
|
+
export default translations;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// Component docs https://elf.int.refinitiv.com/elements/tree-select.html
|
|
2
|
+
import { Phrasebook } from '../../translation.js';
|
|
3
|
+
import './shared.js';
|
|
4
|
+
import comboboxTranslations from './combo-box';
|
|
5
|
+
const translations = Object.assign(Object.assign({}, comboboxTranslations), {
|
|
6
|
+
// used as a toggle control
|
|
7
|
+
FULL_LIST: 'すべて', SELECTED: '選択項目のみ', EXPAND_COLLAPSE: '{expansion, select, false {すべてを展開} other {すべてを折りたたむ}}', SELECT_CONTROL: '{selected, select, false {すべて選択} other {選択をすべて解除}}',
|
|
8
|
+
// button control
|
|
9
|
+
DONE: '完了',
|
|
10
|
+
// selection/filter feedback
|
|
11
|
+
SELECTED_NUM: '{numSelected, plural, =0 {} =1 {1 件選択済み} other {# 件選択済み}}', MATCHES_NUM: '{numMatched, plural, =0 {該当項目はありません} =1 {検索結果 – 1件} other {検索結果 – #件}}' });
|
|
12
|
+
Phrasebook.define('ja', 'ef-tree-select', translations);
|
|
13
|
+
export default translations;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
declare const translations: {
|
|
2
|
+
PREVIOUS_MONTH: string;
|
|
3
|
+
NEXT_MONTH: string;
|
|
4
|
+
PREVIOUS_YEAR: string;
|
|
5
|
+
NEXT_YEAR: string;
|
|
6
|
+
PREVIOUS_DECADE: string;
|
|
7
|
+
NEXT_DECADE: string;
|
|
8
|
+
YEAR_SELECTOR: string;
|
|
9
|
+
DATE_SELECTOR: string;
|
|
10
|
+
CELL_LABEL: string;
|
|
11
|
+
SELECTED: string;
|
|
12
|
+
NOW: string;
|
|
13
|
+
SELECTED_NOW: string;
|
|
14
|
+
SELECTED_DATE: string;
|
|
15
|
+
SELECTED_RANGE: string;
|
|
16
|
+
SELECTED_NONE: string;
|
|
17
|
+
};
|
|
18
|
+
export default translations;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Phrasebook } from '../../translation.js';
|
|
2
|
+
const translations = {
|
|
3
|
+
PREVIOUS_MONTH: '前一个月',
|
|
4
|
+
NEXT_MONTH: '下一个月',
|
|
5
|
+
PREVIOUS_YEAR: '前一年',
|
|
6
|
+
NEXT_YEAR: '下一年',
|
|
7
|
+
PREVIOUS_DECADE: '前十年',
|
|
8
|
+
NEXT_DECADE: '下一个十年',
|
|
9
|
+
YEAR_SELECTOR: '点击来选择年份',
|
|
10
|
+
DATE_SELECTOR: '点击来选择日期',
|
|
11
|
+
CELL_LABEL: '{view, select, year {{value, date, ::yyyy}} month {{value, date, ::MMMM-yyyy}} other {{value, date, full}}}',
|
|
12
|
+
SELECTED: '已选: {view, select, year {{value, date, ::yyyy}} month {{value, date, ::MMMM-yyyy}} other {{value, date, full}}}',
|
|
13
|
+
NOW: '{view, select, year {Current year, {value, date, ::yyyy}} month {Current month, {value, date, ::MMMM-yyyy}} other {Today, {value, date, full}}}',
|
|
14
|
+
SELECTED_NOW: '已选: {view, select, year {current year, {value, date, ::yyyy}} month {current month, {value, date, ::MMMM-yyyy}} other {today, {value, date, full}}}',
|
|
15
|
+
SELECTED_DATE: '已选 {count, plural, =1 {date is {value, date, full}} other {# dates, {value, date, full} and others}}',
|
|
16
|
+
SELECTED_RANGE: '所选范围开始于 {from, date, full}{to, select, null {} other { to {to, date, full}}}',
|
|
17
|
+
SELECTED_NONE: '未选择。请选择 {range, select, true {date range} other {{multiple, select, true {dates} other {date}}}}'
|
|
18
|
+
};
|
|
19
|
+
Phrasebook.define('zh', 'ef-calendar', translations);
|
|
20
|
+
export default translations;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// Component docs https://elf.int.refinitiv.com/elements/color-dialog.html
|
|
2
|
+
import { Phrasebook } from '../../translation.js';
|
|
3
|
+
import './shared.js';
|
|
4
|
+
import dialogTranslations from './dialog';
|
|
5
|
+
const translations = Object.assign(Object.assign({}, dialogTranslations), {
|
|
6
|
+
// Dialog title
|
|
7
|
+
HEADER: '颜色选择',
|
|
8
|
+
// Color values for color mixer, has space for a single character
|
|
9
|
+
RED: 'R', GREEN: 'G', BLUE: 'B' });
|
|
10
|
+
Phrasebook.define('zh', 'ef-color-dialog', translations);
|
|
11
|
+
export default translations;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// Component docs https://elf.int.refinitiv.com/elements/pagination.html
|
|
2
|
+
import { Phrasebook } from '../../translation.js';
|
|
3
|
+
import './shared.js';
|
|
4
|
+
const translations = {
|
|
5
|
+
// page: current page #
|
|
6
|
+
PAGE: '第 {page} 页',
|
|
7
|
+
// page: current page #
|
|
8
|
+
// pageTotal: total number of pages
|
|
9
|
+
PAGE_OF: '第 {page}/{pageTotal} 页'
|
|
10
|
+
};
|
|
11
|
+
Phrasebook.define('zh', 'ef-pagination', translations);
|
|
12
|
+
export default translations;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Phrasebook } from '../../translation.js';
|
|
2
|
+
const translations = {
|
|
3
|
+
BEFORE_MIDDAY: 'Before Midday',
|
|
4
|
+
AFTER_MIDDAY: 'After Midday',
|
|
5
|
+
TOGGLE_TIME_PERIOD: 'Toggle Time Period',
|
|
6
|
+
SELECT_HOURS: '{value, select, null {Select hours} other {{value, plural, =1 {# hour} other {# hours}}}}',
|
|
7
|
+
SELECT_MINUTES: '{value, select, null {Select minutes} other {{value, plural, =1 {# minute} other {# minutes}}}}',
|
|
8
|
+
SELECT_SECONDS: '{value, select, null {Select seconds} other {{value, plural, =1 {# second} other {# seconds}}}}',
|
|
9
|
+
SELECTED: '{value, select, null {Selected none. Choose time} other {Selected time is: {showSeconds, select, true {{amPm, select, true {{value, time, ::hmsa}} other {{value, time, ::Hms}}}} other {{amPm, select, true {{value, time, ::hma}} other {{value, time, ::Hm}}}}}}}'
|
|
10
|
+
};
|
|
11
|
+
Phrasebook.define('zh', 'ef-time-picker', translations);
|
|
12
|
+
export default translations;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import './shared.js';
|
|
2
|
+
declare const translations: {
|
|
3
|
+
FULL_LIST: string;
|
|
4
|
+
SELECTED: string;
|
|
5
|
+
EXPAND_COLLAPSE: string;
|
|
6
|
+
SELECT_CONTROL: string;
|
|
7
|
+
DONE: string;
|
|
8
|
+
SELECTED_NUM: string;
|
|
9
|
+
MATCHES_NUM: string;
|
|
10
|
+
MULTIPLE_ITEMS: string;
|
|
11
|
+
NO_OPTIONS: string;
|
|
12
|
+
};
|
|
13
|
+
export default translations;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// Component docs https://elf.int.refinitiv.com/elements/tree-select.html
|
|
2
|
+
import { Phrasebook } from '../../translation.js';
|
|
3
|
+
import './shared.js';
|
|
4
|
+
import comboboxTranslations from './combo-box';
|
|
5
|
+
const translations = Object.assign(Object.assign({}, comboboxTranslations), {
|
|
6
|
+
// used as a toggle control
|
|
7
|
+
FULL_LIST: '全部列表', SELECTED: '已选项列表', EXPAND_COLLAPSE: '{expansion, select, true {全部收起} other {全部展开}}', SELECT_CONTROL: '{selected, select, true {取消全选} other {全选}}',
|
|
8
|
+
// button control
|
|
9
|
+
DONE: '完成',
|
|
10
|
+
// selection/filter feedback
|
|
11
|
+
SELECTED_NUM: '{numSelected, plural, =0 {} =1 {已选 1 项。} other {已选 # 项。}}', MATCHES_NUM: '{numMatched, plural, =0 {未找到结果。} =1 {找到了 1 个结果。} other {找到了 # 个结果。}}' });
|
|
12
|
+
Phrasebook.define('zh', 'ef-tree-select', translations);
|
|
13
|
+
export default translations;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
declare const translations: {
|
|
2
|
+
PREVIOUS_MONTH: string;
|
|
3
|
+
NEXT_MONTH: string;
|
|
4
|
+
PREVIOUS_YEAR: string;
|
|
5
|
+
NEXT_YEAR: string;
|
|
6
|
+
PREVIOUS_DECADE: string;
|
|
7
|
+
NEXT_DECADE: string;
|
|
8
|
+
YEAR_SELECTOR: string;
|
|
9
|
+
DATE_SELECTOR: string;
|
|
10
|
+
CELL_LABEL: string;
|
|
11
|
+
SELECTED: string;
|
|
12
|
+
NOW: string;
|
|
13
|
+
SELECTED_NOW: string;
|
|
14
|
+
SELECTED_DATE: string;
|
|
15
|
+
SELECTED_RANGE: string;
|
|
16
|
+
SELECTED_NONE: string;
|
|
17
|
+
};
|
|
18
|
+
export default translations;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Phrasebook } from '../../translation.js';
|
|
2
|
+
const translations = {
|
|
3
|
+
PREVIOUS_MONTH: 'Previous month',
|
|
4
|
+
NEXT_MONTH: 'Next month',
|
|
5
|
+
PREVIOUS_YEAR: 'Previous year',
|
|
6
|
+
NEXT_YEAR: 'Next year',
|
|
7
|
+
PREVIOUS_DECADE: 'Previous decade',
|
|
8
|
+
NEXT_DECADE: 'Next decade',
|
|
9
|
+
YEAR_SELECTOR: 'Click to select year',
|
|
10
|
+
DATE_SELECTOR: 'Click to select date',
|
|
11
|
+
CELL_LABEL: '{view, select, year {{value, date, ::yyyy}} month {{value, date, ::MMMM-yyyy}} other {{value, date, full}}}',
|
|
12
|
+
SELECTED: 'Selected: {view, select, year {{value, date, ::yyyy}} month {{value, date, ::MMMM-yyyy}} other {{value, date, full}}}',
|
|
13
|
+
NOW: '{view, select, year {Current year, {value, date, ::yyyy}} month {Current month, {value, date, ::MMMM-yyyy}} other {Today, {value, date, full}}}',
|
|
14
|
+
SELECTED_NOW: 'Selected: {view, select, year {current year, {value, date, ::yyyy}} month {current month, {value, date, ::MMMM-yyyy}} other {today, {value, date, full}}}',
|
|
15
|
+
SELECTED_DATE: 'Selected {count, plural, =1 {date is {value, date, full}} other {# dates, {value, date, full} and others}}',
|
|
16
|
+
SELECTED_RANGE: 'Selected range is from {from, date, full}{to, select, null {} other { to {to, date, full}}}',
|
|
17
|
+
SELECTED_NONE: 'Selected none. Choose {range, select, true {date range} other {{multiple, select, true {dates} other {date}}}}'
|
|
18
|
+
};
|
|
19
|
+
Phrasebook.define('zh-Hant', 'ef-calendar', translations);
|
|
20
|
+
export default translations;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// Component docs https://elf.int.refinitiv.com/elements/color-dialog.html
|
|
2
|
+
import { Phrasebook } from '../../translation.js';
|
|
3
|
+
import './shared.js';
|
|
4
|
+
import dialogTranslations from './dialog';
|
|
5
|
+
const translations = Object.assign(Object.assign({}, dialogTranslations), {
|
|
6
|
+
// Dialog title
|
|
7
|
+
HEADER: '顏色選擇',
|
|
8
|
+
// Color values for color mixer, has space for a single character
|
|
9
|
+
RED: 'R', GREEN: 'G', BLUE: 'B' });
|
|
10
|
+
Phrasebook.define('zh-Hant', 'ef-color-dialog', translations);
|
|
11
|
+
export default translations;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// Component docs https://elf.int.refinitiv.com/elements/pagination.html
|
|
2
|
+
import { Phrasebook } from '../../translation.js';
|
|
3
|
+
import './shared.js';
|
|
4
|
+
const translations = {
|
|
5
|
+
// page: current page #
|
|
6
|
+
PAGE: '第 {page}頁',
|
|
7
|
+
// page: current page #
|
|
8
|
+
// pageTotal: total number of pages
|
|
9
|
+
PAGE_OF: '第 {page}頁/共{pageTotal} 頁'
|
|
10
|
+
};
|
|
11
|
+
Phrasebook.define('zh-Hant', 'ef-pagination', translations);
|
|
12
|
+
export default translations;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Phrasebook } from '../../translation.js';
|
|
2
|
+
const translations = {
|
|
3
|
+
BEFORE_MIDDAY: 'Before Midday',
|
|
4
|
+
AFTER_MIDDAY: 'After Midday',
|
|
5
|
+
TOGGLE_TIME_PERIOD: 'Toggle Time Period',
|
|
6
|
+
SELECT_HOURS: '{value, select, null {Select hours} other {{value, plural, =1 {# hour} other {# hours}}}}',
|
|
7
|
+
SELECT_MINUTES: '{value, select, null {Select minutes} other {{value, plural, =1 {# minute} other {# minutes}}}}',
|
|
8
|
+
SELECT_SECONDS: '{value, select, null {Select seconds} other {{value, plural, =1 {# second} other {# seconds}}}}',
|
|
9
|
+
SELECTED: '{value, select, null {Selected none. Choose time} other {Selected time is: {showSeconds, select, true {{amPm, select, true {{value, time, ::hmsa}} other {{value, time, ::Hms}}}} other {{amPm, select, true {{value, time, ::hma}} other {{value, time, ::Hm}}}}}}}'
|
|
10
|
+
};
|
|
11
|
+
Phrasebook.define('zh-hant', 'ef-time-picker', translations);
|
|
12
|
+
export default translations;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import './shared.js';
|
|
2
|
+
declare const translations: {
|
|
3
|
+
FULL_LIST: string;
|
|
4
|
+
SELECTED: string;
|
|
5
|
+
EXPAND_COLLAPSE: string;
|
|
6
|
+
SELECT_CONTROL: string;
|
|
7
|
+
DONE: string;
|
|
8
|
+
SELECTED_NUM: string;
|
|
9
|
+
MATCHES_NUM: string;
|
|
10
|
+
MULTIPLE_ITEMS: string;
|
|
11
|
+
NO_OPTIONS: string;
|
|
12
|
+
};
|
|
13
|
+
export default translations;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// Component docs https://elf.int.refinitiv.com/elements/tree-select.html
|
|
2
|
+
import { Phrasebook } from '../../translation.js';
|
|
3
|
+
import './shared.js';
|
|
4
|
+
import comboboxTranslations from './combo-box';
|
|
5
|
+
const translations = Object.assign(Object.assign({}, comboboxTranslations), {
|
|
6
|
+
// used as a toggle control
|
|
7
|
+
FULL_LIST: '完整列表', SELECTED: '已選項列表', EXPAND_COLLAPSE: '{expansion, select, true {全部收起} other {全部展開}}', SELECT_CONTROL: '{selected, select, true {取消全選} other {全選}}',
|
|
8
|
+
// button control
|
|
9
|
+
DONE: '完成',
|
|
10
|
+
// selection/filter feedback
|
|
11
|
+
SELECTED_NUM: '{numSelected, plural, =0 {} =1 {已選 1 項。} other {已選 # 項。}}', MATCHES_NUM: '{numMatched, plural, =0 {未找到結果。} =1 {找到了 1 個結果。} other {找到了 # 個結果。}}' });
|
|
12
|
+
Phrasebook.define('zh-Hant', 'ef-tree-select', translations);
|
|
13
|
+
export default translations;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import type { Translations } from './types';
|
|
2
|
+
declare class ObserverKey {
|
|
3
|
+
}
|
|
4
|
+
declare type ObserverCallback = (locale: string) => void;
|
|
5
|
+
declare abstract class Phrasebook {
|
|
6
|
+
private static localeMap;
|
|
7
|
+
private static observables;
|
|
8
|
+
private static publish;
|
|
9
|
+
/**
|
|
10
|
+
* Start observing changes to translations
|
|
11
|
+
* @param scope The scope to observe
|
|
12
|
+
* @param callback A callback run when the scope has changed
|
|
13
|
+
* @returns An observe key used to disconnet
|
|
14
|
+
*/
|
|
15
|
+
static observe(scope: string, callback: ObserverCallback): ObserverKey;
|
|
16
|
+
/**
|
|
17
|
+
* Stop observing and disconnect a callback
|
|
18
|
+
* @param key A key to stop observing the scope
|
|
19
|
+
* @returns {void}
|
|
20
|
+
*/
|
|
21
|
+
static disconnect(key: ObserverKey): void;
|
|
22
|
+
/**
|
|
23
|
+
* Define shared scope translations.
|
|
24
|
+
* Shared scope are available globally across all translation keys.
|
|
25
|
+
* @param locale Locale
|
|
26
|
+
* @param translations Translations
|
|
27
|
+
* @returns {void}
|
|
28
|
+
*/
|
|
29
|
+
static define(locale: string, translations: Translations): void;
|
|
30
|
+
/**
|
|
31
|
+
* Define scoped translations.
|
|
32
|
+
* @param locale Locale
|
|
33
|
+
* @param scope Scope
|
|
34
|
+
* @param translations Translations
|
|
35
|
+
* @returns {void}
|
|
36
|
+
*/
|
|
37
|
+
static define(locale: string, scope: string, translations: Translations): void;
|
|
38
|
+
/**
|
|
39
|
+
* Get translation for locale and scope.
|
|
40
|
+
* @param locale Locale to get
|
|
41
|
+
* @param scope Scope to get
|
|
42
|
+
* @returns translation or null
|
|
43
|
+
*/
|
|
44
|
+
static get(locale: string, scope: string): null | Translations;
|
|
45
|
+
/**
|
|
46
|
+
* Get a list of supported locales per scope
|
|
47
|
+
* @param [scope=SHARED_SCOPE] A scope to check. If none provided a shared scope is returned
|
|
48
|
+
* @returns list of supported locales
|
|
49
|
+
*/
|
|
50
|
+
static supported(scope?: string): string[];
|
|
51
|
+
}
|
|
52
|
+
export { ObserverKey, ObserverCallback, Phrasebook };
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
const SHARED_SCOPE = '__shared__'; /* unique scope identifier */
|
|
2
|
+
class ObserverKey {
|
|
3
|
+
}
|
|
4
|
+
class Phrasebook {
|
|
5
|
+
static publish(publishLocale, publishScope) {
|
|
6
|
+
const callbackFn = (observable) => {
|
|
7
|
+
const { callback, scope } = observable;
|
|
8
|
+
// for shared scope all observed must be updated
|
|
9
|
+
if (publishScope === SHARED_SCOPE || publishScope === scope) {
|
|
10
|
+
callback(publishLocale);
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
this.observables.forEach(callbackFn);
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Start observing changes to translations
|
|
17
|
+
* @param scope The scope to observe
|
|
18
|
+
* @param callback A callback run when the scope has changed
|
|
19
|
+
* @returns An observe key used to disconnet
|
|
20
|
+
*/
|
|
21
|
+
static observe(scope, callback) {
|
|
22
|
+
const key = new ObserverKey();
|
|
23
|
+
this.observables.set(key, {
|
|
24
|
+
scope,
|
|
25
|
+
callback
|
|
26
|
+
});
|
|
27
|
+
return key;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Stop observing and disconnect a callback
|
|
31
|
+
* @param key A key to stop observing the scope
|
|
32
|
+
* @returns {void}
|
|
33
|
+
*/
|
|
34
|
+
static disconnect(key) {
|
|
35
|
+
this.observables.delete(key);
|
|
36
|
+
}
|
|
37
|
+
static define(locale, scope, translations = scope) {
|
|
38
|
+
if (scope === SHARED_SCOPE) {
|
|
39
|
+
throw new Error(`${SHARED_SCOPE} scope name is reserved`);
|
|
40
|
+
}
|
|
41
|
+
if (!locale || !scope || !translations) {
|
|
42
|
+
throw new Error('Translations must define locale, scope and translations collection');
|
|
43
|
+
}
|
|
44
|
+
scope = typeof scope !== 'string' ? SHARED_SCOPE : scope;
|
|
45
|
+
const translationMap = this.localeMap[locale] || {};
|
|
46
|
+
translationMap[scope] = translations;
|
|
47
|
+
this.localeMap[locale] = translationMap;
|
|
48
|
+
this.publish(locale, scope);
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Get translation for locale and scope.
|
|
52
|
+
* @param locale Locale to get
|
|
53
|
+
* @param scope Scope to get
|
|
54
|
+
* @returns translation or null
|
|
55
|
+
*/
|
|
56
|
+
static get(locale, scope) {
|
|
57
|
+
const translationsMap = this.localeMap[locale];
|
|
58
|
+
if (!translationsMap) {
|
|
59
|
+
return null;
|
|
60
|
+
}
|
|
61
|
+
return Object.assign({}, translationsMap[SHARED_SCOPE] || {}, translationsMap[scope] || {});
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Get a list of supported locales per scope
|
|
65
|
+
* @param [scope=SHARED_SCOPE] A scope to check. If none provided a shared scope is returned
|
|
66
|
+
* @returns list of supported locales
|
|
67
|
+
*/
|
|
68
|
+
static supported(scope = SHARED_SCOPE) {
|
|
69
|
+
const locales = [];
|
|
70
|
+
const localeMap = this.localeMap;
|
|
71
|
+
let translation;
|
|
72
|
+
let locale;
|
|
73
|
+
for (locale in localeMap) {
|
|
74
|
+
translation = localeMap[locale];
|
|
75
|
+
if (translation[scope]) {
|
|
76
|
+
locales.push(locale);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
return locales;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
Phrasebook.localeMap = {};
|
|
83
|
+
Phrasebook.observables = new Map();
|
|
84
|
+
export { ObserverKey, Phrasebook };
|