Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Packaging an Angular library with i18n support

Tags:

Angular's i18n is great, and tools like ng-packagr makes component library packaging extremely easy, but can they be combined?

What if i want to package and distribute a component library having translatable components? Is it possible? How do I package such a library? Will translation files be shipped together with the package, or should they be defined in the main app?

It'd be great if someone could point me at some doc. Thanks

like image 860
leonixyz Avatar asked Mar 15 '18 14:03

leonixyz


People also ask

What is i18n in Angular?

Angular Internationalizationlink Internationalization, sometimes referenced as i18n, is the process of designing and preparing your project for use in different locales around the world. Localization is the process of building versions of your project for different locales.

What is i18n library?

Internationalization, or i18n (18 is the number of letters between i and n), is the process of building your product to support multiple languages. This can include separating your text from your code and using a library to format your dates based on different countries and time zones.


1 Answers

When you generate a translation file for the main app with the CLI (with ng xi18n), elements with the attribute i18n in the library are imported in the translation file. You can then define the translations in the main app.

like image 76
R3N0 Avatar answered Sep 19 '22 17:09

R3N0