@refinitiv-ui/phrasebook 5.3.1-alpha.0 → 5.5.0-alpha.1
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/CHANGELOG.md +13 -1
- package/package.json +15 -54
- package/lib/index.d.ts +0 -2
- package/lib/index.js +0 -1
- package/lib/locale/de/calendar.d.ts +0 -18
- package/lib/locale/de/calendar.js +0 -20
- package/lib/locale/de/color-dialog.d.ts +0 -8
- package/lib/locale/de/color-dialog.js +0 -11
- package/lib/locale/de/combo-box.d.ts +0 -6
- package/lib/locale/de/combo-box.js +0 -8
- package/lib/locale/de/dialog.d.ts +0 -5
- package/lib/locale/de/dialog.js +0 -8
- package/lib/locale/de/pagination.d.ts +0 -6
- package/lib/locale/de/pagination.js +0 -20
- package/lib/locale/de/password-field.d.ts +0 -5
- package/lib/locale/de/password-field.js +0 -7
- package/lib/locale/de/search-field.d.ts +0 -4
- package/lib/locale/de/search-field.js +0 -6
- package/lib/locale/de/shared.d.ts +0 -7
- package/lib/locale/de/shared.js +0 -10
- package/lib/locale/de/time-picker.d.ts +0 -10
- package/lib/locale/de/time-picker.js +0 -12
- package/lib/locale/de/tree-select.d.ts +0 -13
- package/lib/locale/de/tree-select.js +0 -13
- package/lib/locale/en/calendar.d.ts +0 -18
- package/lib/locale/en/calendar.js +0 -20
- package/lib/locale/en/color-dialog.d.ts +0 -8
- package/lib/locale/en/color-dialog.js +0 -11
- package/lib/locale/en/combo-box.d.ts +0 -6
- package/lib/locale/en/combo-box.js +0 -8
- package/lib/locale/en/dialog.d.ts +0 -5
- package/lib/locale/en/dialog.js +0 -7
- package/lib/locale/en/pagination.d.ts +0 -6
- package/lib/locale/en/pagination.js +0 -20
- package/lib/locale/en/password-field.d.ts +0 -5
- package/lib/locale/en/password-field.js +0 -7
- package/lib/locale/en/search-field.d.ts +0 -4
- package/lib/locale/en/search-field.js +0 -6
- package/lib/locale/en/shared.d.ts +0 -7
- package/lib/locale/en/shared.js +0 -10
- package/lib/locale/en/time-picker.d.ts +0 -10
- package/lib/locale/en/time-picker.js +0 -12
- package/lib/locale/en/tree-select.d.ts +0 -13
- package/lib/locale/en/tree-select.js +0 -13
- package/lib/locale/ja/calendar.d.ts +0 -18
- package/lib/locale/ja/calendar.js +0 -20
- package/lib/locale/ja/color-dialog.d.ts +0 -8
- package/lib/locale/ja/color-dialog.js +0 -11
- package/lib/locale/ja/combo-box.d.ts +0 -6
- package/lib/locale/ja/combo-box.js +0 -8
- package/lib/locale/ja/dialog.d.ts +0 -5
- package/lib/locale/ja/dialog.js +0 -8
- package/lib/locale/ja/pagination.d.ts +0 -6
- package/lib/locale/ja/pagination.js +0 -20
- package/lib/locale/ja/password-field.d.ts +0 -5
- package/lib/locale/ja/password-field.js +0 -7
- package/lib/locale/ja/search-field.d.ts +0 -4
- package/lib/locale/ja/search-field.js +0 -6
- package/lib/locale/ja/shared.d.ts +0 -7
- package/lib/locale/ja/shared.js +0 -10
- package/lib/locale/ja/time-picker.d.ts +0 -10
- package/lib/locale/ja/time-picker.js +0 -12
- package/lib/locale/ja/tree-select.d.ts +0 -13
- package/lib/locale/ja/tree-select.js +0 -13
- package/lib/locale/zh/calendar.d.ts +0 -18
- package/lib/locale/zh/calendar.js +0 -20
- package/lib/locale/zh/color-dialog.d.ts +0 -8
- package/lib/locale/zh/color-dialog.js +0 -11
- package/lib/locale/zh/combo-box.d.ts +0 -6
- package/lib/locale/zh/combo-box.js +0 -8
- package/lib/locale/zh/dialog.d.ts +0 -5
- package/lib/locale/zh/dialog.js +0 -8
- package/lib/locale/zh/pagination.d.ts +0 -6
- package/lib/locale/zh/pagination.js +0 -20
- package/lib/locale/zh/password-field.d.ts +0 -5
- package/lib/locale/zh/password-field.js +0 -7
- package/lib/locale/zh/search-field.d.ts +0 -4
- package/lib/locale/zh/search-field.js +0 -6
- package/lib/locale/zh/shared.d.ts +0 -7
- package/lib/locale/zh/shared.js +0 -10
- package/lib/locale/zh/time-picker.d.ts +0 -10
- package/lib/locale/zh/time-picker.js +0 -12
- package/lib/locale/zh/tree-select.d.ts +0 -13
- package/lib/locale/zh/tree-select.js +0 -13
- package/lib/locale/zh-hant/calendar.d.ts +0 -18
- package/lib/locale/zh-hant/calendar.js +0 -20
- package/lib/locale/zh-hant/color-dialog.d.ts +0 -8
- package/lib/locale/zh-hant/color-dialog.js +0 -11
- package/lib/locale/zh-hant/combo-box.d.ts +0 -6
- package/lib/locale/zh-hant/combo-box.js +0 -8
- package/lib/locale/zh-hant/dialog.d.ts +0 -5
- package/lib/locale/zh-hant/dialog.js +0 -8
- package/lib/locale/zh-hant/pagination.d.ts +0 -6
- package/lib/locale/zh-hant/pagination.js +0 -20
- package/lib/locale/zh-hant/password-field.d.ts +0 -5
- package/lib/locale/zh-hant/password-field.js +0 -7
- package/lib/locale/zh-hant/search-field.d.ts +0 -4
- package/lib/locale/zh-hant/search-field.js +0 -6
- package/lib/locale/zh-hant/shared.d.ts +0 -7
- package/lib/locale/zh-hant/shared.js +0 -10
- package/lib/locale/zh-hant/time-picker.d.ts +0 -10
- package/lib/locale/zh-hant/time-picker.js +0 -12
- package/lib/locale/zh-hant/tree-select.d.ts +0 -13
- package/lib/locale/zh-hant/tree-select.js +0 -13
- package/lib/translation.d.ts +0 -52
- package/lib/translation.js +0 -84
- package/lib/types.d.ts +0 -4
- package/lib/types.js +0 -1
|
@@ -1,12 +0,0 @@
|
|
|
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;
|
|
@@ -1,13 +0,0 @@
|
|
|
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;
|
|
@@ -1,13 +0,0 @@
|
|
|
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;
|
package/lib/translation.d.ts
DELETED
|
@@ -1,52 +0,0 @@
|
|
|
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 };
|
package/lib/translation.js
DELETED
|
@@ -1,84 +0,0 @@
|
|
|
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 };
|
package/lib/types.d.ts
DELETED
package/lib/types.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|