@prezly/theme-kit-nextjs 1.11.4 → 1.12.0-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/build/intl/languages.d.ts +2 -0
- package/build/intl/languages.js +8 -13
- package/build/intl/languages.js.map +1 -1
- package/build/intl/locale.js +4 -1
- package/build/intl/locale.js.map +1 -1
- package/build/intl/localeObject.js +1 -1
- package/build/intl/localeObject.js.map +1 -1
- package/build/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -3
- package/src/__mocks__/languages.ts +365 -0
- package/src/__mocks__/story.ts +350 -0
- package/src/intl/languages.test.ts +217 -0
- package/src/intl/languages.ts +8 -14
- package/src/intl/locale.test.ts +94 -0
- package/src/intl/locale.ts +6 -1
- package/src/intl/localeObject.test.ts +78 -0
- package/src/intl/localeObject.ts +1 -1
|
@@ -0,0 +1,350 @@
|
|
|
1
|
+
import type { ExtendedStory } from '@prezly/sdk';
|
|
2
|
+
import {
|
|
3
|
+
StoryLifecycleStatus,
|
|
4
|
+
StoryPublicationStatus,
|
|
5
|
+
StoryVisibility,
|
|
6
|
+
TextDirection,
|
|
7
|
+
} from '@prezly/sdk';
|
|
8
|
+
|
|
9
|
+
export const STORY: ExtendedStory = {
|
|
10
|
+
id: 380023,
|
|
11
|
+
uuid: '65018f5b-b313-453f-b23b-9e739c6a8591',
|
|
12
|
+
thumbnail_url:
|
|
13
|
+
'https://avatars-cdn.prezly.com/story/6337/380023/c3a3d56ee09ce808dbb1bc2f06d16b68bdaeefbf731d8a080b7e4d5e68fb3e94?t=1640077510&v=1',
|
|
14
|
+
title: 'Take a breath',
|
|
15
|
+
subtitle:
|
|
16
|
+
"Going through your socials, you'll likely come across some guru preaching that this quarantine is the ideal moment to pause your busy life and just chill. While it's up to you to decide what's best, few can argue that you shouldn't take every opportunity to stick your head out and suck in a lungful of that fresh(er) air.",
|
|
17
|
+
intro: '',
|
|
18
|
+
summary:
|
|
19
|
+
"Air quality has been an important topic this millennium. There were those who didn't believe we had an impact on it, but these past weeks have proved otherwise.",
|
|
20
|
+
culture: {
|
|
21
|
+
code: 'en',
|
|
22
|
+
locale: 'en',
|
|
23
|
+
name: 'English (Global)',
|
|
24
|
+
native_name: 'English (Global)',
|
|
25
|
+
direction: TextDirection.LTR,
|
|
26
|
+
language_code: 'en',
|
|
27
|
+
},
|
|
28
|
+
slug: 'take-a-breath',
|
|
29
|
+
format_version: 3,
|
|
30
|
+
language: 'EN',
|
|
31
|
+
lifecycle_status: StoryLifecycleStatus.PUBLISHED,
|
|
32
|
+
publication_status: StoryPublicationStatus.PUBLISHED,
|
|
33
|
+
visibility: StoryVisibility.PUBLIC,
|
|
34
|
+
is_archived: false,
|
|
35
|
+
is_finalized: true,
|
|
36
|
+
is_published: true,
|
|
37
|
+
is_draft: false,
|
|
38
|
+
is_embargo: false,
|
|
39
|
+
is_private: false,
|
|
40
|
+
is_scheduled: false,
|
|
41
|
+
is_analytics_available: true,
|
|
42
|
+
is_sharable: true,
|
|
43
|
+
created_at: '2020-04-28T12:03:46+00:00',
|
|
44
|
+
updated_at: '2021-12-21T09:05:10+00:00',
|
|
45
|
+
published_at: '2020-04-30T12:56:00+00:00',
|
|
46
|
+
scheduled_at: null,
|
|
47
|
+
author: {
|
|
48
|
+
id: 7680,
|
|
49
|
+
username: 'marthe@prezly.com',
|
|
50
|
+
email: 'marthe@prezly.com',
|
|
51
|
+
display_name: 'Marthe Anthonis',
|
|
52
|
+
first_name: 'Marthe',
|
|
53
|
+
last_name: 'Anthonis',
|
|
54
|
+
avatar_url:
|
|
55
|
+
'https://avatars-cdn.prezly.com/user/7680/6260be53465a846a511c44edd8f594f38235d782f3fa515ab968ad2f947a236c?v=1&c=cc6e751bdb46638cd948d0d812149ce391e45b7cd2b5d80a94de575ba0ce65d0',
|
|
56
|
+
use_case_answer: 'unknown',
|
|
57
|
+
sign_in_flow: 'password',
|
|
58
|
+
created_at: '2019-02-06T09:54:34+00:00',
|
|
59
|
+
is_terms_of_service_accepted: false,
|
|
60
|
+
last_seen_at: '2021-12-03T09:15:39+00:00',
|
|
61
|
+
},
|
|
62
|
+
newsroom: {
|
|
63
|
+
uuid: '578e78e9-9a5b-44ad-bda2-5214895ee036',
|
|
64
|
+
id: 12698,
|
|
65
|
+
name: 'The Good News Room',
|
|
66
|
+
display_name: 'The Good News Room',
|
|
67
|
+
subdomain: 'the-good-news-room',
|
|
68
|
+
thumbnail_url:
|
|
69
|
+
'https://avatars-cdn.prezly.com/newsroom/12698/e4939974b7781d4c61e282713116690387e9b7b1f6302478b13b68e18e0d3055?t=1648556918&v=1',
|
|
70
|
+
timezone: 'europe/london',
|
|
71
|
+
is_active: true,
|
|
72
|
+
is_archived: false,
|
|
73
|
+
is_online: true,
|
|
74
|
+
is_offline: false,
|
|
75
|
+
is_multilingual: true,
|
|
76
|
+
is_indexable: true,
|
|
77
|
+
url: 'https://the-good-news-room.prezly.com/',
|
|
78
|
+
links: {
|
|
79
|
+
media_gallery_api: 'https://api.prezly.com/v1/rooms/12698/media',
|
|
80
|
+
room_contacts_api: 'https://api.prezly.com/v1/rooms/12698/contacts',
|
|
81
|
+
analytics_and_visibility_settings:
|
|
82
|
+
'https://rock.prezly.com/pressroom/the-good-news-room/ga',
|
|
83
|
+
categories_management:
|
|
84
|
+
'https://rock.prezly.com/settings/newsrooms/578e78e9-9a5b-44ad-bda2-5214895ee036/categories',
|
|
85
|
+
company_info_settings:
|
|
86
|
+
'https://rock.prezly.com/settings/newsrooms/578e78e9-9a5b-44ad-bda2-5214895ee036/information',
|
|
87
|
+
contacts_management:
|
|
88
|
+
'https://rock.prezly.com/settings/newsrooms/578e78e9-9a5b-44ad-bda2-5214895ee036/contacts',
|
|
89
|
+
domain_settings: 'https://rock.prezly.com/pressroom/the-good-news-room/domain',
|
|
90
|
+
edit: 'https://rock.prezly.com/settings/newsrooms/578e78e9-9a5b-44ad-bda2-5214895ee036/information',
|
|
91
|
+
gallery_management: 'https://rock.prezly.com/pressroom/the-good-news-room/gallery',
|
|
92
|
+
hub_settings: 'https://rock.prezly.com/pressroom/the-good-news-room/hub',
|
|
93
|
+
languages:
|
|
94
|
+
'https://rock.prezly.com/settings/newsrooms/578e78e9-9a5b-44ad-bda2-5214895ee036/languages',
|
|
95
|
+
look_and_feel_settings:
|
|
96
|
+
'https://rock.prezly.com/settings/newsrooms/578e78e9-9a5b-44ad-bda2-5214895ee036/themes',
|
|
97
|
+
manual_subscription_management: '',
|
|
98
|
+
privacy_settings:
|
|
99
|
+
'https://rock.prezly.com/settings/newsrooms/578e78e9-9a5b-44ad-bda2-5214895ee036/privacy',
|
|
100
|
+
widget_settings: 'https://rock.prezly.com/pressroom/the-good-news-room/widget',
|
|
101
|
+
},
|
|
102
|
+
time_format: 'HH:mm',
|
|
103
|
+
date_format: 'D/M/YY',
|
|
104
|
+
},
|
|
105
|
+
oembed: {
|
|
106
|
+
type: 'link',
|
|
107
|
+
url: 'https://the-good-news-room.prezly.com/take-a-breath',
|
|
108
|
+
title: 'Take a breath',
|
|
109
|
+
description:
|
|
110
|
+
"Going through your socials, you'll likely come across some guru preaching that this quarantine is the ideal moment to pause your busy life and just chill. While it's up to you to decide what's best, few can argue that you shouldn't take every opportunity to stick your head out and suck in a lungful of that fresh(er) air.",
|
|
111
|
+
thumbnail_url:
|
|
112
|
+
'https://cdn.uc.assets.prezly.com/e9dc3b29-3d91-46e4-b9a0-695f8517bbf0/-/preview/600x600/',
|
|
113
|
+
thumbnail_width: 1024,
|
|
114
|
+
thumbnail_height: 482,
|
|
115
|
+
version: '1.0',
|
|
116
|
+
},
|
|
117
|
+
links: {
|
|
118
|
+
api: 'https://api.prezly.com/v1/stories/380023',
|
|
119
|
+
preview: '',
|
|
120
|
+
edit: 'https://rock.prezly.com/stories/380023',
|
|
121
|
+
sharing: 'https://rock.prezly.com/stories/380023/sharing',
|
|
122
|
+
duplicate: 'https://rock.prezly.com/pressrelease/duplicate/380023',
|
|
123
|
+
translate: 'https://rock.prezly.com/pressrelease/translate/380023',
|
|
124
|
+
analytics: 'https://rock.prezly.com/stories/380023/report',
|
|
125
|
+
publication_api: 'https://api.prezly.com/v1/stories/380023/publication',
|
|
126
|
+
create_campaign: '',
|
|
127
|
+
reports_api: 'https://api.prezly.com/v1/stories/380023/reports',
|
|
128
|
+
short: 'http://prez.ly/zRAb',
|
|
129
|
+
newsroom_view: 'https://the-good-news-room.prezly.com/take-a-breath',
|
|
130
|
+
newsroom_preview:
|
|
131
|
+
'https://the-good-news-room.prezly.com/s/65018f5b-b313-453f-b23b-9e739c6a8591',
|
|
132
|
+
},
|
|
133
|
+
categories: [],
|
|
134
|
+
translations: [
|
|
135
|
+
{
|
|
136
|
+
id: 380028,
|
|
137
|
+
uuid: 'db07a149-ce6a-4446-a86e-689440fae2ac',
|
|
138
|
+
slug: 'adem',
|
|
139
|
+
thumbnail_url:
|
|
140
|
+
'https://avatars-cdn.prezly.com/story/6337/380028/6a9248cfbf88bbea5eb9ca1b3907a9bf163e4a41a34598ad38a3d1150c648b79?t=1640077505&v=1',
|
|
141
|
+
title: 'Adem!',
|
|
142
|
+
culture: {
|
|
143
|
+
code: 'nl_BE',
|
|
144
|
+
locale: 'nl_BE',
|
|
145
|
+
name: 'Dutch (Belgium)',
|
|
146
|
+
native_name: 'Nederlands (België)',
|
|
147
|
+
direction: TextDirection.LTR,
|
|
148
|
+
language_code: 'nl',
|
|
149
|
+
},
|
|
150
|
+
lifecycle_status: StoryLifecycleStatus.PUBLISHED,
|
|
151
|
+
publication_status: StoryPublicationStatus.PUBLISHED,
|
|
152
|
+
visibility: StoryVisibility.PUBLIC,
|
|
153
|
+
created_at: '2020-05-05T10:07:11+00:00',
|
|
154
|
+
updated_at: '2021-12-21T09:05:05+00:00',
|
|
155
|
+
published_at: '2020-05-05T10:21:00+00:00',
|
|
156
|
+
scheduled_at: null,
|
|
157
|
+
author: {
|
|
158
|
+
id: 7680,
|
|
159
|
+
username: 'marthe@prezly.com',
|
|
160
|
+
email: 'marthe@prezly.com',
|
|
161
|
+
display_name: 'Marthe Anthonis',
|
|
162
|
+
first_name: 'Marthe',
|
|
163
|
+
last_name: 'Anthonis',
|
|
164
|
+
avatar_url:
|
|
165
|
+
'https://avatars-cdn.prezly.com/user/7680/6260be53465a846a511c44edd8f594f38235d782f3fa515ab968ad2f947a236c?v=1&c=cc6e751bdb46638cd948d0d812149ce391e45b7cd2b5d80a94de575ba0ce65d0',
|
|
166
|
+
use_case_answer: 'unknown',
|
|
167
|
+
sign_in_flow: 'password',
|
|
168
|
+
created_at: '2019-02-06T09:54:34+00:00',
|
|
169
|
+
is_terms_of_service_accepted: false,
|
|
170
|
+
last_seen_at: '2021-12-03T09:15:39+00:00',
|
|
171
|
+
},
|
|
172
|
+
newsroom: {
|
|
173
|
+
uuid: '578e78e9-9a5b-44ad-bda2-5214895ee036',
|
|
174
|
+
id: 12698,
|
|
175
|
+
name: 'The Good News Room',
|
|
176
|
+
display_name: 'The Good News Room',
|
|
177
|
+
subdomain: 'the-good-news-room',
|
|
178
|
+
thumbnail_url:
|
|
179
|
+
'https://avatars-cdn.prezly.com/newsroom/12698/e4939974b7781d4c61e282713116690387e9b7b1f6302478b13b68e18e0d3055?t=1648556918&v=1',
|
|
180
|
+
timezone: 'europe/london',
|
|
181
|
+
is_active: true,
|
|
182
|
+
is_archived: false,
|
|
183
|
+
is_online: true,
|
|
184
|
+
is_offline: false,
|
|
185
|
+
is_multilingual: true,
|
|
186
|
+
is_indexable: true,
|
|
187
|
+
url: 'https://the-good-news-room.prezly.com/',
|
|
188
|
+
links: {
|
|
189
|
+
media_gallery_api: 'https://api.prezly.com/v1/rooms/12698/media',
|
|
190
|
+
room_contacts_api: 'https://api.prezly.com/v1/rooms/12698/contacts',
|
|
191
|
+
analytics_and_visibility_settings:
|
|
192
|
+
'https://rock.prezly.com/pressroom/the-good-news-room/ga',
|
|
193
|
+
categories_management:
|
|
194
|
+
'https://rock.prezly.com/settings/newsrooms/578e78e9-9a5b-44ad-bda2-5214895ee036/categories',
|
|
195
|
+
company_info_settings:
|
|
196
|
+
'https://rock.prezly.com/settings/newsrooms/578e78e9-9a5b-44ad-bda2-5214895ee036/information',
|
|
197
|
+
contacts_management:
|
|
198
|
+
'https://rock.prezly.com/settings/newsrooms/578e78e9-9a5b-44ad-bda2-5214895ee036/contacts',
|
|
199
|
+
domain_settings: 'https://rock.prezly.com/pressroom/the-good-news-room/domain',
|
|
200
|
+
edit: 'https://rock.prezly.com/settings/newsrooms/578e78e9-9a5b-44ad-bda2-5214895ee036/information',
|
|
201
|
+
gallery_management:
|
|
202
|
+
'https://rock.prezly.com/pressroom/the-good-news-room/gallery',
|
|
203
|
+
hub_settings: 'https://rock.prezly.com/pressroom/the-good-news-room/hub',
|
|
204
|
+
languages:
|
|
205
|
+
'https://rock.prezly.com/settings/newsrooms/578e78e9-9a5b-44ad-bda2-5214895ee036/languages',
|
|
206
|
+
look_and_feel_settings:
|
|
207
|
+
'https://rock.prezly.com/settings/newsrooms/578e78e9-9a5b-44ad-bda2-5214895ee036/themes',
|
|
208
|
+
manual_subscription_management: '',
|
|
209
|
+
privacy_settings:
|
|
210
|
+
'https://rock.prezly.com/settings/newsrooms/578e78e9-9a5b-44ad-bda2-5214895ee036/privacy',
|
|
211
|
+
widget_settings: 'https://rock.prezly.com/pressroom/the-good-news-room/widget',
|
|
212
|
+
},
|
|
213
|
+
time_format: 'HH:mm',
|
|
214
|
+
date_format: 'D/M/YY',
|
|
215
|
+
},
|
|
216
|
+
oembed: {
|
|
217
|
+
type: 'link',
|
|
218
|
+
url: 'https://the-good-news-room.prezly.com/adem',
|
|
219
|
+
title: 'Adem!',
|
|
220
|
+
description:
|
|
221
|
+
'Scrollen door je sociale media, levert deze dagen al snel een of andere post van een zelfgenaamde guru op die predikt dat dit een ideale moment is om je drukke leven even op pauze te zetten. Het is helemaal aan jou om te beslissen wat nu het beste is voor jou. Maar weinig mensen kunnen ontkennen dat nu een ideale moment is om je hoofd dor het raam te steken en grote gulpen fris(sere) lucht te nemen.',
|
|
222
|
+
thumbnail_url:
|
|
223
|
+
'https://cdn.uc.assets.prezly.com/e9dc3b29-3d91-46e4-b9a0-695f8517bbf0/-/preview/600x600/',
|
|
224
|
+
thumbnail_width: 1024,
|
|
225
|
+
thumbnail_height: 482,
|
|
226
|
+
version: '1.0',
|
|
227
|
+
},
|
|
228
|
+
links: {
|
|
229
|
+
newsroom_view: 'https://the-good-news-room.prezly.com/adem',
|
|
230
|
+
edit: 'https://rock.prezly.com/stories/380028',
|
|
231
|
+
report: 'https://rock.prezly.com/stories/380028/report',
|
|
232
|
+
},
|
|
233
|
+
},
|
|
234
|
+
{
|
|
235
|
+
id: 492826,
|
|
236
|
+
uuid: 'f6b9daa7-86fb-44f2-b3c3-7fe264b401d3',
|
|
237
|
+
slug: 'translation-adem',
|
|
238
|
+
thumbnail_url:
|
|
239
|
+
'https://avatars-cdn.prezly.com/story/6337/492826/65269a918884e706d75759f309085f3552a7a3848f5df74e3a11bed8a5649ac3?t=1656401349&v=1',
|
|
240
|
+
title: '[translation] Adem!',
|
|
241
|
+
culture: {
|
|
242
|
+
code: 'nl_NL',
|
|
243
|
+
locale: 'nl_NL',
|
|
244
|
+
name: 'Dutch (Netherlands)',
|
|
245
|
+
native_name: 'Nederlands (Nederland)',
|
|
246
|
+
direction: TextDirection.LTR,
|
|
247
|
+
language_code: 'nl',
|
|
248
|
+
},
|
|
249
|
+
lifecycle_status: StoryLifecycleStatus.PUBLISHED,
|
|
250
|
+
publication_status: StoryPublicationStatus.PUBLISHED,
|
|
251
|
+
visibility: StoryVisibility.PUBLIC,
|
|
252
|
+
created_at: '2022-06-28T07:29:03+00:00',
|
|
253
|
+
updated_at: '2022-06-28T07:29:09+00:00',
|
|
254
|
+
published_at: '2022-06-28T07:29:09+00:00',
|
|
255
|
+
scheduled_at: null,
|
|
256
|
+
author: {
|
|
257
|
+
id: 10324,
|
|
258
|
+
username: 'oleg@prezly.com',
|
|
259
|
+
email: 'oleg@prezly.com',
|
|
260
|
+
display_name: 'Oleg Semyonov',
|
|
261
|
+
first_name: 'Oleg',
|
|
262
|
+
last_name: 'Semyonov',
|
|
263
|
+
avatar_url:
|
|
264
|
+
'https://avatars-cdn.prezly.com/user/10324/85fc2201624703503c24a3a97cc7e1776015e9f6ffe2ad96016650add0b9ab5f?v=1&c=add8f27908ec1f74f1a7c0530a74d88027eea08d05cac4300713d1c07fed0e1b',
|
|
265
|
+
use_case_answer: 'stories',
|
|
266
|
+
sign_in_flow: 'google',
|
|
267
|
+
created_at: '2021-02-25T13:30:04+00:00',
|
|
268
|
+
is_terms_of_service_accepted: true,
|
|
269
|
+
last_seen_at: '2022-06-28T09:06:32+00:00',
|
|
270
|
+
},
|
|
271
|
+
newsroom: {
|
|
272
|
+
uuid: '578e78e9-9a5b-44ad-bda2-5214895ee036',
|
|
273
|
+
id: 12698,
|
|
274
|
+
name: 'The Good News Room',
|
|
275
|
+
display_name: 'The Good News Room',
|
|
276
|
+
subdomain: 'the-good-news-room',
|
|
277
|
+
thumbnail_url:
|
|
278
|
+
'https://avatars-cdn.prezly.com/newsroom/12698/e4939974b7781d4c61e282713116690387e9b7b1f6302478b13b68e18e0d3055?t=1648556918&v=1',
|
|
279
|
+
timezone: 'europe/london',
|
|
280
|
+
is_active: true,
|
|
281
|
+
is_archived: false,
|
|
282
|
+
is_online: true,
|
|
283
|
+
is_offline: false,
|
|
284
|
+
is_multilingual: true,
|
|
285
|
+
is_indexable: true,
|
|
286
|
+
url: 'https://the-good-news-room.prezly.com/',
|
|
287
|
+
links: {
|
|
288
|
+
media_gallery_api: 'https://api.prezly.com/v1/rooms/12698/media',
|
|
289
|
+
room_contacts_api: 'https://api.prezly.com/v1/rooms/12698/contacts',
|
|
290
|
+
analytics_and_visibility_settings:
|
|
291
|
+
'https://rock.prezly.com/pressroom/the-good-news-room/ga',
|
|
292
|
+
categories_management:
|
|
293
|
+
'https://rock.prezly.com/settings/newsrooms/578e78e9-9a5b-44ad-bda2-5214895ee036/categories',
|
|
294
|
+
company_info_settings:
|
|
295
|
+
'https://rock.prezly.com/settings/newsrooms/578e78e9-9a5b-44ad-bda2-5214895ee036/information',
|
|
296
|
+
contacts_management:
|
|
297
|
+
'https://rock.prezly.com/settings/newsrooms/578e78e9-9a5b-44ad-bda2-5214895ee036/contacts',
|
|
298
|
+
domain_settings: 'https://rock.prezly.com/pressroom/the-good-news-room/domain',
|
|
299
|
+
edit: 'https://rock.prezly.com/settings/newsrooms/578e78e9-9a5b-44ad-bda2-5214895ee036/information',
|
|
300
|
+
gallery_management:
|
|
301
|
+
'https://rock.prezly.com/pressroom/the-good-news-room/gallery',
|
|
302
|
+
hub_settings: 'https://rock.prezly.com/pressroom/the-good-news-room/hub',
|
|
303
|
+
languages:
|
|
304
|
+
'https://rock.prezly.com/settings/newsrooms/578e78e9-9a5b-44ad-bda2-5214895ee036/languages',
|
|
305
|
+
look_and_feel_settings:
|
|
306
|
+
'https://rock.prezly.com/settings/newsrooms/578e78e9-9a5b-44ad-bda2-5214895ee036/themes',
|
|
307
|
+
manual_subscription_management: '',
|
|
308
|
+
privacy_settings:
|
|
309
|
+
'https://rock.prezly.com/settings/newsrooms/578e78e9-9a5b-44ad-bda2-5214895ee036/privacy',
|
|
310
|
+
widget_settings: 'https://rock.prezly.com/pressroom/the-good-news-room/widget',
|
|
311
|
+
},
|
|
312
|
+
time_format: 'HH:mm',
|
|
313
|
+
date_format: 'D/M/YY',
|
|
314
|
+
},
|
|
315
|
+
oembed: {
|
|
316
|
+
type: 'link',
|
|
317
|
+
url: 'https://the-good-news-room.prezly.com/translation-adem',
|
|
318
|
+
title: '[translation] Adem!',
|
|
319
|
+
description:
|
|
320
|
+
'Scrollen door je sociale media, levert deze dagen al snel een of andere post van een zelfgenaamde guru op die predikt dat dit een ideale moment is om je drukke leven even op pauze te zetten. Het is helemaal aan jou om te beslissen wat nu het beste is voor jou. Maar weinig mensen kunnen ontkennen dat nu een ideale moment is om je hoofd dor het raam te steken en grote gulpen fris(sere) lucht te nemen.',
|
|
321
|
+
thumbnail_url:
|
|
322
|
+
'https://cdn.uc.assets.prezly.com/e9dc3b29-3d91-46e4-b9a0-695f8517bbf0/-/preview/600x600/',
|
|
323
|
+
thumbnail_width: 1024,
|
|
324
|
+
thumbnail_height: 482,
|
|
325
|
+
version: '1.0',
|
|
326
|
+
},
|
|
327
|
+
links: {
|
|
328
|
+
newsroom_view: 'https://the-good-news-room.prezly.com/translation-adem',
|
|
329
|
+
edit: 'https://rock.prezly.com/stories/492826',
|
|
330
|
+
report: 'https://rock.prezly.com/stories/492826/report',
|
|
331
|
+
},
|
|
332
|
+
},
|
|
333
|
+
],
|
|
334
|
+
coverage_number: 0,
|
|
335
|
+
last_coverage_at: null,
|
|
336
|
+
content:
|
|
337
|
+
'{"type":"document","children":[{"type":"paragraph","children":[{"text":"Air quality has been an important topic this millennium. There were those who didn\'t believe we had an impact on it, but these past weeks have proved otherwise. "}]},{"type":"block-quote","children":[{"text":"\\"Air quality is an important factor in determining our lifespan.\\""}]},{"type":"paragraph","children":[{"text":"In "},{"text":"India","bold":true},{"text":", the most air polluted country in the world, the difference is immense. Below, you can see a picture – the left side was taken November 3, 2019, the right side March 30, 2020."}]},{"type":"paragraph","children":[{"text":"What a difference."}]},{"type":"image-block","href":"","file":{"version":2,"uuid":"4fd7edc3-0e7b-4de5-8d88-6fc384cdabd4","filename":"200401105309-20200401-indian-gate-air-pollution-split-super-tease.jpg","mime_type":"image/jpeg","size":73660,"original_width":1100,"original_height":619,"effects":[]},"layout":"contained","align":"center","new_tab":true,"width":"100%","children":[{"text":"Source: https://www.theguardian.com/environment/2020/apr/11/positively-alpine-disbelief-air-pollution-falls-lockdown-coronavirus"}]},{"type":"paragraph","children":[{"text":"Also in India, people are sharing incredible pictures of their view of the Himalayas. For the first time in 30 years, people can see the mountains with crystal clarity from a distance of 200km."}]},{"type":"embed","children":[{"text":""}],"uuid":"539e96a5-f721-4629-aa7c-d9f9946ede28","url":"https://twitter.com/parasrishi/status/1246376229902536704","oembed":{"url":"https://twitter.com/parasrishi/status/1246376229902536704","html":"<div class=\\"iframely-embed\\" style=\\"max-width: 550px;\\"><div class=\\"iframely-responsive\\" style=\\"padding-bottom: 56.2493%;\\"><a href=\\"https://twitter.com/parasrishi/status/1246376229902536704\\" data-iframely-url=\\"//cdn.iframe.ly/api/iframe?url=https%3A%2F%2Ftwitter.com%2Fparasrishi%2Fstatus%2F1246376229902536704&key=8fe6cdec03482ac31f27a6ae8ea2fb3f\\"></a></div></div><script async src=\\"//cdn.iframe.ly/embed.js\\" charset=\\"utf-8\\"></script>","type":"rich","title":"Paras पारस ਰਿਸ਼ੀ on Twitter","author":"Paras पारस ਰਿਸ਼ੀ","options":{"_theme":{"value":"","values":{"dark":"Use dark theme"}},"_hide_media":{"label":"Hide photos, videos, and cards","value":false}},"version":"1.0","cache_age":86400,"author_url":"https://twitter.com/parasrishi","description":"The mighty Himalayas are now visible from Pathankot, Punjab. Thanks to super visibility and no pollution. What an incredible sight! 😌 pic.twitter.com/dY4AI9ZvXa— Paras पारस ਰਿਸ਼ੀ (@parasrishi) April 4, 2020\\n\\n","provider_name":"Twitter","thumbnail_url":"https://pbs.twimg.com/media/EUwEkVvUMAAbdmp.jpg:large","screenshot_url":"https://avatars-cdn.prezly.com/embed/aHR0cHM6Ly90d2l0dGVyLmNvbS9wYXJhc3Jpc2hpL3N0YXR1cy8xMjQ2Mzc2MjI5OTAyNTM2NzA0/9b51f0059a1ab9aaa9cf7c096572d112766eab778ba0f603a66a92e86ce892f7?v=1583930760","thumbnail_width":960,"thumbnail_height":540}},{"type":"paragraph","children":[{"text":""}]},{"type":"paragraph","children":[{"text":"And the effect of the quarantine on air pollution isn\'t only visible in India. Across the world, countries are seeing the benefits in air quality:"}]},{"type":"gallery","children":[{"text":""}],"images":[{"caption":"Italy","file":{"version":2,"uuid":"d6b4a0cd-3dfb-4bcf-9488-06d5516875b3","filename":"Italy.jpg","mime_type":"image/jpeg","size":88682,"original_width":1050,"original_height":450,"effects":[]}},{"caption":"China","file":{"version":2,"uuid":"43645b68-e8f6-407e-9981-04c9d7fdd069","filename":"China.webp","mime_type":"image/webp","size":97888,"original_width":1443,"original_height":811,"effects":[]}},{"caption":"Spain","file":{"version":2,"uuid":"88057ea6-4afd-41d3-98db-5eecd82033ed","filename":"Spain.jpg","mime_type":"image/jpeg","size":87588,"original_width":1080,"original_height":405,"effects":[]}},{"caption":"France","file":{"version":2,"uuid":"dfa3b432-a375-4afd-983f-444540845f56","filename":"France.jpg","mime_type":"image/jpeg","size":141548,"original_width":1440,"original_height":810,"effects":[]}}],"uuid":"b3b49cb3-2495-4206-9219-afcf56a049b8","layout":"full-width","padding":"M","thumbnail_size":"XS"},{"type":"paragraph","children":[{"text":""}]},{"type":"heading-one","children":[{"text":"Exact numbers"}]},{"type":"paragraph","children":[{"text":"As everyone can see, air quality has improved. However, experts find it difficult to express the improvement in numbers. You may have seen several headlines which stated \'40% less air pollution\', this isn\'t completely accurate. Overall, the amount of nitrogen dioxide has fallen but the amount of fine dust is still (too) high."}]},{"type":"block-quote","children":[{"text":"\\"Maybe, when the crisis is over, we\'ll work more remotely, which is good news for our air quality.\\""}]}],"version":"0.50"}',
|
|
338
|
+
thumbnail_image:
|
|
339
|
+
'{"version":2,"uuid":"e9dc3b29-3d91-46e4-b9a0-695f8517bbf0","filename":"air.jpg","mime_type":"image/jpeg","size":50225,"original_width":1024,"original_height":482,"effects":[]}',
|
|
340
|
+
header_image:
|
|
341
|
+
'{"size":442609,"uuid":"e8605194-da87-45f4-a241-ecacc103f6b2","effects":["\\/crop\\/670x280\\/0,25\\/","\\/preview\\/"],"version":2,"filename":"header.png","mime_type":"image\\/png","original_width":670,"original_height":447}',
|
|
342
|
+
preview_image:
|
|
343
|
+
'{"size":50225,"uuid":"e9dc3b29-3d91-46e4-b9a0-695f8517bbf0","effects":[],"version":2,"filename":"air.jpg","mime_type":"image\\/jpeg","original_width":1024,"original_height":482}',
|
|
344
|
+
tag_names: [],
|
|
345
|
+
social_text: 'Take a breath',
|
|
346
|
+
social_image: null,
|
|
347
|
+
referenced_entities: {
|
|
348
|
+
stories: {},
|
|
349
|
+
},
|
|
350
|
+
};
|
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
import { LANGUAGES } from '../__mocks__/languages';
|
|
2
|
+
import { STORY } from '../__mocks__/story';
|
|
3
|
+
|
|
4
|
+
import {
|
|
5
|
+
getCompanyInformation,
|
|
6
|
+
getDefaultLanguage,
|
|
7
|
+
getLanguageByExactLocaleCode,
|
|
8
|
+
getLanguageByNeutralLocaleCode,
|
|
9
|
+
getLanguageByShortRegionCode,
|
|
10
|
+
getLanguageDisplayName,
|
|
11
|
+
getLanguageFromNextLocaleIsoCode,
|
|
12
|
+
getLanguageFromStory,
|
|
13
|
+
getShortestLocaleCode,
|
|
14
|
+
getUsedLanguages,
|
|
15
|
+
} from './languages';
|
|
16
|
+
import { DUMMY_DEFAULT_LOCALE } from './locale';
|
|
17
|
+
import { LocaleObject } from './localeObject';
|
|
18
|
+
|
|
19
|
+
const ALL_LANGUAGES = Object.values(LANGUAGES);
|
|
20
|
+
|
|
21
|
+
describe('getLanguageDisplayName', () => {
|
|
22
|
+
it('returns shortened name when language is the only culture', () => {
|
|
23
|
+
const languages = [LANGUAGES.en, LANGUAGES.fr];
|
|
24
|
+
|
|
25
|
+
expect(getLanguageDisplayName(LANGUAGES.en, languages)).toBe('English');
|
|
26
|
+
expect(getLanguageDisplayName(LANGUAGES.fr, languages)).toBe('Français');
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
it('returns full name when language is NOT the only culture', () => {
|
|
30
|
+
const languages = [LANGUAGES.nl_BE, LANGUAGES.nl_NL];
|
|
31
|
+
|
|
32
|
+
expect(getLanguageDisplayName(LANGUAGES.nl_BE, languages)).toBe('Nederlands (België)');
|
|
33
|
+
expect(getLanguageDisplayName(LANGUAGES.nl_NL, languages)).toBe('Nederlands (Nederland)');
|
|
34
|
+
});
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
describe('getDefaultLanguage', () => {
|
|
38
|
+
it('returns the actual default language', () => {
|
|
39
|
+
const languages = [LANGUAGES.en, LANGUAGES.fr];
|
|
40
|
+
|
|
41
|
+
expect(getDefaultLanguage(languages)).toEqual(LANGUAGES.en);
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
it('returns the first language if no default language is set', () => {
|
|
45
|
+
const languages = [LANGUAGES.nl_BE, LANGUAGES.nl_NL];
|
|
46
|
+
|
|
47
|
+
expect(getDefaultLanguage(languages)).toEqual(LANGUAGES.nl_BE);
|
|
48
|
+
});
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
describe('getUsedLanguages', () => {
|
|
52
|
+
it('filters out languages with no published stories', () => {
|
|
53
|
+
const languages = Object.values(LANGUAGES);
|
|
54
|
+
const usedLanguages = getUsedLanguages(languages);
|
|
55
|
+
|
|
56
|
+
expect(usedLanguages).toHaveLength(3);
|
|
57
|
+
expect(usedLanguages.every(({ public_stories_count }) => public_stories_count > 0)).toBe(
|
|
58
|
+
true,
|
|
59
|
+
);
|
|
60
|
+
});
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
describe('getLanguageByExactLocaleCode', () => {
|
|
64
|
+
const languages = [LANGUAGES.nl_BE, LANGUAGES.en];
|
|
65
|
+
|
|
66
|
+
it('returns a languages by its exact locale code', () => {
|
|
67
|
+
expect(getLanguageByExactLocaleCode(languages, LocaleObject.fromAnyCode('nl-BE'))).toEqual(
|
|
68
|
+
LANGUAGES.nl_BE,
|
|
69
|
+
);
|
|
70
|
+
expect(getLanguageByExactLocaleCode(languages, LocaleObject.fromAnyCode('en'))).toEqual(
|
|
71
|
+
LANGUAGES.en,
|
|
72
|
+
);
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
it('returns undefined when there is no langauge with exact locale code', () => {
|
|
76
|
+
expect(getLanguageByExactLocaleCode(languages, LocaleObject.fromAnyCode('nl'))).toBe(
|
|
77
|
+
undefined,
|
|
78
|
+
);
|
|
79
|
+
});
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
describe('getLanguageByNeutralLocaleCode', () => {
|
|
83
|
+
it('prefers default language', () => {
|
|
84
|
+
const languages = [LANGUAGES.en_US, LANGUAGES.en];
|
|
85
|
+
|
|
86
|
+
expect(getLanguageByNeutralLocaleCode(languages, LocaleObject.fromAnyCode('en'))).toEqual(
|
|
87
|
+
LANGUAGES.en,
|
|
88
|
+
);
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
it('prefers used cultures', () => {
|
|
92
|
+
const languages = [
|
|
93
|
+
LANGUAGES.en,
|
|
94
|
+
{ ...LANGUAGES.nl_BE, public_stories_count: 0, stories_count: 0 },
|
|
95
|
+
LANGUAGES.nl_NL,
|
|
96
|
+
];
|
|
97
|
+
|
|
98
|
+
expect(getLanguageByNeutralLocaleCode(languages, LocaleObject.fromAnyCode('nl'))).toEqual(
|
|
99
|
+
LANGUAGES.nl_NL,
|
|
100
|
+
);
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
it('returns first fitting culture from unused cultures', () => {
|
|
104
|
+
const languages = [
|
|
105
|
+
LANGUAGES.en,
|
|
106
|
+
{ ...LANGUAGES.nl_BE, public_stories_count: 0, stories_count: 0 },
|
|
107
|
+
{ ...LANGUAGES.nl_NL, public_stories_count: 0, stories_count: 0 },
|
|
108
|
+
];
|
|
109
|
+
|
|
110
|
+
expect(getLanguageByNeutralLocaleCode(languages, LocaleObject.fromAnyCode('nl'))).toEqual(
|
|
111
|
+
languages[1],
|
|
112
|
+
);
|
|
113
|
+
});
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
describe('getLanguageByShortRegionCode', () => {
|
|
117
|
+
it('prefers default language', () => {
|
|
118
|
+
const languages = [LANGUAGES.nl_BE, { ...LANGUAGES.fr_BE, is_default: true }];
|
|
119
|
+
|
|
120
|
+
expect(getLanguageByShortRegionCode(languages, LocaleObject.fromAnyCode('be'))).toEqual(
|
|
121
|
+
languages[1],
|
|
122
|
+
);
|
|
123
|
+
});
|
|
124
|
+
|
|
125
|
+
it('prefers used cultures', () => {
|
|
126
|
+
const languages = [LANGUAGES.en, LANGUAGES.nl_BE, LANGUAGES.fr_BE];
|
|
127
|
+
|
|
128
|
+
expect(getLanguageByShortRegionCode(languages, LocaleObject.fromAnyCode('be'))).toEqual(
|
|
129
|
+
LANGUAGES.nl_BE,
|
|
130
|
+
);
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
it('returns first fitting culture from unused cultures', () => {
|
|
134
|
+
const languages = [
|
|
135
|
+
LANGUAGES.en,
|
|
136
|
+
LANGUAGES.fr_BE,
|
|
137
|
+
{ ...LANGUAGES.nl_BE, public_stories_count: 0, stories_count: 0 },
|
|
138
|
+
];
|
|
139
|
+
|
|
140
|
+
expect(getLanguageByShortRegionCode(languages, LocaleObject.fromAnyCode('be'))).toEqual(
|
|
141
|
+
LANGUAGES.fr_BE,
|
|
142
|
+
);
|
|
143
|
+
});
|
|
144
|
+
});
|
|
145
|
+
|
|
146
|
+
describe('getLanguageFromNextLocaleIsoCode', () => {
|
|
147
|
+
it('returns default language when no locale code provided or when dummy locale provided', () => {
|
|
148
|
+
expect(getLanguageFromNextLocaleIsoCode(ALL_LANGUAGES)).toEqual(LANGUAGES.en);
|
|
149
|
+
expect(getLanguageFromNextLocaleIsoCode(ALL_LANGUAGES, DUMMY_DEFAULT_LOCALE)).toEqual(
|
|
150
|
+
LANGUAGES.en,
|
|
151
|
+
);
|
|
152
|
+
});
|
|
153
|
+
|
|
154
|
+
it('returns language by exact code first', () => {
|
|
155
|
+
expect(getLanguageFromNextLocaleIsoCode(ALL_LANGUAGES, 'en')).toEqual(LANGUAGES.en);
|
|
156
|
+
});
|
|
157
|
+
|
|
158
|
+
it('returns language by neutral code second', () => {
|
|
159
|
+
expect(getLanguageFromNextLocaleIsoCode(ALL_LANGUAGES, 'nl')).toEqual(LANGUAGES.nl_BE);
|
|
160
|
+
});
|
|
161
|
+
|
|
162
|
+
it('returns language by region code thrid', () => {
|
|
163
|
+
expect(getLanguageFromNextLocaleIsoCode(ALL_LANGUAGES, 'us')).toEqual(LANGUAGES.en_US);
|
|
164
|
+
});
|
|
165
|
+
|
|
166
|
+
it('returns undefined when no language found', () => {
|
|
167
|
+
expect(getLanguageFromNextLocaleIsoCode(ALL_LANGUAGES, 'zh-Hant')).toEqual(undefined);
|
|
168
|
+
});
|
|
169
|
+
});
|
|
170
|
+
|
|
171
|
+
describe('getLanguageFromStory', () => {
|
|
172
|
+
it('correctly returns language from a story', () => {
|
|
173
|
+
expect(getLanguageFromStory(ALL_LANGUAGES, STORY)).toEqual(LANGUAGES.en);
|
|
174
|
+
});
|
|
175
|
+
});
|
|
176
|
+
|
|
177
|
+
describe('getCompanyInformation', () => {
|
|
178
|
+
it('returns company information from target language', () => {
|
|
179
|
+
expect(getCompanyInformation(ALL_LANGUAGES, LocaleObject.fromAnyCode('nl-BE'))).toEqual(
|
|
180
|
+
LANGUAGES.nl_BE.company_information,
|
|
181
|
+
);
|
|
182
|
+
});
|
|
183
|
+
|
|
184
|
+
it('returns company information from default language if target not found', () => {
|
|
185
|
+
expect(getCompanyInformation(ALL_LANGUAGES, LocaleObject.fromAnyCode('de-DE'))).toEqual(
|
|
186
|
+
LANGUAGES.en.company_information,
|
|
187
|
+
);
|
|
188
|
+
});
|
|
189
|
+
});
|
|
190
|
+
|
|
191
|
+
describe('getShortestLocaleCode', () => {
|
|
192
|
+
it('returns false for default language', () => {
|
|
193
|
+
expect(getShortestLocaleCode(ALL_LANGUAGES, LocaleObject.fromAnyCode('en'))).toBe(false);
|
|
194
|
+
});
|
|
195
|
+
|
|
196
|
+
it('returns neutral language code if it is the only culture with that language', () => {
|
|
197
|
+
expect(getShortestLocaleCode(ALL_LANGUAGES, LocaleObject.fromAnyCode('es-ES'))).toBe('es');
|
|
198
|
+
});
|
|
199
|
+
|
|
200
|
+
it('returns region code if it is the only culture with that region', () => {
|
|
201
|
+
expect(getShortestLocaleCode(ALL_LANGUAGES, LocaleObject.fromAnyCode('en-US'))).toBe('US');
|
|
202
|
+
expect(getShortestLocaleCode(ALL_LANGUAGES, LocaleObject.fromAnyCode('en-GB'))).toBe('GB');
|
|
203
|
+
});
|
|
204
|
+
|
|
205
|
+
it('returns full code if it can not be shortened', () => {
|
|
206
|
+
expect(getShortestLocaleCode(ALL_LANGUAGES, LocaleObject.fromAnyCode('fr'))).toBe('fr');
|
|
207
|
+
expect(getShortestLocaleCode(ALL_LANGUAGES, LocaleObject.fromAnyCode('fr-BE'))).toBe(
|
|
208
|
+
'fr_BE',
|
|
209
|
+
);
|
|
210
|
+
expect(getShortestLocaleCode(ALL_LANGUAGES, LocaleObject.fromAnyCode('nl-BE'))).toBe(
|
|
211
|
+
'nl_BE',
|
|
212
|
+
);
|
|
213
|
+
expect(getShortestLocaleCode(ALL_LANGUAGES, LocaleObject.fromAnyCode('nl-NL'))).toBe(
|
|
214
|
+
'nl_NL',
|
|
215
|
+
);
|
|
216
|
+
});
|
|
217
|
+
});
|
package/src/intl/languages.ts
CHANGED
|
@@ -71,6 +71,7 @@ export function getLanguageByNeutralLocaleCode(
|
|
|
71
71
|
|
|
72
72
|
// Prefer default language
|
|
73
73
|
const defaultLanguage = getDefaultLanguage(languages);
|
|
74
|
+
// TODO: This doesn't align with other methods logic
|
|
74
75
|
if (defaultLanguage.code === locale.toUnderscoreCode()) {
|
|
75
76
|
return defaultLanguage;
|
|
76
77
|
}
|
|
@@ -79,8 +80,7 @@ export function getLanguageByNeutralLocaleCode(
|
|
|
79
80
|
const usedLanguages = getUsedLanguages(languages);
|
|
80
81
|
const usedLanguage = usedLanguages.find(
|
|
81
82
|
({ code }) =>
|
|
82
|
-
LocaleObject.fromAnyCode(code).toNeutralLanguageCode() === neutralLanguageCode
|
|
83
|
-
code === neutralLanguageCode,
|
|
83
|
+
LocaleObject.fromAnyCode(code).toNeutralLanguageCode() === neutralLanguageCode,
|
|
84
84
|
);
|
|
85
85
|
if (usedLanguage) {
|
|
86
86
|
return usedLanguage;
|
|
@@ -89,8 +89,7 @@ export function getLanguageByNeutralLocaleCode(
|
|
|
89
89
|
// Search in all languages
|
|
90
90
|
return languages.find(
|
|
91
91
|
({ code }) =>
|
|
92
|
-
LocaleObject.fromAnyCode(code).toNeutralLanguageCode() === neutralLanguageCode
|
|
93
|
-
code === neutralLanguageCode,
|
|
92
|
+
LocaleObject.fromAnyCode(code).toNeutralLanguageCode() === neutralLanguageCode,
|
|
94
93
|
);
|
|
95
94
|
}
|
|
96
95
|
|
|
@@ -144,9 +143,6 @@ export function getLanguageFromNextLocaleIsoCode(
|
|
|
144
143
|
getLanguageByExactLocaleCode(languages, locale) ||
|
|
145
144
|
getLanguageByNeutralLocaleCode(languages, locale) ||
|
|
146
145
|
getLanguageByShortRegionCode(languages, locale);
|
|
147
|
-
if (targetLanguage) {
|
|
148
|
-
return targetLanguage;
|
|
149
|
-
}
|
|
150
146
|
} else {
|
|
151
147
|
targetLanguage = getLanguageByExactLocaleCode(languages, locale);
|
|
152
148
|
}
|
|
@@ -175,6 +171,8 @@ export function getCompanyInformation(languages: NewsroomLanguageSettings[], loc
|
|
|
175
171
|
* First: try shorting to neutral language code (there should be no locales with the same language code)
|
|
176
172
|
* Then: try shorting to region code (there should be no locales with the same region code)
|
|
177
173
|
* Finally: return the original locale code (shorting is not possible)
|
|
174
|
+
*
|
|
175
|
+
* @param locale A LocaleObject constructed from FULL locale code (taken straight from the selected language)
|
|
178
176
|
*/
|
|
179
177
|
export function getShortestLocaleCode(
|
|
180
178
|
languages: NewsroomLanguageSettings[],
|
|
@@ -189,11 +187,6 @@ export function getShortestLocaleCode(
|
|
|
189
187
|
|
|
190
188
|
// Try shorting to neutral language code
|
|
191
189
|
const neutralLanguageCode = locale.toNeutralLanguageCode();
|
|
192
|
-
// The code is already as short as possible
|
|
193
|
-
if (neutralLanguageCode === localeCode) {
|
|
194
|
-
return localeCode;
|
|
195
|
-
}
|
|
196
|
-
|
|
197
190
|
const matchingLanguagesByNeutralCode = languages.filter(
|
|
198
191
|
({ code }) =>
|
|
199
192
|
LocaleObject.fromAnyCode(code).toNeutralLanguageCode() === neutralLanguageCode ||
|
|
@@ -209,10 +202,11 @@ export function getShortestLocaleCode(
|
|
|
209
202
|
({ code }) => LocaleObject.fromAnyCode(code).toRegionCode() === shortRegionCode,
|
|
210
203
|
);
|
|
211
204
|
// Prevent collision with neutral language codes
|
|
205
|
+
const lowerCasedShortRegionCode = shortRegionCode.toLowerCase();
|
|
212
206
|
const mathchingNeutralLanguagesByRegionCode = languages.filter(
|
|
213
207
|
({ code }) =>
|
|
214
|
-
LocaleObject.fromAnyCode(code).toNeutralLanguageCode() ===
|
|
215
|
-
code ===
|
|
208
|
+
LocaleObject.fromAnyCode(code).toNeutralLanguageCode() === lowerCasedShortRegionCode ||
|
|
209
|
+
code === lowerCasedShortRegionCode,
|
|
216
210
|
);
|
|
217
211
|
if (
|
|
218
212
|
matchingLanguagesByRegionCode.length === 1 &&
|