chore: Centralize env parsing, validation, defaults, and deprecation notices (#3487)
* chore: Centralize env parsing, defaults, deprecation * wip * test * test * tsc * docs, more validation * fix: Allow empty REDIS_URL (defaults to localhost) * test * fix: SLACK_MESSAGE_ACTIONS not bool * fix: Add SMTP port validation
This commit is contained in:
@@ -79,10 +79,8 @@ const underscoreToDash = (text: string) => text.replace("_", "-");
|
||||
|
||||
const dashToUnderscore = (text: string) => text.replace("-", "_");
|
||||
|
||||
export const initI18n = () => {
|
||||
const lng = underscoreToDash(
|
||||
"DEFAULT_LANGUAGE" in process.env ? process.env.DEFAULT_LANGUAGE! : "en_US"
|
||||
);
|
||||
export const initI18n = (defaultLanguage = "en_US") => {
|
||||
const lng = underscoreToDash(defaultLanguage);
|
||||
i18n
|
||||
.use(backend)
|
||||
.use(initReactI18next)
|
||||
@@ -104,7 +102,6 @@ export const initI18n = () => {
|
||||
fallbackLng: lng,
|
||||
supportedLngs: languages.map(underscoreToDash),
|
||||
// Uncomment when debugging translation framework, otherwise it's noisy
|
||||
// debug: process.env.NODE_ENV === "development",
|
||||
keySeparator: false,
|
||||
});
|
||||
return i18n;
|
||||
|
||||
Reference in New Issue
Block a user