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.

How to check if a translation mapping exists

See original GitHub issue

Hi there,

I couldn’t see if there was a way to see if a translation mapping exists?

What I mean is, I have an angular page where I am looking up translations dynamically in a loop. Mappings for some of them may not exist for whatever reason, and I’d like to make that check before attempting to render the translation and associated markup.

I mainly want to do these checks from a view, where I would be using the translate filter or directive.

But I also couldn’t see a way to do this from a controller using the $translate service either - although I’m sure it’s probably possible using the $translate service directly.

Any ideas?

Issue Analytics

  • State:closed
  • Created 10 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
skawaguchicommented, Nov 17, 2015
1reaction
mjrkcommented, May 7, 2015

+1 Note: Both links are “Page not Found”

It would be really great to have a helper method to explicitly check in advance if a translation exists. Also, if I could define a fallback-key that is used for non existent mappings.

Read more comments on GitHub >

github_iconTop Results From Across the Web

ngx-translate - Checking if translate key exist with Angular
Since I found no way to safely check for the presence of a translation, the best thing I could do is to check...
Read more >
Determining if a Translation Exists
Use the Lang::has() method. To check if a translation exists for the current locale pass a single argument to the method. The argument...
Read more >
Determining translations (video) - Khan Academy
- [Voiceover] We're asked to use the translation tool to determine the translation that will map triangle WIN, so this right over here,...
Read more >
How to identify there is no translation value in Value Mapping
Hi , I am using value mapping to translate one of the fields of data. Whenever the input has a translation value, the...
Read more >
key bindings - How to debug a mapping?
You can see in the first column the mode of the mapping ( n for normal mode, v for visual mode, etc), the...
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