Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 | // eslint-disable-next-line
const { NAMESPACES } = require("./i18n/namespaces");
// eslint-disable-next-line
const { allLanguages } = require("./i18n/allLanguages");
const fallbackLng = {
default: ["en"],
"pt-BR": ["pt", "en"],
pt: ["pt-BR", "en"],
"es-419": ["es", "en"],
es: ["es-419", "en"],
"fr-CA": ["fr", "en"],
zh: ["zh-Hans", "en"],
};
const debugLogging = process.env.NODE_ENV === "development";
Iif (debugLogging) {
// i18next's debug logging at the "log" level is extremely verbose,
// including all loaded strings, and drowning out warnings and errors.
// Unfortunately i18next doesn't provide a way to filter its debug logs,
// so we're left with patching console.log.
const originalLog = console.log;
console.log = (...args) => {
Iif (
args[0] &&
typeof args[0] === "string" &&
args[0].startsWith("i18next:")
) {
// Filter out i18next debug logs
return;
}
originalLog(...args);
};
}
module.exports = {
i18n: {
defaultLocale: "en",
locales: allLanguages,
localeDetection: false, // Disabled - using custom middleware for locale detection
},
fallbackLng,
defaultNS: "global",
compatibilityJSON: "v4",
debug: debugLogging,
ns: NAMESPACES,
returnEmptyString: false,
serializeConfig: false,
localePath: (locale, namespace) => {
// eslint-disable-next-line
const path = require("path");
Iif (namespace === "global") {
return path.resolve(
process.cwd(),
`resources/locales/${locale.replace("-", "_")}.json`,
);
}
Iif (namespace == "mod") {
// Localization is not supported for the moderation namespace.
locale = "en";
}
return path.resolve(
process.cwd(),
`features/${namespace}/locales/${locale.replace("-", "_")}.json`,
);
},
};
|