SlideShare a Scribd company logo
Internationalizing &
Localizing Your Modern
Javascript App
$ whoami
I’m Johnathan. I work at Airware on the cloud
platform for managing fleets of drones. Before that,
I worked at LinkedIn.
github.com/jleppert, blog @ stuffzies.com
i18n and translating apps is a reoccurring project
for me.
It can be painful, or fun.
Overview
• Why?
• STANDARDS@@@!! Review of the current state
• Strings/Messages: Example App & Code
Why should we translate our
apps?
• More users….? Quicker time to market than competitors.
• Enforce good design principles from day one
• It’s really hard and tedious after you have a lot of code
that didn’t care about it or consider it
• Bolted on i18n usually looks half-baked and janky —
you’ll have to make compromises
• Today’s apps are conversational. More than just about
button labels.
Goals
• Clean, simple workflows: developer first. Shouldn’t
“get in the way”
• Works on server/client with same idioms/API and, if
possible, code
• Shared messages resources for your translators or
translations provider
• Output is cacheable, strings sent down in javascript
bundles
Isn’t there a standard for
this? Kind of…
• ECMA-402 (2012)
• INTL object — available in the latest browsers, and,
now, node (v0.12 mainline — only en_US. Other
locales need a compile option). CLDR data is big.
• INTL.DateTimeFormat - Date formatting
• INTL.NumberFormat - Number formatting
• INTL.Collator (sorting)
ECMA-402: Locale
• Accept-Language standard: IETF (en_US)
• Scripts (zh-Hans, zh-Hant, sr-Cyrl, sr-Latn, etc)
• Unicode extensions: ja-JP-u-ca-japanese
How to use INTL
Step 0: Getting the user’s locale
Sadly, there is no defined API. navigator.language
(chrome/FF) and navigator.browserLanguage in IE,
or read the Accept-Language header.
I prefer to make an intelligent guess, then ask the
user — have it preselected. Store locale (string, e.g.
“en_US”) a cookie that is independent of your
session cookie.
Localizing Dates
new Intl.DateTimeFormat(“es”,
{month:"long"}).format(d)
'Febrero'
new Intl.DateTimeFormat("es",
{month:"long",day:"numeric"}).format(d)
'11 de febrero’
** Use an empty array as the first argument to use the user’s default (browser) locale. May
not be correct, however.
Numbers!!
> new Intl.NumberFormat(“en-US").format(1234.5678);
'1,234.568'
> new Intl.NumberFormat("de").format(1234.5678);
'1.234,568'
> new Intl.NumberFormat("fr").format(1234.5678);
'1 234,568'
> new Intl.NumberFormat("en-US",{style:"percent"})
.format(.023);
'2.3%'
Collation
var coll = new Intl.Collator(['en'], { sensitivity: 'base',
ignorePunctuation: true });
base = a = á, etc.
coll.compare('Bluebird', ‘bluebird') === 0, case is ignored.
coll.compare(‘blackbird’, ‘black-bird’) === 0, punctuation ignored
coll.compare('bluebird', ‘blackbird') === 1, (“u” is after “a”)
What about strings?
Something old, something new: gettext
• It works
• Handles pluralization and positional interpolation
• Use the existing ecosystem of tools, translation
providers
• Template-system, framework agnostic
An example app
• https://github.com/jleppert/rosetajs/
• Using Dust, Jed, po2json, browserify
• Same workflow client or server
• Same message format, code, helpers.
Developer API
• The @i18n template helper.
• {@i18n singular="Hello, {first_name}, you have
one message." plural="Hello, {first_name}, you
have {message_count} messages!"
value=“{message_count}"/}
• API: i18n.translate(‘Hello, {first_name}, you have
a new message!!.’, { first_name: ‘johnathan’});
How does it work?
• Template files and javascript source are read, an AST is
constructed and the @i18n helper calls/API are used to
create a .po file.
• xgettext - extracts translatable strings. I wrote a version that
understands javascript and dust templates, but you can do
so for most any language.
• po files are sent to translators, where they translate the
messages/re-arrange placeholders, etc.
• The right po file is selected based upon the user’s selected
locate and used during template helper/translation API
Let’s see it work
http://localhost:8000
Considerations
• Organize templates by feature (hopefully…)
• Automated tar of po files, send to translators via CI system
• Translate by feature: “this feature is available in english, french,
and spanish will be launched 6/10”
• Suffix files by locale for easy organization and co-locate them
• Check files into some source control project: receive translations
out of order from deployment
• Consider adopting a pirate-speak locale — getttext project has
many such manglers for po files
Thanks, and here’s some
More info
• Mailing List: http://jsi18n.com
• Gettext Overview: https://developer.mozilla.org/en-
US/docs/gettext
• PO/POT Format:
http://pology.nedohodnik.net/doc/user/en_US/ch-
poformat.html
• JS Gettext Implementation:
http://slexaxton.github.io/Jed/
• po2json: https://github.com/mikeedwards/po2json

More Related Content

What's hot

Php
PhpPhp
Ph pbasics
Ph pbasicsPh pbasics
Create Your Own Language
Create Your Own LanguageCreate Your Own Language
Create Your Own Language
Hamidreza Soleimani
 
Introduction to-php
Introduction to-phpIntroduction to-php
Introduction to-php
AhmedAElHalimAhmed
 
Constructor and encapsulation in php
Constructor and encapsulation in phpConstructor and encapsulation in php
Constructor and encapsulation in php
SHIVANI SONI
 
Sending emails through PHP
Sending emails through PHPSending emails through PHP
Sending emails through PHP
krishnapriya Tadepalli
 
Presentation of Python, Django, DockerStack
Presentation of Python, Django, DockerStackPresentation of Python, Django, DockerStack
Presentation of Python, Django, DockerStack
David Sanchez
 
Php a dynamic web scripting language
Php   a dynamic web scripting languagePhp   a dynamic web scripting language
Php a dynamic web scripting language
Elmer Concepcion Jr.
 
LIL Presentation
LIL PresentationLIL Presentation
LIL Presentation
badsectoracula
 
Compiler lecture 02
Compiler lecture 02Compiler lecture 02
Compiler lecture 02
University of Chitral
 
Python
PythonPython
PHP
PHPPHP
javascript 1
javascript 1javascript 1
javascript 1
osman do
 
Packer Genetics: The selfish code
Packer Genetics: The selfish codePacker Genetics: The selfish code
Packer Genetics: The selfish code
jduart
 
Python Programming
Python ProgrammingPython Programming
Python Programming
RenieMathews
 
Introduction About PHP
 Introduction About PHP Introduction About PHP
Introduction About PHP
Software company
 
Php mysql
Php mysqlPhp mysql
PHP Syntax & Comments
PHP Syntax & CommentsPHP Syntax & Comments
PHP Syntax & Comments
Sidrah Noor
 
PHP
PHPPHP

What's hot (19)

Php
PhpPhp
Php
 
Ph pbasics
Ph pbasicsPh pbasics
Ph pbasics
 
Create Your Own Language
Create Your Own LanguageCreate Your Own Language
Create Your Own Language
 
Introduction to-php
Introduction to-phpIntroduction to-php
Introduction to-php
 
Constructor and encapsulation in php
Constructor and encapsulation in phpConstructor and encapsulation in php
Constructor and encapsulation in php
 
Sending emails through PHP
Sending emails through PHPSending emails through PHP
Sending emails through PHP
 
Presentation of Python, Django, DockerStack
Presentation of Python, Django, DockerStackPresentation of Python, Django, DockerStack
Presentation of Python, Django, DockerStack
 
Php a dynamic web scripting language
Php   a dynamic web scripting languagePhp   a dynamic web scripting language
Php a dynamic web scripting language
 
LIL Presentation
LIL PresentationLIL Presentation
LIL Presentation
 
Compiler lecture 02
Compiler lecture 02Compiler lecture 02
Compiler lecture 02
 
Python
PythonPython
Python
 
PHP
PHPPHP
PHP
 
javascript 1
javascript 1javascript 1
javascript 1
 
Packer Genetics: The selfish code
Packer Genetics: The selfish codePacker Genetics: The selfish code
Packer Genetics: The selfish code
 
Python Programming
Python ProgrammingPython Programming
Python Programming
 
Introduction About PHP
 Introduction About PHP Introduction About PHP
Introduction About PHP
 
Php mysql
Php mysqlPhp mysql
Php mysql
 
PHP Syntax & Comments
PHP Syntax & CommentsPHP Syntax & Comments
PHP Syntax & Comments
 
PHP
PHPPHP
PHP
 

Viewers also liked

การโพสต์รูปในเว็บFlickr
การโพสต์รูปในเว็บFlickrการโพสต์รูปในเว็บFlickr
การโพสต์รูปในเว็บFlickr
ปวริศา
 
Seo by jamal
Seo by jamalSeo by jamal
Seo by jamal
Magsnet
 
Lea PåLsson Knm08 Slutprojekt adhdkvinnor.se
Lea PåLsson Knm08 Slutprojekt adhdkvinnor.seLea PåLsson Knm08 Slutprojekt adhdkvinnor.se
Lea PåLsson Knm08 Slutprojekt adhdkvinnor.se
Kommunikation Nya Medier 08-10
 
DE VINS
DE VINSDE VINS
мп стратегия достижения вашего успеха
мп стратегия достижения вашего успехамп стратегия достижения вашего успеха
мп стратегия достижения вашего успехаsherif
 
Lazy Loading Because I'm Lazy
Lazy Loading Because I'm LazyLazy Loading Because I'm Lazy
Lazy Loading Because I'm Lazy
Johnathan Leppert
 
Art Salon @ SENI
Art Salon @ SENIArt Salon @ SENI
Art Salon @ SENI
KC Y
 
Ministry Presentation
Ministry PresentationMinistry Presentation
Ministry Presentation
JApaxton
 
EQUUSTUR
EQUUSTUR EQUUSTUR
EQUUSTUR
Innovem Menorca
 
SALTRA BANDA
SALTRA BANDASALTRA BANDA
SALTRA BANDA
Innovem Menorca
 
¿Qué es la ley de la oferta y la demanda
¿Qué es la ley de la oferta y la demanda¿Qué es la ley de la oferta y la demanda
¿Qué es la ley de la oferta y la demanda
conchatumare
 
Mp ru 2012
Mp ru 2012Mp ru 2012
Mp ru 2012
sherif
 
UX Psychology 1st Track.
UX Psychology 1st Track.UX Psychology 1st Track.
UX Psychology 1st Track.
Mahmoud Metwally
 
Jenny Ekmark En förstudie hur Skogrand skyltdesign kan positionera sig på nätet
Jenny Ekmark En förstudie hur Skogrand skyltdesign kan positionera sig på nätetJenny Ekmark En förstudie hur Skogrand skyltdesign kan positionera sig på nätet
Jenny Ekmark En förstudie hur Skogrand skyltdesign kan positionera sig på nätet
Kommunikation Nya Medier 08-10
 
Bilaga 1 3 Adhdkvinnor
Bilaga 1 3 AdhdkvinnorBilaga 1 3 Adhdkvinnor
Bilaga 1 3 Adhdkvinnor
Kommunikation Nya Medier 08-10
 
UX Psychology 2nd Track.
UX Psychology 2nd Track.UX Psychology 2nd Track.
UX Psychology 2nd Track.
Mahmoud Metwally
 
เทคโนโลยี Web 2
เทคโนโลยี Web 2เทคโนโลยี Web 2
เทคโนโลยี Web 2
ปวริศา
 
Fpt Tesi Scavenging Definitiva
Fpt Tesi Scavenging DefinitivaFpt Tesi Scavenging Definitiva
Fpt Tesi Scavenging Definitiva
Enzo Ceroni
 
บทเรียน เรื่อง คำกริยา ป.5
บทเรียน เรื่อง คำกริยา ป.5บทเรียน เรื่อง คำกริยา ป.5
บทเรียน เรื่อง คำกริยา ป.5ปวริศา
 

Viewers also liked (19)

การโพสต์รูปในเว็บFlickr
การโพสต์รูปในเว็บFlickrการโพสต์รูปในเว็บFlickr
การโพสต์รูปในเว็บFlickr
 
Seo by jamal
Seo by jamalSeo by jamal
Seo by jamal
 
Lea PåLsson Knm08 Slutprojekt adhdkvinnor.se
Lea PåLsson Knm08 Slutprojekt adhdkvinnor.seLea PåLsson Knm08 Slutprojekt adhdkvinnor.se
Lea PåLsson Knm08 Slutprojekt adhdkvinnor.se
 
DE VINS
DE VINSDE VINS
DE VINS
 
мп стратегия достижения вашего успеха
мп стратегия достижения вашего успехамп стратегия достижения вашего успеха
мп стратегия достижения вашего успеха
 
Lazy Loading Because I'm Lazy
Lazy Loading Because I'm LazyLazy Loading Because I'm Lazy
Lazy Loading Because I'm Lazy
 
Art Salon @ SENI
Art Salon @ SENIArt Salon @ SENI
Art Salon @ SENI
 
Ministry Presentation
Ministry PresentationMinistry Presentation
Ministry Presentation
 
EQUUSTUR
EQUUSTUR EQUUSTUR
EQUUSTUR
 
SALTRA BANDA
SALTRA BANDASALTRA BANDA
SALTRA BANDA
 
¿Qué es la ley de la oferta y la demanda
¿Qué es la ley de la oferta y la demanda¿Qué es la ley de la oferta y la demanda
¿Qué es la ley de la oferta y la demanda
 
Mp ru 2012
Mp ru 2012Mp ru 2012
Mp ru 2012
 
UX Psychology 1st Track.
UX Psychology 1st Track.UX Psychology 1st Track.
UX Psychology 1st Track.
 
Jenny Ekmark En förstudie hur Skogrand skyltdesign kan positionera sig på nätet
Jenny Ekmark En förstudie hur Skogrand skyltdesign kan positionera sig på nätetJenny Ekmark En förstudie hur Skogrand skyltdesign kan positionera sig på nätet
Jenny Ekmark En förstudie hur Skogrand skyltdesign kan positionera sig på nätet
 
Bilaga 1 3 Adhdkvinnor
Bilaga 1 3 AdhdkvinnorBilaga 1 3 Adhdkvinnor
Bilaga 1 3 Adhdkvinnor
 
UX Psychology 2nd Track.
UX Psychology 2nd Track.UX Psychology 2nd Track.
UX Psychology 2nd Track.
 
เทคโนโลยี Web 2
เทคโนโลยี Web 2เทคโนโลยี Web 2
เทคโนโลยี Web 2
 
Fpt Tesi Scavenging Definitiva
Fpt Tesi Scavenging DefinitivaFpt Tesi Scavenging Definitiva
Fpt Tesi Scavenging Definitiva
 
บทเรียน เรื่อง คำกริยา ป.5
บทเรียน เรื่อง คำกริยา ป.5บทเรียน เรื่อง คำกริยา ป.5
บทเรียน เรื่อง คำกริยา ป.5
 

Similar to I18n

Introduction to Python Programming
Introduction to Python ProgrammingIntroduction to Python Programming
Introduction to Python Programming
Akhil Kaushik
 
computer languages
computer languagescomputer languages
computer languages
Rajendran
 
Desktop Apps with PHP and Titanium
Desktop Apps with PHP and TitaniumDesktop Apps with PHP and Titanium
Desktop Apps with PHP and Titanium
Ben Ramsey
 
Software Internationalization Crash Course
Software Internationalization Crash CourseSoftware Internationalization Crash Course
Software Internationalization Crash Course
Will Iverson
 
Class_X_PYTHON_J.pdf
Class_X_PYTHON_J.pdfClass_X_PYTHON_J.pdf
Class_X_PYTHON_J.pdf
SanjeedaPraween
 
Python programming language introduction unit
Python programming language introduction unitPython programming language introduction unit
Python programming language introduction unit
michaelaaron25322
 
Introduction to Python for Security Professionals
Introduction to Python for Security ProfessionalsIntroduction to Python for Security Professionals
Introduction to Python for Security Professionals
Andrew McNicol
 
Chapter-introduction about java programming
Chapter-introduction about java programmingChapter-introduction about java programming
Chapter-introduction about java programming
DrRajeshkumarPPatel
 
Mini-Training: TypeScript
Mini-Training: TypeScriptMini-Training: TypeScript
Mini-Training: TypeScript
Betclic Everest Group Tech Team
 
Developer’s viewpoint on swift programming language
Developer’s viewpoint on swift programming languageDeveloper’s viewpoint on swift programming language
Developer’s viewpoint on swift programming language
Azilen Technologies Pvt. Ltd.
 
Fundamentals of python
Fundamentals of pythonFundamentals of python
Fundamentals of python
BijuAugustian
 
Enforcing API Design Rules for High Quality Code Generation
Enforcing API Design Rules for High Quality Code GenerationEnforcing API Design Rules for High Quality Code Generation
Enforcing API Design Rules for High Quality Code Generation
Tim Burks
 
MODULE 1.pptx
MODULE 1.pptxMODULE 1.pptx
MODULE 1.pptx
KPDDRAVIDIAN
 
Introduction to Python Programming Basics
Introduction  to  Python  Programming BasicsIntroduction  to  Python  Programming Basics
Introduction to Python Programming Basics
Dhana malar
 
Basics PHP
Basics PHPBasics PHP
python-ppt.ppt
python-ppt.pptpython-ppt.ppt
python-ppt.ppt
MohammadSamiuddin10
 
python-ppt.ppt
python-ppt.pptpython-ppt.ppt
python-ppt.ppt
MohammadSamiuddin10
 
Practices and Tools for Building Better APIs
Practices and Tools for Building Better APIsPractices and Tools for Building Better APIs
Practices and Tools for Building Better APIs
Peter Hendriks
 
Build Great Networked APIs with Swift, OpenAPI, and gRPC
Build Great Networked APIs with Swift, OpenAPI, and gRPCBuild Great Networked APIs with Swift, OpenAPI, and gRPC
Build Great Networked APIs with Swift, OpenAPI, and gRPC
Tim Burks
 
Introduction to python
Introduction to pythonIntroduction to python
Introduction to python
Mohammed Rafi
 

Similar to I18n (20)

Introduction to Python Programming
Introduction to Python ProgrammingIntroduction to Python Programming
Introduction to Python Programming
 
computer languages
computer languagescomputer languages
computer languages
 
Desktop Apps with PHP and Titanium
Desktop Apps with PHP and TitaniumDesktop Apps with PHP and Titanium
Desktop Apps with PHP and Titanium
 
Software Internationalization Crash Course
Software Internationalization Crash CourseSoftware Internationalization Crash Course
Software Internationalization Crash Course
 
Class_X_PYTHON_J.pdf
Class_X_PYTHON_J.pdfClass_X_PYTHON_J.pdf
Class_X_PYTHON_J.pdf
 
Python programming language introduction unit
Python programming language introduction unitPython programming language introduction unit
Python programming language introduction unit
 
Introduction to Python for Security Professionals
Introduction to Python for Security ProfessionalsIntroduction to Python for Security Professionals
Introduction to Python for Security Professionals
 
Chapter-introduction about java programming
Chapter-introduction about java programmingChapter-introduction about java programming
Chapter-introduction about java programming
 
Mini-Training: TypeScript
Mini-Training: TypeScriptMini-Training: TypeScript
Mini-Training: TypeScript
 
Developer’s viewpoint on swift programming language
Developer’s viewpoint on swift programming languageDeveloper’s viewpoint on swift programming language
Developer’s viewpoint on swift programming language
 
Fundamentals of python
Fundamentals of pythonFundamentals of python
Fundamentals of python
 
Enforcing API Design Rules for High Quality Code Generation
Enforcing API Design Rules for High Quality Code GenerationEnforcing API Design Rules for High Quality Code Generation
Enforcing API Design Rules for High Quality Code Generation
 
MODULE 1.pptx
MODULE 1.pptxMODULE 1.pptx
MODULE 1.pptx
 
Introduction to Python Programming Basics
Introduction  to  Python  Programming BasicsIntroduction  to  Python  Programming Basics
Introduction to Python Programming Basics
 
Basics PHP
Basics PHPBasics PHP
Basics PHP
 
python-ppt.ppt
python-ppt.pptpython-ppt.ppt
python-ppt.ppt
 
python-ppt.ppt
python-ppt.pptpython-ppt.ppt
python-ppt.ppt
 
Practices and Tools for Building Better APIs
Practices and Tools for Building Better APIsPractices and Tools for Building Better APIs
Practices and Tools for Building Better APIs
 
Build Great Networked APIs with Swift, OpenAPI, and gRPC
Build Great Networked APIs with Swift, OpenAPI, and gRPCBuild Great Networked APIs with Swift, OpenAPI, and gRPC
Build Great Networked APIs with Swift, OpenAPI, and gRPC
 
Introduction to python
Introduction to pythonIntroduction to python
Introduction to python
 

Recently uploaded

CAKE: Sharing Slices of Confidential Data on Blockchain
CAKE: Sharing Slices of Confidential Data on BlockchainCAKE: Sharing Slices of Confidential Data on Blockchain
CAKE: Sharing Slices of Confidential Data on Blockchain
Claudio Di Ciccio
 
Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development ProvidersYour One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
akankshawande
 
June Patch Tuesday
June Patch TuesdayJune Patch Tuesday
June Patch Tuesday
Ivanti
 
Climate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing DaysClimate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing Days
Kari Kakkonen
 
20240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 202420240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 2024
Matthew Sinclair
 
20240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 202420240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 2024
Matthew Sinclair
 
Uni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdfUni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems S.M.S.A.
 
Ocean lotus Threat actors project by John Sitima 2024 (1).pptx
Ocean lotus Threat actors project by John Sitima 2024 (1).pptxOcean lotus Threat actors project by John Sitima 2024 (1).pptx
Ocean lotus Threat actors project by John Sitima 2024 (1).pptx
SitimaJohn
 
Columbus Data & Analytics Wednesdays - June 2024
Columbus Data & Analytics Wednesdays - June 2024Columbus Data & Analytics Wednesdays - June 2024
Columbus Data & Analytics Wednesdays - June 2024
Jason Packer
 
Things to Consider When Choosing a Website Developer for your Website | FODUU
Things to Consider When Choosing a Website Developer for your Website | FODUUThings to Consider When Choosing a Website Developer for your Website | FODUU
Things to Consider When Choosing a Website Developer for your Website | FODUU
FODUU
 
TrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy SurveyTrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy Survey
TrustArc
 
AI 101: An Introduction to the Basics and Impact of Artificial Intelligence
AI 101: An Introduction to the Basics and Impact of Artificial IntelligenceAI 101: An Introduction to the Basics and Impact of Artificial Intelligence
AI 101: An Introduction to the Basics and Impact of Artificial Intelligence
IndexBug
 
Choosing The Best AWS Service For Your Website + API.pptx
Choosing The Best AWS Service For Your Website + API.pptxChoosing The Best AWS Service For Your Website + API.pptx
Choosing The Best AWS Service For Your Website + API.pptx
Brandon Minnick, MBA
 
GenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizationsGenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizations
kumardaparthi1024
 
OpenID AuthZEN Interop Read Out - Authorization
OpenID AuthZEN Interop Read Out - AuthorizationOpenID AuthZEN Interop Read Out - Authorization
OpenID AuthZEN Interop Read Out - Authorization
David Brossard
 
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with SlackLet's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
shyamraj55
 
Infrastructure Challenges in Scaling RAG with Custom AI models
Infrastructure Challenges in Scaling RAG with Custom AI modelsInfrastructure Challenges in Scaling RAG with Custom AI models
Infrastructure Challenges in Scaling RAG with Custom AI models
Zilliz
 
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdfUnlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Malak Abu Hammad
 
“I’m still / I’m still / Chaining from the Block”
“I’m still / I’m still / Chaining from the Block”“I’m still / I’m still / Chaining from the Block”
“I’m still / I’m still / Chaining from the Block”
Claudio Di Ciccio
 
Full-RAG: A modern architecture for hyper-personalization
Full-RAG: A modern architecture for hyper-personalizationFull-RAG: A modern architecture for hyper-personalization
Full-RAG: A modern architecture for hyper-personalization
Zilliz
 

Recently uploaded (20)

CAKE: Sharing Slices of Confidential Data on Blockchain
CAKE: Sharing Slices of Confidential Data on BlockchainCAKE: Sharing Slices of Confidential Data on Blockchain
CAKE: Sharing Slices of Confidential Data on Blockchain
 
Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development ProvidersYour One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
 
June Patch Tuesday
June Patch TuesdayJune Patch Tuesday
June Patch Tuesday
 
Climate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing DaysClimate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing Days
 
20240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 202420240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 2024
 
20240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 202420240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 2024
 
Uni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdfUni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdf
 
Ocean lotus Threat actors project by John Sitima 2024 (1).pptx
Ocean lotus Threat actors project by John Sitima 2024 (1).pptxOcean lotus Threat actors project by John Sitima 2024 (1).pptx
Ocean lotus Threat actors project by John Sitima 2024 (1).pptx
 
Columbus Data & Analytics Wednesdays - June 2024
Columbus Data & Analytics Wednesdays - June 2024Columbus Data & Analytics Wednesdays - June 2024
Columbus Data & Analytics Wednesdays - June 2024
 
Things to Consider When Choosing a Website Developer for your Website | FODUU
Things to Consider When Choosing a Website Developer for your Website | FODUUThings to Consider When Choosing a Website Developer for your Website | FODUU
Things to Consider When Choosing a Website Developer for your Website | FODUU
 
TrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy SurveyTrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy Survey
 
AI 101: An Introduction to the Basics and Impact of Artificial Intelligence
AI 101: An Introduction to the Basics and Impact of Artificial IntelligenceAI 101: An Introduction to the Basics and Impact of Artificial Intelligence
AI 101: An Introduction to the Basics and Impact of Artificial Intelligence
 
Choosing The Best AWS Service For Your Website + API.pptx
Choosing The Best AWS Service For Your Website + API.pptxChoosing The Best AWS Service For Your Website + API.pptx
Choosing The Best AWS Service For Your Website + API.pptx
 
GenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizationsGenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizations
 
OpenID AuthZEN Interop Read Out - Authorization
OpenID AuthZEN Interop Read Out - AuthorizationOpenID AuthZEN Interop Read Out - Authorization
OpenID AuthZEN Interop Read Out - Authorization
 
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with SlackLet's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
 
Infrastructure Challenges in Scaling RAG with Custom AI models
Infrastructure Challenges in Scaling RAG with Custom AI modelsInfrastructure Challenges in Scaling RAG with Custom AI models
Infrastructure Challenges in Scaling RAG with Custom AI models
 
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdfUnlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
 
“I’m still / I’m still / Chaining from the Block”
“I’m still / I’m still / Chaining from the Block”“I’m still / I’m still / Chaining from the Block”
“I’m still / I’m still / Chaining from the Block”
 
Full-RAG: A modern architecture for hyper-personalization
Full-RAG: A modern architecture for hyper-personalizationFull-RAG: A modern architecture for hyper-personalization
Full-RAG: A modern architecture for hyper-personalization
 

I18n

  • 1. Internationalizing & Localizing Your Modern Javascript App
  • 2. $ whoami I’m Johnathan. I work at Airware on the cloud platform for managing fleets of drones. Before that, I worked at LinkedIn. github.com/jleppert, blog @ stuffzies.com i18n and translating apps is a reoccurring project for me. It can be painful, or fun.
  • 3. Overview • Why? • STANDARDS@@@!! Review of the current state • Strings/Messages: Example App & Code
  • 4. Why should we translate our apps? • More users….? Quicker time to market than competitors. • Enforce good design principles from day one • It’s really hard and tedious after you have a lot of code that didn’t care about it or consider it • Bolted on i18n usually looks half-baked and janky — you’ll have to make compromises • Today’s apps are conversational. More than just about button labels.
  • 5. Goals • Clean, simple workflows: developer first. Shouldn’t “get in the way” • Works on server/client with same idioms/API and, if possible, code • Shared messages resources for your translators or translations provider • Output is cacheable, strings sent down in javascript bundles
  • 6. Isn’t there a standard for this? Kind of… • ECMA-402 (2012) • INTL object — available in the latest browsers, and, now, node (v0.12 mainline — only en_US. Other locales need a compile option). CLDR data is big. • INTL.DateTimeFormat - Date formatting • INTL.NumberFormat - Number formatting • INTL.Collator (sorting)
  • 7. ECMA-402: Locale • Accept-Language standard: IETF (en_US) • Scripts (zh-Hans, zh-Hant, sr-Cyrl, sr-Latn, etc) • Unicode extensions: ja-JP-u-ca-japanese
  • 8. How to use INTL Step 0: Getting the user’s locale Sadly, there is no defined API. navigator.language (chrome/FF) and navigator.browserLanguage in IE, or read the Accept-Language header. I prefer to make an intelligent guess, then ask the user — have it preselected. Store locale (string, e.g. “en_US”) a cookie that is independent of your session cookie.
  • 9. Localizing Dates new Intl.DateTimeFormat(“es”, {month:"long"}).format(d) 'Febrero' new Intl.DateTimeFormat("es", {month:"long",day:"numeric"}).format(d) '11 de febrero’ ** Use an empty array as the first argument to use the user’s default (browser) locale. May not be correct, however.
  • 10. Numbers!! > new Intl.NumberFormat(“en-US").format(1234.5678); '1,234.568' > new Intl.NumberFormat("de").format(1234.5678); '1.234,568' > new Intl.NumberFormat("fr").format(1234.5678); '1 234,568' > new Intl.NumberFormat("en-US",{style:"percent"}) .format(.023); '2.3%'
  • 11. Collation var coll = new Intl.Collator(['en'], { sensitivity: 'base', ignorePunctuation: true }); base = a = á, etc. coll.compare('Bluebird', ‘bluebird') === 0, case is ignored. coll.compare(‘blackbird’, ‘black-bird’) === 0, punctuation ignored coll.compare('bluebird', ‘blackbird') === 1, (“u” is after “a”)
  • 12. What about strings? Something old, something new: gettext • It works • Handles pluralization and positional interpolation • Use the existing ecosystem of tools, translation providers • Template-system, framework agnostic
  • 13. An example app • https://github.com/jleppert/rosetajs/ • Using Dust, Jed, po2json, browserify • Same workflow client or server • Same message format, code, helpers.
  • 14. Developer API • The @i18n template helper. • {@i18n singular="Hello, {first_name}, you have one message." plural="Hello, {first_name}, you have {message_count} messages!" value=“{message_count}"/} • API: i18n.translate(‘Hello, {first_name}, you have a new message!!.’, { first_name: ‘johnathan’});
  • 15. How does it work? • Template files and javascript source are read, an AST is constructed and the @i18n helper calls/API are used to create a .po file. • xgettext - extracts translatable strings. I wrote a version that understands javascript and dust templates, but you can do so for most any language. • po files are sent to translators, where they translate the messages/re-arrange placeholders, etc. • The right po file is selected based upon the user’s selected locate and used during template helper/translation API
  • 16. Let’s see it work http://localhost:8000
  • 17. Considerations • Organize templates by feature (hopefully…) • Automated tar of po files, send to translators via CI system • Translate by feature: “this feature is available in english, french, and spanish will be launched 6/10” • Suffix files by locale for easy organization and co-locate them • Check files into some source control project: receive translations out of order from deployment • Consider adopting a pirate-speak locale — getttext project has many such manglers for po files
  • 18. Thanks, and here’s some More info • Mailing List: http://jsi18n.com • Gettext Overview: https://developer.mozilla.org/en- US/docs/gettext • PO/POT Format: http://pology.nedohodnik.net/doc/user/en_US/ch- poformat.html • JS Gettext Implementation: http://slexaxton.github.io/Jed/ • po2json: https://github.com/mikeedwards/po2json

Editor's Notes

  1. solving this problem many times isn’t a sexy problem, but very important for the company developer systems, processes: good, bad and ugly calltech to teleperformance, traffic increases as more people can actually read and interact with the app in their language: step 0 in personalization airware, drones aren’t legal in us, so the app needs to be international from the start rethinking things to ease roll-out, new languages, process, translation quality.
  2. everybody loves standards, when they do……come INTL standards Example app, can use everything as is, or just use the concepts
  3. more users is obvious, more users === more money for most people german: “my profile” = 32 characters. tabs will fall off the page airplane analogy
  4. lots of people use keys. keys. LONG keys. short keys. bad keys. positional? what’s that? plural? we only got one.
  5. started work in 2012. embarrassing. CLDR - big tech companies unite. lots of data. locale data.
  6. locale, region
  7. they forgot this part of the standard. step 0. yeah.
  8. translators may need to re-arrange placeholders it’s a PROCESS
  9. buzzword alert: isomorphic. i love that word. why i like dust: streams, compiling, fast. AST.
  10. introducing
  11. demo poedit change stuff, see if it works