question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Change private to protected methods in TranslocoDirectiveBase

See original GitHub issue

My 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:closed
  • Created 2 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
angelakicommented, Aug 26, 2021

Super, thank you! 👍 Let’s hope for it getting merged.

0reactions
angelakicommented, Sep 3, 2021

Any reason / idea why this isn’t merget, yet? Guess it’s not that risky 😉

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found