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
690
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.5k
Farewell and Welcome Home, Python in Two Genders by Naomi_Ceder
pycon2014
1
710
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.2k
Smart Dumpster by Bradley E. Angell
pycon2014
0
490
Software Engineering for Hackers: Bridging the Two Solitudes by Tavish Armstrong
pycon2014
0
710
Outreach Program for Women: Lessons in Collaboration by Marina Zhurakhinskaya
pycon2014
0
500
Other Decks in Technology
See All in Technology
MLOps の現場から
asei
6
630
複雑性の高いオブジェクト編集に向き合う: プラガブルなReactフォーム設計
righttouch
PRO
0
110
Jetpack Composeで始めるServer Cache State
ogaclejapan
2
160
1等無人航空機操縦士一発試験 合格までの道のり ドローンミートアップ@大阪 2024/12/18
excdinc
0
150
NW-JAWS #14 re:Invent 2024(予選落ち含)で 発表された推しアップデートについて
nagisa53
0
250
多領域インシデントマネジメントへの挑戦:ハードウェアとソフトウェアの融合が生む課題/Challenge to multidisciplinary incident management: Issues created by the fusion of hardware and software
bitkey
PRO
2
100
コンテナセキュリティのためのLandlock入門
nullpo_head
2
320
watsonx.ai Dojo #5 ファインチューニングとInstructLAB
oniak3ibm
PRO
0
160
How to be an AWS Community Builder | 君もAWS Community Builderになろう!〜2024 冬 CB募集直前対策編?!〜
coosuke
PRO
2
2.8k
フロントエンド設計にモブ設計を導入してみた / 20241212_cloudsign_TechFrontMeetup
bengo4com
0
1.9k
Snykで始めるセキュリティ担当者とSREと開発者が楽になる脆弱性対応 / Getting started with Snyk Vulnerability Response
yamaguchitk333
2
180
Turing × atmaCup #18 - 1st Place Solution
hakubishin3
0
470
Featured
See All Featured
The Invisible Side of Design
smashingmag
298
50k
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
2
290
RailsConf 2023
tenderlove
29
940
Mobile First: as difficult as doing things right
swwweet
222
9k
The Cost Of JavaScript in 2023
addyosmani
45
7k
We Have a Design System, Now What?
morganepeng
51
7.3k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
26
1.9k
Visualization
eitanlees
146
15k
Into the Great Unknown - MozCon
thekraken
33
1.5k
jQuery: Nuts, Bolts and Bling
dougneiner
61
7.5k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
95
17k
Building Adaptive Systems
keathley
38
2.3k
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!