2022-09-16 04:21:05 +00:00
|
|
|
// Code generated by go generate. DO NOT EDIT.
|
|
|
|
//
|
|
|
|
// Run the following command to generate this file:
|
|
|
|
// go run ./cmd/authelia-gen locales
|
|
|
|
//
|
|
|
|
|
|
|
|
import i18n from "i18next";
|
|
|
|
import LanguageDetector from "i18next-browser-languagedetector";
|
|
|
|
import Backend from "i18next-http-backend";
|
|
|
|
import { initReactI18next } from "react-i18next";
|
|
|
|
|
2022-10-01 20:44:18 +00:00
|
|
|
import LocalStorageCustomDetector from "@i18n/detectors/localStorageCustom";
|
2022-09-16 04:21:05 +00:00
|
|
|
import { getBasePath } from "@utils/BasePath";
|
|
|
|
|
|
|
|
const basePath = getBasePath();
|
|
|
|
|
2022-10-01 20:44:18 +00:00
|
|
|
const CustomLanguageDetector = new LanguageDetector();
|
|
|
|
|
|
|
|
CustomLanguageDetector.addDetector(LocalStorageCustomDetector);
|
|
|
|
|
2022-09-16 04:21:05 +00:00
|
|
|
i18n.use(Backend)
|
2022-10-01 20:44:18 +00:00
|
|
|
.use(CustomLanguageDetector)
|
2022-09-16 04:21:05 +00:00
|
|
|
.use(initReactI18next)
|
|
|
|
.init({
|
|
|
|
detection: {
|
2022-10-01 20:44:18 +00:00
|
|
|
order: ["querystring", "localStorageCustom", "navigator"],
|
2022-09-16 04:21:05 +00:00
|
|
|
lookupQuerystring: "lng",
|
2022-10-01 20:44:18 +00:00
|
|
|
lookupLocalStorage: "lng",
|
2022-09-16 04:21:05 +00:00
|
|
|
},
|
|
|
|
backend: {
|
|
|
|
loadPath: basePath + "/locales/{{"{{lng}}"}}/{{"{{ns}}"}}.json",
|
|
|
|
},
|
|
|
|
load: "all",
|
|
|
|
ns: [{{ range $i, $value := .Namespaces }}{{ if eq $i 0 }}"{{ $value }}"{{ else }}, "{{ $value }}"{{ end }}{{ end }}],
|
|
|
|
defaultNS: "{{ .Defaults.Namespace }}",
|
|
|
|
fallbackLng: {
|
|
|
|
default: ["{{ .Defaults.Language.Locale }}"],
|
|
|
|
{{- range .Languages }}
|
|
|
|
{{- if and (not (eq .Locale "en")) (not (eq (len .Fallbacks) 0)) }}
|
|
|
|
{{ if stringsContains .Locale "-" }}"{{ .Locale }}"{{ else }}{{ .Locale }}{{ end }}: [{{ range $i, $value := .Fallbacks }}{{ if eq $i 0 }}"{{ $value }}"{{ else }}, "{{ $value }}"{{ end }}{{ end }}],
|
|
|
|
{{- end }}
|
|
|
|
{{- end }}
|
|
|
|
},
|
2022-09-16 05:01:22 +00:00
|
|
|
supportedLngs: [
|
|
|
|
{{- range $i, $value := .Languages }}
|
|
|
|
"{{ $value.Locale }}",
|
|
|
|
{{- end }}
|
|
|
|
],
|
2022-09-16 04:21:05 +00:00
|
|
|
lowerCaseLng: false,
|
|
|
|
nonExplicitSupportedLngs: true,
|
|
|
|
interpolation: {
|
|
|
|
escapeValue: false,
|
|
|
|
},
|
|
|
|
debug: false,
|
|
|
|
});
|
|
|
|
|
|
|
|
export default i18n;
|