How to handle missing translations
This content is for v15. Switch to the latest version for up-to-date documentation.
You can set up a provider for the MissingTranslationHandler
in the
bootstrap of your application (recommended), or in the providers
property of a component. It will be called when the requested translation is not available. The only required method is handle
where you can do whatever you want. If this method returns a value or an observable (that should return a string), then this will be used. Just don’t forget that it will be called synchronously from the instant
method.
You can use useDefaultLang
to decide whether default language string
should be used when there is a missing translation in current language. Default value is true
.
If you set it to false
, MissingTranslationHandler
will be used instead of the default language string.
Example:
Create a Missing Translation Handler
Set up the Missing Translation Handler in your module import by adding it to the forRoot
(or forChild
) configuration.