Change private to protected methods in TranslocoDirectiveBase
See original GitHub issueMy application is using objects implementing an interface Translateable
, having a translate key or, if not present, a fallback-value. My idea was to use my own directive extending TranslocoDirectiveBase
and pick the translate key or directly return the value if no key is present.
For this I’d need to override private getTranslateFn(lang: string, read: string | undefined): (key: string, params?: HashMap)
Or is there already a better approach for this? Right now everywhere I’m using this markup:
{{ m.displayTextTranslation ? t(m.displayTextTranslation) : m.displayText }}
and I’d like to be able to say {{ t(m) }}
where m is my Translateable
.
Issue Analytics
- State:
- Created 2 years ago
- Comments:7 (3 by maintainers)
Top Results From Across the Web
Changing private methods to protected for testing
You can call private method using reflection, or you can decide that private methods shouldn't be tested directly, only indirectly.
Read more >Ruby Private & Protected Methods - RubyGuides
Ruby has 3 types of method visibility. The default is public, but you can manually set private & protected. You'll learn the differences...
Read more >Common notes about public, private and protected methods in ...
Protected and private methods can be called from anywhere by using the send method. This method ignores the access level.
Read more >Private and protected properties and methods
Private and protected properties and methods ... Let's change waterAmount property to protected to have more control over it.
Read more >How to use reflection to test private and protected methods
How to use reflection to test private and protected methods ... Changing the visibility for the sake of unit tests is not a...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Super, thank you! 👍 Let’s hope for it getting merged.
Any reason / idea why this isn’t merget, yet? Guess it’s not that risky 😉