mirror of
https://github.com/gristlabs/grist-core.git
synced 2024-10-27 20:44:07 +00:00
Removing toast errors on missing keys
This commit is contained in:
parent
671e479bad
commit
6864649b92
@ -95,11 +95,6 @@ type InferResult<T> = T extends Record<string, string | number | boolean>|undefi
|
|||||||
* Resolves the translation of the given key and substitutes. Supports dom elements interpolation.
|
* Resolves the translation of the given key and substitutes. Supports dom elements interpolation.
|
||||||
*/
|
*/
|
||||||
export function t<T extends Record<string, any>>(key: string, args?: T|null, instance = i18next): InferResult<T> {
|
export function t<T extends Record<string, any>>(key: string, args?: T|null, instance = i18next): InferResult<T> {
|
||||||
if (!instance.exists(key, args || undefined)) {
|
|
||||||
const error = new Error(`Missing translation for key: ${key} and language: ${i18next.language}`);
|
|
||||||
reportError(error);
|
|
||||||
}
|
|
||||||
// Don't need to bind `t` function.
|
|
||||||
return domT(key, args, instance.t);
|
return domT(key, args, instance.t);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -177,12 +172,6 @@ export function makeT(scope: string, instance?: typeof i18next) {
|
|||||||
// This will remove all the overloads from the function, but we don't need them.
|
// This will remove all the overloads from the function, but we don't need them.
|
||||||
scopedResolver = (_key: string, _args?: any) => fixedResolver(_key, {defaultValue: _key, ..._args});
|
scopedResolver = (_key: string, _args?: any) => fixedResolver(_key, {defaultValue: _key, ..._args});
|
||||||
}
|
}
|
||||||
// If the key has interpolation or we did pass some arguments, make sure that
|
|
||||||
// the key exists.
|
|
||||||
if ((args || key.includes("{{")) && !scopedInstance.exists(`${scope}.${key}`, args || undefined)) {
|
|
||||||
const error = new Error(`Missing translation for key: ${key} and language: ${i18next.language}`);
|
|
||||||
reportError(error);
|
|
||||||
}
|
|
||||||
return domT(key, args, scopedResolver!);
|
return domT(key, args, scopedResolver!);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -141,7 +141,7 @@ export class AccountPage extends Disposable {
|
|||||||
enableCustomCss ? null : [
|
enableCustomCss ? null : [
|
||||||
css.header(t("Theme")),
|
css.header(t("Theme")),
|
||||||
dom.create(ThemeConfig, this._appModel),
|
dom.create(ThemeConfig, this._appModel),
|
||||||
css.subHeader(t("Language ")),
|
css.subHeader(t("Language")),
|
||||||
css.dataRow({ style: 'width: 300px'},
|
css.dataRow({ style: 'width: 300px'},
|
||||||
select(userLocale, languageOptions, {
|
select(userLocale, languageOptions, {
|
||||||
renderOptionArgs: () => {
|
renderOptionArgs: () => {
|
||||||
|
Loading…
Reference in New Issue
Block a user