authelia/cmd/authelia-gen/templates/web_i18n_index.ts.tmpl

52 lines
1.7 KiB
Cheetah
Raw Normal View History

// 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";
import { getBasePath } from "@utils/BasePath";
const basePath = getBasePath();
i18n.use(Backend)
.use(LanguageDetector)
.use(initReactI18next)
.init({
detection: {
order: ["querystring", "navigator"],
lookupQuerystring: "lng",
},
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 }}
],
lowerCaseLng: false,
nonExplicitSupportedLngs: true,
interpolation: {
escapeValue: false,
},
debug: false,
});
export default i18n;