Interpolate strings without a translated value
See original GitHub issueI’m submitting a … (check one with “x”)
[ ] bug report => check the FAQ and search github for a similar issue or PR before submitting
[ ] support request => check the FAQ and search github for a similar issue before submitting
[x] feature request
Current behavior I’m trying to mimic Gettext behavior:
- Base language in source is plain english
- If a translation exists, use it, if not, don’t do anything (in my case, leave the english strings)
This is the default behavior in ng2-translate, so far so good.
Where I’m running into trouble is when I have a string without a translation, that needs interpolation. The string isn’t interpolated which makes sense if you use made-up keys like LOGGED_IN_USER
etc, since you wouldn’t need that to be interpolated, but in my case I do.
Do you think that is something this lib could support?
EDIT: Example
<h1>{{ 'This is a string with value "{value}" interpolated' | translate: { value: 'TEST' } }}</h1>
If no translation is available for this message, it will output:
This is a string with value "{value}" interpolated
Instead of what I want:
This is a string with value "TEST" interpolated
(I’m using the new custom TranslateParser
to allow me to interpolate {value}
in my strings)
Issue Analytics
- State:
- Created 7 years ago
- Comments:8 (3 by maintainers)
Top Results From Across the Web
Interpolation - i18next documentation
Interpolation is one of the most used functionalities in I18N. It allows integrating dynamic values into your translations.
Read more >How to translate angular interpolation string from container ...
I'm searching the best way to translate my futur angular project so no, my project dosen't use i18n already. But I never see...
Read more >How to use i18n string interpolation - zargony.com
Here, the translation uses string interpolation to put variable values into a meaningful sentence. The translation string itself is a ...
Read more >Displaying values with interpolation - Angular
Interpolation refers to embedding expressions into marked up text. By default, interpolation uses the double curly braces {{ and }} as delimiters. To...
Read more >ngx-translate Documentation - CodeAndWeb
Using a compiler opens the door for powerful pre-processing of translation values. As long as the compiler outputs a compatible interpolation string or...
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 FreeTop 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
Top GitHub Comments
@Halfist we’re on version 11.0.1 and still somewhat literally use the code above (only a different file name for the handler) However we do not translate using the “GREETING” syntax we translate like so
HTML
HTML plurals
Typescript
If you use the greetings syntax you probably need to fix some code in the InterpolatedMissingTranslationHandler
@Halfist it was on v9. I will check it for you tomorrow between 9 and 11 CEST and let you know