Split client and server translations, organize by filename

This commit is contained in:
Arnaud Peich
2022-10-13 11:23:55 +02:00
parent 396153b1eb
commit cc2a438fe5
10 changed files with 72 additions and 53 deletions

View File

@@ -154,7 +154,7 @@ function configuredPageTitleSuffix() {
*/
function getPageTitle(req: express.Request, config: GristLoadConfig): string {
const maybeDoc = getDocFromConfig(config);
if (!maybeDoc) { return req.t('Loading') + "..."; }
if (!maybeDoc) { return req.t('sendAppPage.Loading') + "..."; }
return handlebars.Utils.escapeExpression(maybeDoc.name);
}

View File

@@ -26,8 +26,8 @@ export function setupLocale(appRoot: string): i18n {
supportedNamespaces.add(namespace);
return lang;
}).filter((lang) => lang));
if (!supportedLngs.has('en') || !supportedNamespaces.has('core')) {
throw new Error("Missing core English language file");
if (!supportedLngs.has('en') || !supportedNamespaces.has('server')) {
throw new Error("Missing server English language file");
}
// Initialize localization filesystem plugin that will read the locale files from the localeDir.
instance.use(i18fsBackend);
@@ -40,7 +40,7 @@ export function setupLocale(appRoot: string): i18n {
initImmediate: false,
preload: [...supportedLngs],
supportedLngs: [...supportedLngs],
defaultNS: 'core',
defaultNS: 'server',
ns: [...supportedNamespaces],
fallbackLng: 'en',
backend: {
@@ -71,5 +71,5 @@ export function readLoadedNamespaces(instance?: i18n): readonly string[] {
if (Array.isArray(instance?.options.ns)) {
return instance.options.ns;
}
return instance?.options.ns ? [instance.options.ns as string] : ['core'];
return instance?.options.ns ? [instance.options.ns as string] : ['server'];
}