SlideShare una empresa de Scribd logo
1 de 25
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(”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
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 ""
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 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
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
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
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
https://www.w3.org/International/questions/qa-i18n.ru.php

Más contenido relacionado

Último

result management system report for college project
result management system report for college projectresult management system report for college project
result management system report for college project
Tonystark477637
 
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort ServiceCall Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
UNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and workingUNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and working
rknatarajan
 
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Christo Ananth
 
AKTU Computer Networks notes --- Unit 3.pdf
AKTU Computer Networks notes ---  Unit 3.pdfAKTU Computer Networks notes ---  Unit 3.pdf
AKTU Computer Networks notes --- Unit 3.pdf
ankushspencer015
 

Último (20)

NFPA 5000 2024 standard .
NFPA 5000 2024 standard                                  .NFPA 5000 2024 standard                                  .
NFPA 5000 2024 standard .
 
result management system report for college project
result management system report for college projectresult management system report for college project
result management system report for college project
 
Online banking management system project.pdf
Online banking management system project.pdfOnline banking management system project.pdf
Online banking management system project.pdf
 
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort ServiceCall Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
 
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptx
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptxBSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptx
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptx
 
UNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and workingUNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and working
 
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordCCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
 
(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7
(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7
(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7
 
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
 
UNIT-III FMM. DIMENSIONAL ANALYSIS
UNIT-III FMM.        DIMENSIONAL ANALYSISUNIT-III FMM.        DIMENSIONAL ANALYSIS
UNIT-III FMM. DIMENSIONAL ANALYSIS
 
Double rodded leveling 1 pdf activity 01
Double rodded leveling 1 pdf activity 01Double rodded leveling 1 pdf activity 01
Double rodded leveling 1 pdf activity 01
 
Call for Papers - International Journal of Intelligent Systems and Applicatio...
Call for Papers - International Journal of Intelligent Systems and Applicatio...Call for Papers - International Journal of Intelligent Systems and Applicatio...
Call for Papers - International Journal of Intelligent Systems and Applicatio...
 
(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7
(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7
(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7
 
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
 
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance BookingCall Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Booking
 
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
 
Water Industry Process Automation & Control Monthly - April 2024
Water Industry Process Automation & Control Monthly - April 2024Water Industry Process Automation & Control Monthly - April 2024
Water Industry Process Automation & Control Monthly - April 2024
 
AKTU Computer Networks notes --- Unit 3.pdf
AKTU Computer Networks notes ---  Unit 3.pdfAKTU Computer Networks notes ---  Unit 3.pdf
AKTU Computer Networks notes --- Unit 3.pdf
 
Thermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.pptThermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.ppt
 
Unit 1 - Soil Classification and Compaction.pdf
Unit 1 - Soil Classification and Compaction.pdfUnit 1 - Soil Classification and Compaction.pdf
Unit 1 - Soil Classification and Compaction.pdf
 

Destacado

Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
Kurio // The Social Media Age(ncy)
 

Destacado (20)

AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work
 
ChatGPT webinar slides
ChatGPT webinar slidesChatGPT webinar slides
ChatGPT webinar slides
 
More than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike RoutesMore than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike Routes
 

18 Оттенков I18n

Notas del editor

  1. Здравствуйте. Здравствуйте. Здравствуйте. Я – Алексей Кутепов и я люблю python. Работаю над переводом backoffice POS компании Revel . Компания сравнительно недавно, год назад, вышла на мировой рынок. Этот доклад будет про то, как это было. Надеюсь вам пригодится.
  2. Интернационализация. Каждый определит его по-своему. Для этой презентации под интернационализацией будем понимать набор средств и подходов для упрощения локализации. Локализация -- это процесс адаптации продукта для определённой местности. Понятие очень широкое, это не только сам перевод текста (даже на изображениях), но и единицы измерений, форматы времени, чисел, особенности восприятия цветов в разных культурах, налогообложение (у нас это одна из основных проблем). Интернационализация – это процесс облегчающий локализацию. То есть набор средств и подходов. И всё-таки я предпочёл назвать этот доклад «интернационализация», потому что большей частью мы пишем то, что позволяет автоматизировать локализацию.
  3. gettext comes from solaris catgets: The reason for this lies in the third argument of catgets: the unique message ID Neither method is a POSIX standard This all began in July 1994 Patrick D’Cruze I18n of fileutils Jim Meyering, the maintainer, asked Richard Stallman about standards and got glocale description. Jim implemented glocale with feedback from Richard Stollman, Patrick and Mitchum DSouza (catgets-like package mainteiner)
  4. Люди придумали локаль. Локаль – это набор настроек определяющий UI для данного региона, включая и язык. Number format setting Сase conversion settings Date-time format setting String collation setting Currency format setting Paper size setting Keyboard layout
  5. Люди придумали локаль. Локаль – это набор настроек определяющий UI для данного региона, включая и язык. Number format setting Сase conversion settings Date-time format setting String collation setting Currency format setting Paper size setting
  6. Но, локализация это ещё не всё. Изображения (одежда персонажей) Звуковое сопровождение Видеоряд (пролог к игре fallout видеоряд начинается с ядерного взрыва, в локализации для Японии видеоряд начинается в подземелье) Разница восприятия цветов в разных культурах (броские цвета в Корее, Японии и Китае) Расчёт налогов это тоже локализация.
  7. Ка
  8. Форматы лежат в отдельном файле formats.py в формате Transifex, о котором я расскажу дальше.
  9. Взлянем, как происходит процесс I18n на примере меня. Я помечаю строки в коде, нужно ли их переводить или нет. Затем отдаю переводчику в удобном для человека формате. Переводчик возвращает работу в том же формате. Я компилирую это всё в формат удобный для машины. И получаю локализованный продукт. Как видите, картинки остались нелокализованными, потому что gettext это не может, что и не удивительно.
  10. Это работаю я, сначала я помечаю текст, который должен быть переведен. Я нашёл этот dictionary, и ключи помечаю как неподлежащие переводу, а
  11. Это работаю я, сначала я помечаю текст, который должен быть переведен. Я нашёл этот dictionary, и ключи помечаю как неподлежащие переводу, а
  12. Translation memory – перевод слов запоминается, если встречается уже переведенные слова, то они автоматически заменяются переводом. Это экономит очень много сил переводчиков.
  13. Transifex – платный сервер переводов SaaS. Django использует формат Transifex для хранения файла форматов.
  14. Не всегда удаётся внедрить проверенные решения. Поэтому фантазируем.
  15. Полученный PO файл теперь можно скомпилировать в MO файл, удобный для использования нашей системой.
  16. Переводчики хотят контекста.
  17. Удобно составлять строки динамически, особенно в сложных системах. Английский язык позволяет конструировать предложения легче, чем, например, русский. В данном примере кажется за счёт интенсивного контекста все неоднозначности решены. Но перевод затруднён. При таком подходе невозможно изменить порядок слов, который необходим для качественного перевода.