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
700
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.3k
"My big gay adventure. Making, releasing and selling an indie game made in python." by Luke Miller
pycon2014
2
1.6k
Farewell and Welcome Home, Python in Two Genders by Naomi_Ceder
pycon2014
1
720
Deliver Your Software in an Envelope by Augie Fackler and Nathaniel Manista
pycon2014
1
540
Hitchhikers Guide to Free and Open Source Participation by Elena Williams
pycon2014
6
1.2k
Smart Dumpster by Bradley E. Angell
pycon2014
0
520
Software Engineering for Hackers: Bridging the Two Solitudes by Tavish Armstrong
pycon2014
0
730
Outreach Program for Women: Lessons in Collaboration by Marina Zhurakhinskaya
pycon2014
0
530
Other Decks in Technology
See All in Technology
はてなの開発20年史と DevOpsの歩み / DevOpsDays Tokyo 2025 Keynote
daiksy
5
1.3k
ゆるくVPC Latticeについてまとめてみたら、意外と奥深い件
masakiokuda
2
230
アセスメントで紐解く、10Xのデータマネジメントの軌跡
10xinc
1
330
大規模サービスにおける カスケード障害
takumiogawa
3
790
AWSのマルチアカウント管理 ベストプラクティス最新版 2025 / Multi-Account management on AWS best practice 2025
ohmura
3
180
自分の軸足を見つけろ
tsuemura
2
570
SREの視点で考えるSIEM活用術 〜AWS環境でのセキュリティ強化〜
coconala_engineer
1
240
All You Need Is Kusa 〜Slackデータで始めるデータドリブン〜
jonnojun
0
140
試験は暗記より理解 〜効果的な試験勉強とその後への活かし方〜
fukazawashun
0
340
いつも初心者向けの記事に助けられているので得意分野では初心者向けの記事を書きます
toru_kubota
2
260
クォータ監視、AWS Organizations環境でも楽勝です✌️
iwamot
PRO
1
230
近年の PyCon 情勢から見た PyCon APAC のまとめ
terapyon
0
280
Featured
See All Featured
Adopting Sorbet at Scale
ufuk
76
9.3k
How STYLIGHT went responsive
nonsquared
99
5.5k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
231
53k
Automating Front-end Workflow
addyosmani
1369
200k
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
34
2.2k
Become a Pro
speakerdeck
PRO
27
5.3k
A better future with KSS
kneath
239
17k
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
47
2.4k
Building Better People: How to give real-time feedback that sticks.
wjessup
367
19k
Dealing with People You Can't Stand - Big Design 2015
cassininazir
367
26k
GraphQLとの向き合い方2022年版
quramy
46
14k
Practical Orchestrator
shlominoach
186
10k
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!