Is it possible to disable the translation warnings if we don't use i18n?
Not possible currently. Polyglot does support allowing undefined translations (see its options) however. This would requires an additional prop to disable custom translations.
This babel plugin might be useful: babel-plugin-transform-dev-warning
Which translation warnings are you seeing? It must be on your custom components, because aor components don't throw translation warnings in case of missing translation for a field label. It uses the (non-documented- default translation everywhere:
translate(label, { _: label }
As for the interface labels ("Save", "Filter", etc), they must always be in your translation dictionary. If they are not, that's a bug, and the warning should not be silenced.
Temporary you can override console.error.
var originalLog = console.error
console.error = function log(...args) {
if (args.length > 0 && typeof args[0] === "string" && /^Warning: Missing translation/.test(args[0])) {
return
}
originalLog.apply(console, args)
}
Solved it by adding a custom i18nProvider that allows missing keys:
const i18nProvider = polyglotI18nProvider(locale => i18nMessages[locale], 'en', { allowMissing: true });
<Admin
i18nProvider={i18nProvider}
...
>
More details: https://marmelab.com/react-admin/Translation.html
and: https://www.npmjs.com/package/node-polyglot#options-overview
Most helpful comment
Solved it by adding a custom i18nProvider that allows missing keys:
More details: https://marmelab.com/react-admin/Translation.html
and: https://www.npmjs.com/package/node-polyglot#options-overview