MissingTranslationHandler doesn't fire when a translation is absent from selected language
See original GitHub issueI’m submitting a … (check one with “x”)
[X] bug report => check the FAQ and search github for a similar issue or PR before submitting
[ ] support request => check the FAQ and search github for a similar issue before submitting
[X] feature request
Current behavior When I have a translation for a tag in one language but not in another, the implementation falls back into the default language.
Expected/desired behavior In my implementation of the interface I make it very obvious to the user that a translation is missing, so that QA can pick it up and we fix it. I would like to have an option for it not to fallback to the default language but to let my handler handle it.
Reproduction of the problem If the current behavior is a bug or you can illustrate your feature request better with an example, please provide the steps to reproduce and if possible a minimal demo of the problem via https://plnkr.co or similar (you can use this template as a starting point: http://plnkr.co/edit/tpl:btpW3l0jr5beJVjohy1Q). http://plnkr.co/edit/DkTJVklO7O6pfLY9IZCB?p=preview
What is the expected behavior? Let me show something other than the default language translation
What is the motivation / use case for changing the behavior? –need to help testers find missing translations
Please tell us about your environment:
-
ng2-translate version: 4.2.0
-
Angular version: 2.2.3
-
Browser: [Chrome 55]
-
Language: [TypeScript 2.0]
Issue Analytics
- State:
- Created 7 years ago
- Reactions:3
- Comments:9 (1 by maintainers)
Top GitHub Comments
Since
MissingTranslationHelper
falls back to the default language translation if there isn’t one in the desired language, and also takes empty strings as valid translations (so it results in blank spaces in app), I overload theTranslatePipe
like this (same could be done forTranslateProvider
) :This way, if the translation is left empty in the selected language or if it doesn’t exist (no matching key), we get a “Missing text (KEY)” message that helps our teammates in charge of translating our app.
Also hitting this issue.
I have set:
My expectation is that when a French String is not found the MissingTranslationHandler would be invoked. This isn’t occurring. The MissingTranslationHandler is only invoked when there is no translation in French or English.