Skip to content

Commit

Permalink
Fix paths to FTL files from cron job l10n loading
Browse files Browse the repository at this point in the history
I moved the l10n loading from /src/emails/getEmailL10n.node.ts to
/src/app/functions/l10n/cronjobs.ts in
c681102, and in doing so, missed
that I also had to update the paths to the FTL files. These are
loaded at runtime, so I didn't get a build error for that either.
  • Loading branch information
Vinnl committed May 3, 2024
1 parent d7a3c66 commit 33ab3e0
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/app/functions/l10n/cronjobs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,22 +30,28 @@ export type LocaleData = {
};

const __dirname = dirname(fileURLToPath(import.meta.url));
const ftlRoot = resolve(__dirname, `../../locales/`);
const ftlRoot = resolve(__dirname, `../../../../locales/`);
export const getL10nBundles: GetL10nBundles = createGetL10nBundles({
availableLocales: readdirSync(ftlRoot),
// TODO: Make this optional in `createGetL10nBundles`, which would then make
// it required in the newly-created function:
getAcceptLangHeader: () => "en",
loadLocaleFiles: (locale) => {
const referenceStringsPath = resolve(__dirname, `../../locales/${locale}/`);
const referenceStringsPath = resolve(
__dirname,
`../../../../locales/${locale}/`,
);
const ftlPaths = readdirSync(referenceStringsPath).map((filename) =>
resolve(referenceStringsPath, filename),
);

return ftlPaths.map((filePath) => readFileSync(filePath, "utf-8"));
},
loadPendingStrings: () => {
const pendingStringsPath = resolve(__dirname, "../../locales-pending/");
const pendingStringsPath = resolve(
__dirname,
"../../../../locales-pending/",
);
const ftlPaths = readdirSync(pendingStringsPath).map((filename) =>
resolve(pendingStringsPath, filename),
);
Expand Down

0 comments on commit 33ab3e0

Please sign in to comment.