Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Angular Wrocław - Internationalisation
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
Piotr Lewandowski
January 31, 2019
Programming
0
140
Angular Wrocław - Internationalisation
Current state and the future
Video (pl):
https://youtu.be/ArLCFuKVdGk?t=133
Piotr Lewandowski
January 31, 2019
Tweet
Share
More Decks by Piotr Lewandowski
See All by Piotr Lewandowski
Angular testing hygiene
piotrl
0
73
Angular 9 - Review
piotrl
1
140
Angular i18n - Current state and the future
piotrl
1
490
TypeScript: Must know for Java devs
piotrl
2
210
TypeScript - less known parts
piotrl
1
150
JVM bytecode manipulation
piotrl
0
120
Analysis of music affecting productivity
piotrl
1
63
Get `at least something` done
piotrl
0
50
Data-centric apps: Problems to solve
piotrl
0
64
Other Decks in Programming
See All in Programming
我々はなぜ「層」を分けるのか〜「関心の分離」と「抽象化」で手に入れる変更に強いシンプルな設計〜 #phperkaigi / PHPerKaigi 2026
shogogg
2
640
仕様漏れ実装漏れをなくすトレーサビリティAI基盤のご紹介
orgachem
PRO
7
3.2k
Everything Claude Code OSS詳細 — 5層構造の中身と導入方法
targe
0
150
Symfony + NelmioApiDocBundle を使った スキーマ駆動開発 / Schema Driven Development with NelmioApiDocBundle
okashoi
0
240
Windows on Ryzen and I
seosoft
0
410
PHP 7.4でもOpenTelemetryゼロコード計装がしたい! / PHPerKaigi 2026
arthur1
1
420
Reactive ❤️ Loom: A Forbidden Love Story
franz1981
2
180
The Past, Present, and Future of Enterprise Java
ivargrimstad
0
1.1k
今こそ押さえておきたい アマゾンウェブサービス(AWS)の データベースの基礎 おもクラ #6版
satoshi256kbyte
1
200
AI時代の脳疲弊と向き合う ~言語学としてのPHP~
sakuraikotone
1
1.6k
AIコードレビューの導入・運用と AI駆動開発における「AI4QA」の取り組みについて
hagevvashi
0
570
The free-lunch guide to idea circularity
hollycummins
0
370
Featured
See All Featured
Digital Projects Gone Horribly Wrong (And the UX Pros Who Still Save the Day) - Dean Schuster
uxyall
0
870
AI Search: Implications for SEO and How to Move Forward - #ShenzhenSEOConference
aleyda
1
1.2k
Avoiding the “Bad Training, Faster” Trap in the Age of AI
tmiket
0
110
Faster Mobile Websites
deanohume
310
31k
Primal Persuasion: How to Engage the Brain for Learning That Lasts
tmiket
0
300
How To Speak Unicorn (iThemes Webinar)
marktimemedia
1
420
Introduction to Domain-Driven Design and Collaborative software design
baasie
1
680
The AI Search Optimization Roadmap by Aleyda Solis
aleyda
1
5.5k
Conquering PDFs: document understanding beyond plain text
inesmontani
PRO
4
2.5k
AI in Enterprises - Java and Open Source to the Rescue
ivargrimstad
0
1.2k
Impact Scores and Hybrid Strategies: The future of link building
tamaranovitovic
0
240
Testing 201, or: Great Expectations
jmmastey
46
8.1k
Transcript
Internationalization Piotr Lewandowski
INTERNATIONALIZATION I18N LOCALIZATION L10N
Adapting product to region „look and feel” ! Localization "
Translator
Enables easy localization ! Internationalization " Developer
ANGULAR I18N Dates Currencies Numbers Plurals Translations Grammar forms
WHY OFFICIAL SOLUTION? ngx-translate deprecated official solution not ready?
GOALS Re-use existing standards Process works at scale No rutime
overhead
<h1 i18n>Hello, {{ name }}!</h1> <img src="avatar.png" i18n-title title="It’s you!"
/> <p i18n="UserModule|User Profile"> Last time seen at {{ lastVisited | date }} </p>
PLURAL FORMS
ICU EXPRESSIONS <p>Alicja { count, plural, =0 { nie złapała
Pokémona } one { złapała Pokémona } few { złapała {{count}} Pokémony } many { złapała {{count}} Pokémonów } other { złapała Pokémonów: {{count}} } }</p> Alicja złapała 5 Pokémonów count = 5
XLIFF <trans-unit id="dfd67d0cbc87b3e8b89570c00031a4751cf4b76c" datatype="html"> <source>Hello, <x id="INTERPOLATION" equiv-text="{{name}}"/>!</source> <!-- ...
stuff ... --> </trans-unit> <h1 i18n>Hello, {{name}}!</h1>
ID GENERATION <h1 i18n="@@topbar.header"> Angular is cool </h1> <h1 i18n>
Angular is cool </h1> Custom ID Generated ID hash Content changes = ID changes Never changes
PROCESS Mark HTML with i18n attributes Extract messages from HTML
to XLIFF Copy & translate XLIFF Generate new app version for each language Outside Angular
PAIN POINTS
PAIN POINTS
MULTIPLE BUNDLES
MULTIPLE BUNDLES ! Currently... Everything at build time with AOT
Duplicated builds for each locale " Desired... ONE bundle for all locales Translating before application bootstraps
MULTIPLE BUNDLES ! On the roadmap since 2.0 " Planned
for Ivy compiler # Already in master since June 2018 STATUS
DURING COMPILATION... <h2 i18n="User profile@@page.header"> Hello, Gdańsk! </h2> interface I18nDef
{ value: 'Hello, Gdańsk!'; id?: 'page.header'; meaning?: undefined; description?: 'User profile'; }
MULTIPLE BUNDLES PR #24037 205 review comments J OVERVIEW Loading
BEFORE Angular bootstraps All locales in ONE bundle Choose: AOT or RunTime
IN-CODE TRANSLATIONS
IN-CODE TRANSLATIONS ! Currently... Everything in HTML " Desired... Translation
in services
IN-CODE TRANSLATIONS ! Planned with Ivy compiler " Work in
progress # Polyfill already exists @ngx-translate/i18n-polyfill STATUS
IN-CODE TRANSLATIONS OVERVIEW constructor(i18n: I18n) { this.message = i18n('Speaking at
meetup in {{myVar}} !', { myVar: 'Wrocław, Poland' });
WHY NOT YET RELASED
IS IVY READY YET? Ninety – ninety rule ! Alpha-version
first Last-updated: November 2018
SPECULATIVE FUTURE
ID GENERATION More stable IDs Same IDs for all formats
Migration tool After Ivy
LAZY LOADING Localize single module Better library support See #14331
After Ivy
OPENING THE API Allow custom parsers, generators and loaders →
JSON suport NOT CONFIRMED
TIPS
TSLINT RULE
Enable i18n TSLint rule // tslint.json "i18n": [ true, "check-id",
"check-text" ] * Requires codelyzer Optional, depending on your translation strategy
Enable i18n TSLint rule <h1> Angular i18n is cool </h1>
!
Enable i18n TSLint rule <h1 i18n="@@article.header"> Angular i18n is cool
</h1> !
ENABLE EXTRACTOR
ENABLE EXTRACTOR // package.json "scripts": { "build": "ng build &&
ng xi18n" },
NESTED I18N <div> <div> Angular i18n is cool </div> </div>
! <article i18n> <h1 i18n="@@article.header"> Angular i18n is cool </h1> <p> ... </p> </article> Error: Could not mark an element as translatable inside a translatable section
NESTED I18N <div> <div> Angular i18n is cool </div> </div>
! <article> <h1 i18n="@@article.header"> Angular i18n is cool </h1> <p i18n="@@article.content"> ... </p> </article>
NESTED I18N <div> <div> Angular i18n is cool </div> </div>
! <article i18n="@@article"> <h1> Angular i18n is cool </h1> <p> ... </p> </article>
DETACHED TEXT <form-field i18n> Name <error i18n> Invalid name </error>
</form-field>
DETACHED TEXT <form-field> <ng-container i18n> Name </ng-container> <error i18n> Invalid
name </error> </form-field>
WHY OFFICIAL SOLUTION?
BUT... Use whatever fits you
RESOURCES Angular i18n: » Docs » Plans for v6 and
v7 General: » On i18n and l10n » i18nGuy - Guidelines
TOOLS & EDITORS Localization platforms: » Pootle » Transifex »
POEditor » TextUnited Editors & scripts: » Virtaal » tiny ng-translator » ngx-i18nsupport (xliff merge)
@constjs Piotr Lewandowski THANK YOU DZIĘKUJĘ
@constjs Piotr Lewandowski THANK YOU DZIĘKUJĘ