Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Angular Wrocław - Internationalisation
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
Piotr Lewandowski
January 31, 2019
Programming
150
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Angular Wrocław - Internationalisation
Current state and the future
Video (pl):
https://youtu.be/ArLCFuKVdGk?t=133
Piotr Lewandowski
January 31, 2019
More Decks by Piotr Lewandowski
See All by Piotr Lewandowski
Angular testing hygiene
piotrl
0
90
Angular 9 - Review
piotrl
1
160
Angular i18n - Current state and the future
piotrl
1
530
TypeScript: Must know for Java devs
piotrl
2
220
TypeScript - less known parts
piotrl
1
150
JVM bytecode manipulation
piotrl
0
130
Analysis of music affecting productivity
piotrl
1
73
Get `at least something` done
piotrl
0
55
Data-centric apps: Problems to solve
piotrl
0
76
Other Decks in Programming
See All in Programming
Augmenting AI with the Power of Jakarta EE
ivargrimstad
0
230
AI活用は、個人から組織へ|マルチプレイヤーエージェントハーネス「QM」の社内活用事例 / AI use is moving from individuals to orgs
rkaga
1
140
モジュールの視点からSwiftを読み解く #iosdc
s_shimotori
0
190
Agents on Rails - Rails at Scale 2026
irinanazarova
0
140
ゲームコントローラやキーボードのファームウェアをSwiftで書く
kishikawakatsumi
1
250
更なる可用性を求めて、5年間運用したKotlinのアプリケーションをGoでリプレイスする話
ken_tunc
0
330
setup-vp GitLab対応の裏側
naokihaba
0
120
ハーネス設計入門 〜 基礎知識の整理から実務へのステップアップ 〜
kinopeee
11
7.9k
Java 27新機能 / Java 27 new features
kishida
2
150
iOSDC Japan 2026 - Swiftで作って学ぼう!データベース自作入門
kaseken
2
280
Augmenting AI with the Power of Jakarta EE
ivargrimstad
0
270
Augmenting AI with the Power of Jakarta EE
ivargrimstad
0
250
Featured
See All Featured
Reality Check: Gamification 10 Years Later
codingconduct
0
2.3k
sira's awesome portfolio website redesign presentation
elsirapls
0
420
The Pragmatic Product Professional
lauravandoore
37
7.4k
Tell your own story through comics
letsgokoyo
1
1.1k
Highjacked: Video Game Concept Design
rkendrick25
PRO
1
460
svc-hook: hooking system calls on ARM64 by binary rewriting
retrage
2
580
Scaling GitHub
holman
464
140k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
333
23k
Everyday Curiosity
cassininazir
0
320
The Curious Case for Waylosing
cassininazir
1
520
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
35
2.6k
Fantastic passwords and where to find them - at NoRuKo
philnash
52
3.8k
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Ę