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
Localization Revisted (aka. Translations Evolve...
Search
PyCon 2014
April 13, 2014
Technology
0
680
Localization Revisted (aka. Translations Evolved) by Ruchi Varshney
PyCon 2014
April 13, 2014
Tweet
Share
More Decks by PyCon 2014
See All by PyCon 2014
Postgres Performance for Humans by Craig Kerstiens
pycon2014
29
3.6k
Technical Onboarding, Training, and Mentoring by Kate Heddleston and Nicole Zuckerman
pycon2014
1
2.2k
"My big gay adventure. Making, releasing and selling an indie game made in python." by Luke Miller
pycon2014
2
1.5k
Farewell and Welcome Home, Python in Two Genders by Naomi_Ceder
pycon2014
1
700
Deliver Your Software in an Envelope by Augie Fackler and Nathaniel Manista
pycon2014
1
520
Hitchhikers Guide to Free and Open Source Participation by Elena Williams
pycon2014
6
1.1k
Smart Dumpster by Bradley E. Angell
pycon2014
0
480
Software Engineering for Hackers: Bridging the Two Solitudes by Tavish Armstrong
pycon2014
0
700
Outreach Program for Women: Lessons in Collaboration by Marina Zhurakhinskaya
pycon2014
0
480
Other Decks in Technology
See All in Technology
How CERN serves 1EB of data via FUSE
ennael
PRO
0
16k
入門 KRR
donkomura
0
110
All your memory are belong to… whom?
ennael
PRO
0
640
OPENLOGI Company Profile for engineer
hr01
1
12k
Oracle Database 23ai 新機能#4 Rolling Maintenance
oracle4engineer
PRO
0
120
Causal Impactを用いたLINE Pay UIの効果検証とABテスト実施への貢献
lycorptech_jp
PRO
3
550
Azure Verified Moduleを触って分かった注目ポイント/azure-verified-module-begin
mhrtech
1
350
Perlで始めるeBPF: 自作Loaderの作り方 / Getting started with eBPF in Perl_How to create your own Loader
takehaya
1
790
O'Reilly Superstream: Building a RAG App to Chat with Your Data
pamelafox
0
110
Strict Concurrencyにしたらdeinitでクラッシュする話
0si43
0
120
AWS Lambdaで実現するスケーラブルで低コストなWebサービス構築/YAPC::Hakodate2024
fujiwara3
7
3k
【shownet.conf_】AI技術とUX監視の応用でShowNetの基盤を支えるモニタリングシステム
shownet
PRO
0
350
Featured
See All Featured
Into the Great Unknown - MozCon
thekraken
30
1.4k
Adopting Sorbet at Scale
ufuk
73
9k
What’s in a name? Adding method to the madness
productmarketing
PRO
22
3.1k
Teambox: Starting and Learning
jrom
131
8.7k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
246
1.3M
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
24
1.7k
YesSQL, Process and Tooling at Scale
rocio
167
14k
The Cost Of JavaScript in 2023
addyosmani
43
5.8k
A Philosophy of Restraint
colly
202
16k
Producing Creativity
orderedlist
PRO
341
39k
Java REST API Framework Comparison - PWX 2021
mraible
PRO
28
7.5k
Navigating Team Friction
lara
183
14k
Transcript
translations evolved ruchi varshney pycon 2014
about me @rvarshney on the web
None
most common tools are gettext and babel ! import gettext
as _ print _("Translate me.") ! from babel import dates, numbers dates.format_datetime(date, locale='de') numbers.format_decimal(1.234, locale='de') ! ! basics
! # Extraction config file (babel.cfg) [python: **.py] [jinja2: **.html]
[javascript: **.js] ! [extractors] python = babel.messages.extract:extract_python jinja2 = jinja2.ext:babel_extract javascript = babel.messages.extract:extract_javascript ! ! basics
# Run extraction $ pybabel extract --mapping-file babel.cfg --output out.po
<source_dir> ! ! ! ! ! basics
! # Translations for MYAPP. # Copyright (c) 2014 ORGANIZATION
! #: app/views.py:20 #, python-format msgid "Translate me." msgstr "" ! ! basics
basics _("hello!") msgid "hello!" bonjour! translation service message.mo extract compile
integrate
what could possibly go wrong?
latency
! def greeting(name, is_welcome): if is_welcome: return _("Hey there!") else:
return _("Bye Bye") ! ! ! strings before logic
! class Greetings(object): WELCOME_MESSAGE = _("Hey there!") BYE_MESSAGE = _("Bye!")
! ! def greeting(name, is_welcome): if is_welcome: return Greetings.WELCOME_MESSAGE else: return Greetings.BYE_MESSAGE strings before logic
! class Greetings(object): WELCOME_MESSAGE = _("Hey there!”) BYE_MESSAGE = _("Bye!")
BYE_MESSAGE = _("See you later!") ! ! ! ! ! lost in translation
! #, python-format msgid "Bye!" msgstr "Au revoir!" ! #,
python-format msgid "See you later!" msgstr "" ! lost in translation
lost in translation
hooks https://17727.web.pr.dev.hearsaylabs.com/
! class Greetings(object): WELCOME_MESSAGE = _("Hey there!”) BYE_MESSAGE = _("Bye!")
NEW_BYE_MESSAGE = _("See you later!") ! ! ! ! ! lost in translation
babel gotchas #: app/views.py:20 #, python-format #, fuzzy msgid "Translate
them." msgstr "Traduisez-moi"
babel gotchas “strings might be marked as fuzzy — if
you have fuzzy entries, make sure to check them by hand and remove the fuzzy flag before compiling.”
• —no-fuzzy-matching • other useful ones • —ignore-obsolete True •
—add-comments TRANSLATOR: • —keyword "_lazy" babel flags
• find the last translation date • run string extraction
• send po file for translation • wait… • get translations back • integrate with app • …. mundane dev
automation jenkins/travis translation upload translation download
dev intervention
content management
content management developer friendly apis translator friendly continuous, cross platform
• sample code • https://github.com/rvarshney/translations • how to i18n and
l10n (pycon 2013) • http://bit.ly/pyconi18n • https://www.youtube.com/watch?v=QUFPPJMjn6k resources
• python packages and tools • gettext, babel, potpie, polib
• githooks, webhooks, jenkins, travis • content management • smartling, transifex have known python support • django-rosetta (open source) resources
questions? @rvarshney we’re hiring!