fix(web): lowercase locales are not consistent with localization platforms (#3141)

This fixes an issue with localization platforms and the docs regarding localization, and the forcing locale names to lowercase.
pull/3118/head^2
James Elliott 2022-04-08 14:53:46 +10:00 committed by GitHub
parent 2da50f6128
commit 4503ac07be
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 5 deletions

View File

@ -263,8 +263,8 @@ Authelia will automatically resize the logo to an appropriate size to present in
The locales folder holds folders of internationalization locales. This folder can be utilized to override these locales. The locales folder holds folders of internationalization locales. This folder can be utilized to override these locales.
They are the names of locales that are returned by the `navigator.langauge` ECMAScript command. These are generally They are the names of locales that are returned by the `navigator.langauge` ECMAScript command. These are generally
those in the [RFC5646 / BCP47 Format](https://datatracker.ietf.org/doc/html/rfc5646) except the name normalized to those in the [RFC5646 / BCP47 Format](https://datatracker.ietf.org/doc/html/rfc5646) specifically the language codes
lowercase for consistency ease; for example the `en-US` locale should be in the directory `en-us`. from [Crowdin](https://support.crowdin.com/api/language-codes/).
Each directory has json files which you can explore the format of in the Each directory has json files which you can explore the format of in the
[internal/server/locales](https://github.com/authelia/authelia/tree/master/internal/server/locales) directory on [internal/server/locales](https://github.com/authelia/authelia/tree/master/internal/server/locales) directory on
@ -275,7 +275,7 @@ of current namespaces are below:
|:---------:|:-------------------:| |:---------:|:-------------------:|
| portal | Portal translations | | portal | Portal translations |
A full example for the `en-US` locale for the portal namespace is `locales/en-us/portal.json`. A full example for the `en-US` locale for the portal namespace is `locales/en-US/portal.json`.
Languages in browsers are supported in two forms. In their language only form such as `en` for English, and in their Languages in browsers are supported in two forms. In their language only form such as `en` for English, and in their
variant form such as `en-AU` for English (Australian). If a user has the browser language `en-AU` we automatically load variant form such as `en-AU` for English (Australian). If a user has the browser language `en-AU` we automatically load

View File

@ -121,7 +121,7 @@ func getHandler(config schema.Configuration, providers middlewares.Providers) fa
r.GET("/static/{filepath:*}", handlerPublicHTML) r.GET("/static/{filepath:*}", handlerPublicHTML)
// Locales. // Locales.
r.GET("/locales/{language:[a-z]{1,3}}-{variant:[a-z0-9-]+}/{namespace:[a-z]+}.json", middlewares.AssetOverrideMiddleware(config.Server.AssetPath, 0, handlerLocales)) r.GET("/locales/{language:[a-z]{1,3}}-{variant:[a-zA-Z0-9-]+}/{namespace:[a-z]+}.json", middlewares.AssetOverrideMiddleware(config.Server.AssetPath, 0, handlerLocales))
r.GET("/locales/{language:[a-z]{1,3}}/{namespace:[a-z]+}.json", middlewares.AssetOverrideMiddleware(config.Server.AssetPath, 0, handlerLocales)) r.GET("/locales/{language:[a-z]{1,3}}/{namespace:[a-z]+}.json", middlewares.AssetOverrideMiddleware(config.Server.AssetPath, 0, handlerLocales))
// Swagger. // Swagger.

View File

@ -21,7 +21,7 @@ i18n.use(Backend)
}, },
load: "all", load: "all",
supportedLngs: ["en", "es", "de"], supportedLngs: ["en", "es", "de"],
lowerCaseLng: true, lowerCaseLng: false,
nonExplicitSupportedLngs: true, nonExplicitSupportedLngs: true,
interpolation: { interpolation: {
escapeValue: false, escapeValue: false,