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
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
PyCon 2014
April 13, 2014
Technology
0
730
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.7k
Technical Onboarding, Training, and Mentoring by Kate Heddleston and Nicole Zuckerman
pycon2014
1
2.4k
"My big gay adventure. Making, releasing and selling an indie game made in python." by Luke Miller
pycon2014
2
1.7k
Farewell and Welcome Home, Python in Two Genders by Naomi_Ceder
pycon2014
1
780
Deliver Your Software in an Envelope by Augie Fackler and Nathaniel Manista
pycon2014
1
610
Hitchhikers Guide to Free and Open Source Participation by Elena Williams
pycon2014
6
1.2k
Smart Dumpster by Bradley E. Angell
pycon2014
0
560
Software Engineering for Hackers: Bridging the Two Solitudes by Tavish Armstrong
pycon2014
0
780
Outreach Program for Women: Lessons in Collaboration by Marina Zhurakhinskaya
pycon2014
0
600
Other Decks in Technology
See All in Technology
GCASアップデート(202601-202603)
techniczna
0
240
スピンアウト講座04_ルーティン処理
overflowinc
0
140
The Rise of Browser Automation: AI-Powered Web Interaction in 2026
marcthompson_seo
0
150
【社内勉強会】新年度からコーディングエージェントを使いこなす - 構造と制約で引き出すClaude Codeの実践知
nwiizo
5
3.8k
「お金で解決」が全てではない!大規模WebアプリのCI高速化 #phperkaigi
stefafafan
4
2k
フロントエンド刷新 4年間の軌跡
yotahada3
0
520
Mitigating geopolitical risks with local-first software and atproto
ept
0
140
Bill One 開発エンジニア 紹介資料
sansan33
PRO
5
18k
The_Evolution_of_Bits_AI_SRE.pdf
nulabinc
PRO
0
250
"作る"から"使われる"へ:Backstage 活用の現在地
sbtechnight
0
230
欠陥分析(ODC分析)における生成AIの活用プロセスと実践事例 / 20260320 Suguru Ishii & Naoki Yamakoshi & Mayu Yoshizawa
shift_evolve
PRO
0
230
Phase05_ClaudeCode入門
overflowinc
0
240
Featured
See All Featured
New Earth Scene 8
popppiees
1
1.8k
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
231
22k
A Guide to Academic Writing Using Generative AI - A Workshop
ks91
PRO
0
240
How to build an LLM SEO readiness audit: a practical framework
nmsamuel
1
690
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
35
3.4k
DevOps and Value Stream Thinking: Enabling flow, efficiency and business value
helenjbeal
1
150
Leadership Guide Workshop - DevTernity 2021
reverentgeek
1
240
AI Search: Where Are We & What Can We Do About It?
aleyda
0
7.2k
What does AI have to do with Human Rights?
axbom
PRO
1
2k
Game over? The fight for quality and originality in the time of robots
wayneb77
1
140
Hiding What from Whom? A Critical Review of the History of Programming languages for Music
tomoyanonymous
2
570
How to Grow Your eCommerce with AI & Automation
katarinadahlin
PRO
1
150
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!