GNU Internationalization Presentation

3,012 views

Published on

A brief talk I gave to a small group of developers introducing GNU gettext and various localization topics.

Published in: Business, Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
3,012
On SlideShare
0
From Embeds
0
Number of Embeds
41
Actions
Shares
0
Downloads
74
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide
  • GNU Internationalization Presentation

    1. 1. GNU Internationalization and localization -Joe Turner 8 March 2007
    2. 2. Agenda <ul><li>What is i18n, l10n, and a locale? </li></ul><ul><li>Linux and l10n </li></ul><ul><li>The GNU process </li></ul><ul><li>Programmers’ View of the Process </li></ul><ul><li>Translator’s View </li></ul>05/28/09 - Joe Turner
    3. 3. Internationalization (i18n) <ul><li>Internationalization is the process of planning and implementing products and services so that they can easily be adapted to specific local languages and cultures, a process called localization . </li></ul><ul><li>Internationalization comes in several variants: </li></ul><ul><ul><li>Monolingual internationalization - Enables the creation of localized versions of a product, where each localized version supports only its target locale. This is no longer sufficient for business requirements. </li></ul></ul><ul><ul><li>Internationalization for multilocalization - Supports localization and data processing for multiple locales, where the actual locale is selected on execution of the product or at runtime. </li></ul></ul><ul><ul><li>Multilingualization - Enables data processing and display in multiple languages and locales simultaneously, for example, mixing Chinese and Arabic text in a single document. </li></ul></ul>05/28/09 - Joe Turner
    4. 4. Localization (L10n) <ul><li>Localization is the process of adapting software for a particular country or region; The adaptation of a product, application or document content to meet the language, cultural, and other requirements of a specific target market. </li></ul><ul><li>Examples of Localization: </li></ul><ul><ul><li>Translation of the user interface and documentation into a different language. </li></ul></ul><ul><ul><li>Altering some format fields in resource files according to the locale conventions, for example, changing a date format from mm/dd/yy to yy/mm/dd. </li></ul></ul><ul><ul><li>Adding code modules that implement locale-specific functionality, such as an input method editor for Japanese or a module that calculates Hebrew calendar dates. </li></ul></ul>05/28/09 - Joe Turner
    5. 5. Locale <ul><li>A locale is a set of parameters that defines the user's language, country and cultural rules. </li></ul><ul><li>A locale is a specific geographical, political, or cultural region. It is usually identified by a combination of language and country, for example, en_US represents the locale US English. </li></ul><ul><ul><li>es is Spanish; es_MX is Mexican Spanish </li></ul></ul><ul><ul><li>pt is Portuguese, pt_BR is Brazilian Portuguese </li></ul></ul><ul><ul><li>en is English; en_US is US English </li></ul></ul>05/28/09 - Joe Turner
    6. 6. Linux and L10n <ul><li>The Linux l10n software architecture is based on the GNU “gettext” tool suite, together with a range of gettext compatible translator’s tools such as KBabel, PO-Edit, GTranslator and others. </li></ul><ul><li>Gettext allows identifying translatable strings in the Linux source code and extracting them into a format suitable for KBabel and the other l10n tools. This l10n architecture is shared by the majority of open-source projects, forming the de-facto standard in open-source related l10n. </li></ul><ul><li>The l10n “market” of gettext is organized as groups of volunteers from the target language countries. Most of these volunteers are university students who are using the software for their own purposes. </li></ul>05/28/09 - Joe Turner
    7. 7. 05/28/09 - Joe Turner Linux l10n Process
    8. 8. Linux l10n Process 05/28/09 - Joe Turner xgettext msgmerge msgfmt Professional Translator My_Application.mo Java Sources keys.pot C++ Sources es_MX.po fr.po pt_br.po en.po
    9. 9. GNU gettext <ul><li>Included with glibc </li></ul><ul><li>Supports: C, C++, PHP, Java, Others </li></ul><ul><li>Utilities: </li></ul><ul><ul><li>gettext </li></ul></ul><ul><ul><li>msgmerge </li></ul></ul><ul><ul><li>msgfmt </li></ul></ul>05/28/09 - Joe Turner
    10. 10. Users’ View <ul><li>$LANG environment variable points to native language: </li></ul><ul><ul><li>$ echo $LANG </li></ul></ul><ul><ul><li>en_US.UTF-8 </li></ul></ul><ul><li>Applications set locale and pick up the translation files. </li></ul>05/28/09 - Joe Turner
    11. 11. Where are the files? <ul><li>gettext works by expecting a locale directory where all of the translated strings are kept, in the following structure: </li></ul><ul><li>/locale (/usr/share/locale) </li></ul><ul><ul><li>/en <-language code </li></ul></ul><ul><ul><ul><li>/LC_MESSAGES </li></ul></ul></ul><ul><ul><ul><li>messages.po </li></ul></ul></ul><ul><ul><ul><li>messages.mo </li></ul></ul></ul>05/28/09 - Joe Turner
    12. 12. Programmers’ Role <ul><li>Mark text that needs to be translated for each shared object </li></ul><ul><li>Example: </li></ul><ul><ul><li>#include <libintl.h> </li></ul></ul><ul><ul><li>printf(gettext(“temperature :%d ”), temp); </li></ul></ul>05/28/09 - Joe Turner
    13. 13. Special Cases <ul><li>static const char *messages[] = </li></ul><ul><li>{ </li></ul><ul><li>&quot;some very meaningful message&quot;, </li></ul><ul><li>&quot;and another one&quot; </li></ul><ul><li>}; </li></ul><ul><li>const char *string; </li></ul><ul><li>... </li></ul><ul><li>string = index > 1 ? &quot;a default message&quot; : messages[index]; fputs (string); </li></ul><ul><li>... </li></ul>05/28/09 - Joe Turner
    14. 14. Special Cases <ul><li>#define gettext_noop(String) (String) </li></ul><ul><li>static const char *messages[] = { </li></ul><ul><li>gettext_noop (&quot;some very meaningful message&quot;), gettext_noop (&quot;and another one&quot;) </li></ul><ul><li>}; </li></ul><ul><li>const char *string; </li></ul><ul><li>... </li></ul><ul><li>string = index > 1 ? gettext (&quot;a default message&quot;) : gettext (messages[index]); </li></ul><ul><li>fputs (string); </li></ul><ul><li>... </li></ul><ul><li>} </li></ul>05/28/09 - Joe Turner
    15. 15. Plural Forms <ul><li>English: </li></ul><ul><ul><li>I have 1 apple. </li></ul></ul><ul><ul><li>I have 2 apples. </li></ul></ul><ul><li>C/English: </li></ul><ul><ul><li>if (n==1) printf(“I have %d apple.”, n) </li></ul></ul><ul><ul><li>else printf (“I have %d apples.”, n); </li></ul></ul><ul><li>Other languages have multiple plural forms. Our solution: let the translator handle it. </li></ul><ul><ul><li>printf( ngettext(“I have %d apple.”, “I have %d apples.”, n), n); </li></ul></ul>05/28/09 - Joe Turner
    16. 16. Translators’ Role <ul><li>Translate the files and return them to us. </li></ul><ul><li>Several free utilities to help </li></ul>05/28/09 - Joe Turner
    17. 17. 05/28/09 - Joe Turner
    18. 18. Java Support 05/28/09 - Joe Turner

    ×