Skip to content

Commit

Permalink
chore
Browse files Browse the repository at this point in the history
  • Loading branch information
SychO9 committed Oct 23, 2024
1 parent 2595901 commit fbf4b29
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
12 changes: 4 additions & 8 deletions framework/core/js/src/common/Translator.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down Expand Up @@ -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
*/
Expand All @@ -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',
Expand Down Expand Up @@ -138,6 +132,8 @@ export default class Translator {
if (extract) return extractText(locale);

return locale;
} else {
fireDebugWarning(`Missing translation for key: "${id}"`);
}

return id;
Expand Down
4 changes: 2 additions & 2 deletions js-packages/jest-config/src/boostrap/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export default function bootstrap(Application, app, payload = {}) {

app.load({
apiDocument: null,
locale: null,
locale: 'en',
locales: {},
resources: [
{
Expand All @@ -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();
}

0 comments on commit fbf4b29

Please sign in to comment.