You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/ref/conf.rst
+41-9Lines changed: 41 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -20,7 +20,7 @@ Default config:
20
20
}],
21
21
"compileNamespace": "cjs",
22
22
"extractBabelOptions": {},
23
-
"fallbackLocale": "",
23
+
"fallbackLocales": {},
24
24
"format": "po",
25
25
"locales": [],
26
26
"orderBy": "messageId",
@@ -230,17 +230,49 @@ extracted. This is required when project doesn't use standard Babel config
230
230
}
231
231
}
232
232
233
-
.. config:: fallbackLocale
233
+
.. config:: fallbackLocales
234
234
235
-
fallbackLocale
235
+
fallbackLocales
236
236
--------------
237
237
238
-
Default: ``''``
238
+
Default: ``{}``
239
+
240
+
:conf:`fallbackLocales` by default is using `CLDR Parent Locales <https://github.com/unicode-cldr/cldr-core/blob/master/supplemental/parentLocales.json>`_, unless you disable it with a `false`:
241
+
242
+
.. code-block:: json
243
+
244
+
{
245
+
"fallbackLocales": false
246
+
}
247
+
248
+
:conf:`fallbackLocales` object let's us configure fallback locales to each locale instance.
249
+
250
+
.. code-block:: json
251
+
252
+
{
253
+
"fallbackLocales": {
254
+
"en-US": ["en-GB", "en"],
255
+
"es-MX": "es"
256
+
}
257
+
}
258
+
259
+
On this example if any translation isn't found on `en-US` then will search on `en-GB`, after that if not found we'll search in `en`
260
+
261
+
Also, we can configure a default one for everything:
262
+
263
+
.. code-block:: json
264
+
265
+
{
266
+
"fallbackLocales": {
267
+
"en-US": ["en-GB", "en"],
268
+
"es-MX": "es",
269
+
"default": "en"
270
+
}
271
+
}
239
272
240
-
Translation from :conf:`fallbackLocale` is used when translation for given locale is missing.
273
+
Translations from :conf:`fallbackLocales` is used when translation for given locale is missing.
241
274
242
-
If :conf:`fallbackLocale` isn't defined or translation in :conf:`fallbackLocale` is
243
-
missing too, either default message or message ID is used instead.
275
+
If :conf:`fallbackLocales` is `false` default message or message ID is used instead.
244
276
245
277
.. config:: format
246
278
@@ -393,6 +425,6 @@ Catalog for :conf:`sourceLocale` doesn't require translated messages, because me
393
425
IDs are used by default. However, it's still possible to override message ID by
394
426
providing custom translation.
395
427
396
-
The difference between :conf:`fallbackLocale` and :conf:`sourceLocale` is that
397
-
:conf:`fallbackLocale` is used in translation, while :conf:`sourceLocale` is
428
+
The difference between :conf:`fallbackLocales` and :conf:`sourceLocale` is that
429
+
:conf:`fallbackLocales` is used in translation, while :conf:`sourceLocale` is
0 commit comments