Registration of travel agents - 'Explanation of the registration system under...
RaspberryPiで日本の子供たちにプログラミングのパッションを伝えよう!
1. Raspberry Piで日本の子供たちに
プログラミングのパッションを
伝えよう!
Let’s use Raspberry Pi
to share our passion of programming
with kids of Japan!
September 21-22, 2016
Antoine Choppin
@japonophile
ショパン アントワン
the World
世界
https://goo.gl/OnFGWj
27. gettext入門
...
print _(“Hello, my name is Kano”)
...
プログラム: myapp-main.py
...
src/myapp-main.py
...
PYPOTFILES: xgettextで
処理するファイルのリスト
#: src/myapp-main.py:36
msgid "Hello, my name is Kano"
msgstr ""
翻訳のテンプレート: messages.pot
#: src/myapp-main.py:36
msgid "Hello, my name is Kano"
msgstr "こんにちは、Kanoと言います。"
日本語翻訳: ja.po
#: src/myapp-main.py:36
msgid "Hello, my name is Kano"
msgstr "Bonjour, je m’appelle Kano"
フランス語翻訳: fr.po
00111010011011110101000100001010111
01000101001010101000101011101010111
01001010100100010101001000101010111
locales/ja/LC_MESSAGES/myapp.mo
00001010111010001010010101010001010
11101010111010010101110011101001101
11101010001010101001000101010010001
locales/fr/LC_MESSAGES/myapp.mo
28. i18n tips
• %s, %dより.formatを使おう
• 位置変数より変数に名前をつけよう
_(“Today is {} {}”)
_(“Today is {month} {day}”)
• 翻訳者へコメントを入れよう
• 文を分離しない:
_(“this is a “) + car.color + _(“car”)
_(“this is a {color} car”).format(color=car.color)
• 文字列にHTMLを含めない
_(“<em>Welcome!</em>”)
u”<em>” + _(“Welcome!”) + u”</em>”
https://www.youtube.com/watch?v=UOOMFGURr5I