From fbf4b29e0b6ae944a672c025b16c79398cb53e34 Mon Sep 17 00:00:00 2001 From: Sami Mazouz Date: Wed, 23 Oct 2024 18:06:29 +0100 Subject: [PATCH] chore --- framework/core/js/src/common/Translator.tsx | 12 ++++-------- js-packages/jest-config/src/boostrap/common.js | 4 ++-- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/framework/core/js/src/common/Translator.tsx b/framework/core/js/src/common/Translator.tsx index 442993a2bb..a0c97967c0 100644 --- a/framework/core/js/src/common/Translator.tsx +++ b/framework/core/js/src/common/Translator.tsx @@ -3,7 +3,7 @@ import type { Dayjs } from 'dayjs'; import User from './models/User'; import extract from './utils/extract'; import formatMessage, { Translation } from 'format-message'; -import fireDebugWarning, { fireDeprecationWarning } from './helpers/fireDebugWarning'; +import fireDebugWarning from './helpers/fireDebugWarning'; import extractText from './utils/extractText'; import ItemList from './utils/ItemList'; @@ -55,18 +55,12 @@ export default class Translator { translations: { [locale]: Object.assign(this.translations, translations), }, - missingReplacement: (key: string) => { - fireDebugWarning(`Missing translation for key: ${key}`); - - return key; - }, }); } /** * A temporary system to preprocess parameters. * Should not be used by extensions. - * TODO: An extender will be added in v1.x. * * @internal */ @@ -92,7 +86,7 @@ export default class Translator { for (const tag of tags) { if (!parameters[tag]) { - fireDeprecationWarning( + fireDebugWarning( `Any HTML tags used within translations must have corresponding mithril component parameters.\nCaught in translation: \n\n"""\n${translation}\n"""`, '', 'v2.0', @@ -138,6 +132,8 @@ export default class Translator { if (extract) return extractText(locale); return locale; + } else { + fireDebugWarning(`Missing translation for key: "${id}"`); } return id; diff --git a/js-packages/jest-config/src/boostrap/common.js b/js-packages/jest-config/src/boostrap/common.js index 42c0abfc9e..25080062e8 100644 --- a/js-packages/jest-config/src/boostrap/common.js +++ b/js-packages/jest-config/src/boostrap/common.js @@ -9,7 +9,7 @@ export default function bootstrap(Application, app, payload = {}) { app.load({ apiDocument: null, - locale: null, + locale: 'en', locales: {}, resources: [ { @@ -36,7 +36,7 @@ export default function bootstrap(Application, app, payload = {}) { ...payload, }); - app.translator.addTranslations(flatten(jsYaml.load(fs.readFileSync('../locale/core.yml', 'utf8')))); app.translator.setLocale('en'); + app.translator.addTranslations(flatten(jsYaml.load(fs.readFileSync('../locale/core.yml', 'utf8')))); app.drawer = new Drawer(); }