Base language strings as translation keys
See original GitHub issueI’m submitting a … (check one with “x”)
[x] bug report => check the FAQ and search github for a similar issue or PR before submitting
[x] support request => check the FAQ and search github for a similar issue before submitting
[x] feature request
I’m not really sure which category this issue belongs to.
I would like to use base language strings as message IDs in my templates as opposed to made up IDs:
{{ 'Log in' | translate }}
vs. {{ 'HOME_LOGIN_BUTTON' | translate }}
It does not seem like it’s supported to use real strings with params though. Angular complains about template parse error (And rightly so) when doing this:
{{ 'Hello {{ name }}' | translate: { name: 'Kim' } }}
Would it maybe make sense to change {{PARAM}}
to {PARAM}
or something completely else, to not trip up the angular template parser?
Issue Analytics
- State:
- Created 7 years ago
- Reactions:2
- Comments:14 (7 by maintainers)
Top Results From Across the Web
Keys (Strings) - Phrase
Keys are used to identify translatable strings within software code. This allows the key to be referenced once instead of each time the...
Read more >Everything You Need to Know About Translation Keys - OneSky
A translation key indicates where a string appears on the user interface (UI) and has a corresponding value for each target language.
Read more >Translation Strings | Directus Docs
Translation Strings are multilingual key-value pairs that you can use throughout the app. They enable you to translate things like dropdown ...
Read more >Translation keys: naming conventions and organizing - Lokalise
This article presents some gudelines and general suggestions to properly naming and organizing your translation keys.
Read more >Translation Keys - BigCommerce Dev Center
Translation keys exist in JSON files and are invoked based on the user's browser language. With a Stencil theme, you can define multiple...
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
If you want, you can close this. It’s possible to use real strings as base language (with working interpolation) using custom TranslateParser and MissingTranslationHandler, although it’s not trivial to do for beginners.
app/app.module.ts
i18n/index.ts
A little context:
I usually work with po-files (Gettext), where msgid is the full untranslated string in the base language.
We use a translation service and the translators have never seen our app and wouldn’t know what any of my made up keys means, making it impossible to do a proper translation.
Reasons (some subjective?) for using ‘real strings’ as translation keys in a project: