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.

[i18n] $localize extract translation unit & documentation

See original GitHub issue

πŸš€ feature request

Relevant Package

This feature request is for @angular/localize

Description

Currently, the $localize API is not documented, and translation text & id is not extracted towards translation file, basically the translation units for a text translated with $localize in code have to be put in a translation unit in the file manually.

If you have many items to translate with $localize it will add load to the team, it multiplies the load by the number of locales you need to support, since each time you merge the source locale into any other locale file, with the VSCode Angular i18n plugin (and very likely with many other xlf merge utilities), those translation units you added manually will be removed and you’re forced to either look into git to undo those you added by hand or add them back again.

Here’s the math, if you have, say 10 items localized from code, you support 10 languages or locales, you have to re-visit 100 translation units every time you make changes that require changes in the source locale file, which is very often when you make new features or fix a typo, adding tons of load, not to mention being highly error-prone.

Describe the solution you’d like

All $localize calls are extracted into the translation file as translation units, and documentation is updated.

Describe alternatives you’ve considered

At the very least make the extraction work, I could take care of the docs later since I’ve meddled quite a bit with the $localize API for enterprise projects:

image

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:13
  • Comments:17 (9 by maintainers)

github_iconTop GitHub Comments

13reactions
petebacondarwincommented, Jul 10, 2020

#32912 is now available on 10.1.0-next.0 release.

9reactions
petebacondarwincommented, Apr 20, 2020

And $localize as an API was not made public in v9. That is why it is not yet documented. In v9 we just used it internally for template translations. The fact that you can use it in your own TS code is supposed to be a secret 🀫

Read more comments on GitHub >

github_iconTop Results From Across the Web

Angular i18n: internationalization & localization with examples
Performing simple translations and providing additional translation data. Extracting translations to XLF files. Working with pluralization andΒ ...
Read more >
Work with translation files - Angular
The extract-i18n command creates a source language file named messages.xlf in the root directory of your project. For more information about the XMLΒ ......
Read more >
The Ultimate Guide to Angular Localization | Phrase
Extract localized strings for translation; Translate strings to the locales you want to support; Ensure your dates and numbers are localized ...
Read more >
Angular internationalization (i18n) tutorial - Localizely
In the following chapters, you will find out how to mark content for localization, extract marked content, translate, and finally, mergeΒ ...
Read more >
Localizing your app - Angular Hispano
The Angular extraction tool (described in Work with translation files in this guide) generates a translation unit entry for each i18n attribute in...
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