piral-translate 1.8.0-beta.7667 → 1.8.0-beta.7721

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": "piral-translate",
3
- "version": "1.8.0-beta.7667",
3
+ "version": "1.8.0-beta.7721",
4
4
  "description": "Plugin for providing translated messages in Piral.",
5
5
  "keywords": [
6
6
  "piral",
@@ -57,8 +57,8 @@
57
57
  "devDependencies": {
58
58
  "@types/deepmerge": "^2.2.0",
59
59
  "@types/react": "^18.0.0",
60
- "piral-core": "1.8.0-beta.7667",
60
+ "piral-core": "1.8.0-beta.7721",
61
61
  "react": "^18.0.0"
62
62
  },
63
- "gitHead": "658a8503fdf62c503e4d7cbe86cb3f6da0b2d76d"
63
+ "gitHead": "68a3bc176511f7a36b453f0addac97f3e5621e72"
64
64
  }
@@ -47,7 +47,7 @@ describe('Translation Action Module', () => {
47
47
  const actions = createActions(localizer);
48
48
  const ctx = ca(state, createListener());
49
49
  actions.selectLanguage(ctx, 'de');
50
- expect((state.getState())).toEqual({
50
+ expect(state.getState()).toEqual({
51
51
  foo: 5,
52
52
  language: {
53
53
  foo: 10,
@@ -75,15 +75,15 @@ describe('Create Localize API', () => {
75
75
 
76
76
  it('createApi can translate from local-global translations using the current language and passed nested translations', () => {
77
77
  const config = {
78
- language: 'en'
78
+ language: 'en',
79
79
  };
80
80
  const api = (createLocaleApi(setupLocalizer(config))(context) as any)();
81
81
  api.setTranslations({
82
82
  en: {
83
83
  header: {
84
- title: 'Hello world'
85
- }
86
- }
84
+ title: 'Hello world',
85
+ },
86
+ },
87
87
  });
88
88
  const result = api.translate('header.title');
89
89
  expect(result).toBe('Hello world');
@@ -172,9 +172,7 @@ describe('Create Localize API', () => {
172
172
  },
173
173
  };
174
174
  const api = (createLocaleApi(setupLocalizer(config))(context) as any)();
175
- api.addTranslations([
176
- messagesToAdd
177
- ]);
175
+ api.addTranslations([messagesToAdd]);
178
176
  const result = api.translate('baz');
179
177
 
180
178
  expect(result).toEqual(messagesToAdd.fr.baz);
@@ -198,9 +196,7 @@ describe('Create Localize API', () => {
198
196
  },
199
197
  };
200
198
  const api = (createLocaleApi(setupLocalizer(config))(context) as any)();
201
- api.addTranslations([
202
- messagesToAdd
203
- ]);
199
+ api.addTranslations([messagesToAdd]);
204
200
  const result = api.translate('bar');
205
201
 
206
202
  expect(result).toEqual(messagesToAdd.fr.bar);
@@ -224,12 +220,7 @@ describe('Create Localize API', () => {
224
220
  },
225
221
  };
226
222
  const api = (createLocaleApi(setupLocalizer(config))(context) as any)();
227
- api.addTranslations(
228
- [
229
- messagesToAdd
230
- ],
231
- false
232
- );
223
+ api.addTranslations([messagesToAdd], false);
233
224
  const result = api.translate('bar');
234
225
 
235
226
  expect(result).toEqual(config.messages.fr.bar);
@@ -8,11 +8,11 @@ describe('Flatten translations', () => {
8
8
  it('flattenTranslations can handle flat keys', () => {
9
9
  const messages = {
10
10
  en: {
11
- key: 'value'
11
+ key: 'value',
12
12
  },
13
13
  fr: {
14
- key: 'value (fr)'
15
- }
14
+ key: 'value (fr)',
15
+ },
16
16
  };
17
17
  const flatMessages = flattenTranslations(messages);
18
18
  expect(flatMessages.fr.key).toEqual('value (fr)');
@@ -21,8 +21,8 @@ describe('Flatten translations', () => {
21
21
  it('flattenTranslations can handle flat dot keys', () => {
22
22
  const messages = {
23
23
  en: {
24
- 'header.title': 'Hello world'
25
- }
24
+ 'header.title': 'Hello world',
25
+ },
26
26
  };
27
27
  const flatMessages = flattenTranslations(messages);
28
28
  expect(flatMessages.en['header.title']).toBe('Hello world');
@@ -32,9 +32,9 @@ describe('Flatten translations', () => {
32
32
  const messages = {
33
33
  en: {
34
34
  header: {
35
- title: 'Hello world'
36
- }
37
- }
35
+ title: 'Hello world',
36
+ },
37
+ },
38
38
  };
39
39
  const flatMessages = flattenTranslations(messages);
40
40
  expect(flatMessages.en['header.title']).toBe('Hello world');
@@ -45,10 +45,10 @@ describe('Flatten translations', () => {
45
45
  en: {
46
46
  header: {
47
47
  title: {
48
- subtitle: 'Hello world'
49
- }
50
- }
51
- }
48
+ subtitle: 'Hello world',
49
+ },
50
+ },
51
+ },
52
52
  };
53
53
  const flatMessages = flattenTranslations(messages);
54
54
  expect(flatMessages.en['header.title.subtitle']).toBe('Hello world');
@@ -10,8 +10,8 @@ const messages = {
10
10
  greeting: 'Hi {{name}}, welcome back',
11
11
  secretNumber: 'The secret number is {{number}}.',
12
12
  header: {
13
- title: 'Hello world'
14
- }
13
+ title: 'Hello world',
14
+ },
15
15
  },
16
16
  de: {
17
17
  hi: 'hallo',