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
it('throws when trying to load undeclared locale that is not a valid locale BCP47 name',async()=>{
408
+
awaitexpect(()=>
409
+
loadI18nTest({
410
+
i18nConfig: {
411
+
path: 'i18n',
412
+
defaultLocale: 'en',
413
+
locales: ['en','fr','de'],
414
+
localeConfigs: {},
415
+
},
416
+
currentLocale: 'x1',
417
+
}),
418
+
).rejects.toThrowErrorMatchingInlineSnapshot(`
419
+
"Docusaurus couldn't infer a default locale config for x1.
420
+
Make sure it is a valid BCP 47 locale name (e.g. en, fr, fr-FR, etc.) and/or provide a valid BCP 47 \`siteConfig.i18n.localeConfig['x1'].htmlLang\` attribute."
421
+
`);
422
+
});
423
+
424
+
it('throws when trying to load declared locale that is not a valid locale BCP47 name',async()=>{
425
+
awaitexpect(()=>
426
+
loadI18nTest({
427
+
i18nConfig: {
428
+
path: 'i18n',
429
+
defaultLocale: 'fr',
430
+
locales: ['en','fr','de'],
431
+
localeConfigs: {x1: {}},
432
+
},
433
+
currentLocale: 'x1',
434
+
}),
435
+
).rejects.toThrowErrorMatchingInlineSnapshot(`
436
+
"Docusaurus couldn't infer a default locale config for x1.
437
+
Make sure it is a valid BCP 47 locale name (e.g. en, fr, fr-FR, etc.) and/or provide a valid BCP 47 \`siteConfig.i18n.localeConfig['x1'].htmlLang\` attribute."
438
+
`);
439
+
});
440
+
441
+
it('loads i18n when trying to load declared locale with invalid BCP47 name but valid BCP47',async()=>{
0 commit comments