Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
Localization Internationalization
catgets VS gettext
1995
[language[_territory][.codeset][@modifier]]
Locale
en_GB.UTF-8@variant
Messages
Dates
Numbers
Currency
en_GB
Locale
More about Localization
• Images
• Sound
• Video
• Cultural perception
• Taxes
gettext features
• Messages
• Plural forms
• Context
Django I18n tools
• gettext
• Formats
• Timezones
I18n features
workflow
Me InterpreterLocalized
Product
P
O
M
O
from django.utils.translation import gettext_noop as _noop
from django.utils.translation import gettext as _
{
_noop(”Winn...
Portable Objects
PO files
#: main.py:3
msgid ""
"It's a very funny thought that, if Bears were Bees,"
"They'd build their ...
Pootle Server
Custom Solution
http://rannts.ru/meetups/1/l10n/
Legacy?
Customer?
#: main.py:3
msgid ""
"It's a very funny thought that, if Bears were Bees,"
"They'd build their nests at the bottom of tre...
Provide more context
@classmethod
def get_table_caption(cls):
# Translators: Taxable or Non-Taxable Donations
return cls.p...
Avoid dynamic string creating
@property
def prefix(self):
if self.gov_state in ['CA', 'TX', 'FL']:
# Translators: Taxable ...
What if nothing to do?
Insert right to the PO files
python-babel
Flask-Babel
Same features. Both uses gettext.
babel-django
Python gettext standard library
GNU gettext API
import gettext
gettext.gettext('EOD Report')
More – pymorphy – pymorphy2
Русский, Белорусский, Украинский.
Морфологический анализ.
(род, число, падеж)
pymorphy-django
mystem
Yandex
Морфологический анализ
cli интерфейс
Informative Links
• History of GNU gettext
https://www.gnu.org/software/gettext/manual/html_node/gettext_219.html#History
...
18 Оттенков I18n
18 Оттенков I18n
18 Оттенков I18n
Upcoming SlideShare
Loading in …5
×

18 Оттенков I18n

172 views

Published on

Проекты становятся глобальными, когда этого никто не ждёт. Проблема перевода возникает не только у переводчиков, но и у инженеров. Разговор об основных трудностях перевода с точки зрения Web разработчика. Усвоенные уроки, инструменты и life hacks.

Published in: Engineering
  • Be the first to comment

18 Оттенков I18n

  1. 1. Localization Internationalization
  2. 2. catgets VS gettext 1995
  3. 3. [language[_territory][.codeset][@modifier]] Locale en_GB.UTF-8@variant
  4. 4. Messages Dates Numbers Currency en_GB Locale
  5. 5. More about Localization • Images • Sound • Video • Cultural perception • Taxes
  6. 6. gettext features • Messages • Plural forms • Context
  7. 7. Django I18n tools
  8. 8. • gettext • Formats • Timezones I18n features
  9. 9. workflow Me InterpreterLocalized Product P O M O
  10. 10. from django.utils.translation import gettext_noop as _noop from django.utils.translation import gettext as _ { _noop(”Winnie rhyme”): _("It's a very funny thought that, if Bears were Bees," "They'd build their nests at the bottom of trees." "And that being so (if the Bees were Bears)," "We shouldn't have to climb up all these stairs.”) } ✪ python manage.py makemessages
  11. 11. Portable Objects PO files #: main.py:3 msgid "" "It's a very funny thought that, if Bears were Bees," "They'd build their nests at the bottom of trees." "And that being so (if the Bees were Bears)," "We shouldn't have to climb up all these stairs.” msgstr ""
  12. 12. Pootle Server
  13. 13. Custom Solution http://rannts.ru/meetups/1/l10n/ Legacy? Customer?
  14. 14. #: main.py:3 msgid "" "It's a very funny thought that, if Bears were Bees," "They'd build their nests at the bottom of trees." "And that being so (if the Bees were Bears)," "We shouldn't have to climb up all these stairs.” msgstr "" "Если б мишки были пчёлами, то они бы нипочём, никогда ” "и не подумали так высо́ко строить дом… Ой!" ✪ python manage.py compilemessages
  15. 15. Provide more context @classmethod def get_table_caption(cls): # Translators: Taxable or Non-Taxable Donations return cls.prefix + _(' Donations') #: Translators: Taxable or Non-Taxable Donations #: source.py:3 msgid "" "Donations" msgstr "" source PO
  16. 16. Avoid dynamic string creating @property def prefix(self): if self.gov_state in ['CA', 'TX', 'FL']: # Translators: Taxable Donations return _('Taxable') else: # Translators: Non-Taxable Donations return _('Non-Taxable') def get_table_caption(self): # Translators: Taxable or Non-Taxable Donations return self.prefix + _('Donations')) Words sequence cannot be changed
  17. 17. What if nothing to do? Insert right to the PO files
  18. 18. python-babel Flask-Babel Same features. Both uses gettext. babel-django
  19. 19. Python gettext standard library GNU gettext API import gettext gettext.gettext('EOD Report')
  20. 20. More – pymorphy – pymorphy2 Русский, Белорусский, Украинский. Морфологический анализ. (род, число, падеж) pymorphy-django
  21. 21. mystem Yandex Морфологический анализ cli интерфейс
  22. 22. Informative Links • History of GNU gettext https://www.gnu.org/software/gettext/manual/html_node/gettext_219.html#History https://www.w3.org/International/questions/qa-i18n.ru.php

×