-
-
Notifications
You must be signed in to change notification settings - Fork 584
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow to override getValue method #1510
Comments
Currently there's no way to override it. I've removed it from the parser because the idea of the parser is about parsing/interpolating the translation message. The getValue() method was misplaced in this class - and even worse was used for 2 purposes:
Which of the functionality do you want to override? |
The goal is to be able to override a key. |
That is indeed not accessible at the moment. The probably best way to do that currently would be in the loader by merging both objects into a single one, where the overrides "win". I might also come up with a new class that will be responsible for storing and accessing the translations instead of keeping that code spread in the service itself. |
The problem is that we want to have the overrides or not, without having to reload the locales.
Having a service for this would be amazing. In the meantime, I will stay with the previous version and continue to think about an alternative. |
Current behavior
Cannot override
getValue()
methodExpected behavior
Define my own
getValue()
methodWhat is the motivation / use case for changing the behavior?
In the previous version 15.0.0, I could override the getValue method in TranslateDefaultParser, to have my own local override implementation. But in the version 16.0.0, the
getValue()
cannot be overriden anymorehttps://ngx-translate.org/getting-started/migration-guide/#24-translateparser-getvalue
How do you think that we should implement this?
Is there a way to inject my own
getValue
method in the app ?Thank you for that nice library.
The text was updated successfully, but these errors were encountered: