EiffelStudio Internationalization

Revision as of 01:41, 13 December 2006 by Ted (Talk | contribs) (Maintainer Guide)

Overview

Since i18n have been mostly implemented in Eiffel, Eiffel Studio is coming into the new era of internationalization. The goal of i18n integration is to provide multiple language support in Eiffel Studio and let users switch languages of the interface easily at runtime.

Steps to integrate i18n

Non-editor part

The first step concentrates on the interface of Eiffel Studio. All buttons, labels, tool tips and grids that are directly used by Eiffel Studio project.

  1. Collect all static interface strings in the system., including some context dependent strings.
    1. This is not necessary, but doing this give us better management and code quality. Only INTERFACE_NAMES knows i18n.
    2. Change all types in INTERFACE_NAMES, EB_METRIC_NAMES, CONF_INTERFACE_NAMES, WARNING_MESSAGES to be STRING_GENERAL. Caller should be adapted correspondingly.For some stings, two versions maybe needed. One for internal use, the other one for the interface,especially for strings saved as preferences and strings constants used in configure XML files.
    3. Rewrite bodies of those strings using i18n translation routines, STRING_32 instances are actually produced.
    4. Modify places using EV_CONSTANTS, make new classes if needed. e.g. EV_CONFIRMATION_DIALOG; EV_WARNING_DIALOG are not usable.
    5. Write scripts to draw strings from default.xml. "Directory", names and descriptions of preferences are also needed to be translated.
    6. Find a solution to wizards, since some of them are external excutables.
  2. Build language menus to switch language.
    1. Make interface classes locale observers so that all tools know when interface names should be reread.
  3. Solve the problems in vision2.
    1. In Chinese, menu chars are conventionally parenthesized and under scored following the menu text. This can be done by the translator.
    2. Handle "&" as both char and wchar for menu items.
    3. Fix "tab" issue for menu items.
  4. Integrate i18n .po generation tool. It has been done in i18n branch.
  5. using .po generation tool integrated ec to compile an ec in which interface names have been adapted.
  6. Use .po generation tool to generate estudio.pot file. The .po generation tool generally extracts strings that are taken as parameters of `translated' and `translated_plural' and produce .pot file.
  7. Since strings used in EiffelStudio not only come from the source code. Write scripts to extract them and merge them into estudio.pot. Strings should be extracted from: default.xml → descriptions of preferences
  8. Duplicate estudio.pot file to .po files with names of locale ids. Each .po file represents a locale. i18n library read .mo files with correct names of id. Though .po files are not necessary to have names of locale id, .mo files are one-to-one produced from .po files. So using locale ids as names of .po files is reasonable.
  9. Translators using .po editor open .po files and translate interface names to all kinds of languages.
  10. Generate .mo files using .mo generation script.

Editor part

  1. This step might be more complicated. And will be done later after the first step. Probably after 6.0 release. This step concentrates on extending the editor library to accept wide characters. Internationalization of any output directed to the editor is done in the step. Many existing tools might be affected, search tool, formatting tools etc.
  2. Encoding conversion facility is needed.

File structure

Repository

All files are stored in %EIFFEL_SRC%\Delivery\studio\lang

%EIFFEL_SRC%\Delivery\studio\lang\script

Place where scripts for generating .mo files are put. The scripts are invoked when building a delivery.

%EIFFEL_SRC%\Delivery\studio\lang\mo_files

Place to put .mo files. Those files are actually used at runtime.
Only .mo files need to be included in a delivery.

%EIFFEL_SRC%\Delivery\studio\lang\po_files

Place to put .pot file and .po files. 

Delivery

 Windows:
 %ISE_EIFFEL%\studio\lang\mo_files\*.mo
 Unix:
 /usr/share/locale/(product_version_name)/*.mo

Maintenance

General

  • .pot file is PO template file which is generated by .po generation tool. .pot file is simply untranslated file with only source entries and blank target entries.
  • .po files are the files translators actually work on. Whenever translators get a new version of .pot file, they should update .po file they are working on from the .pot file. Update is normally done by third party tools. Tools like poEdit give lists of new strings and obsolete strings. And in the full list new strings and fuzzy strings are marked in different colors by poEdit.
  • Fuzzy strings are applied when updating. msgmerge of Gettext make slightly changed strings fuzzy. When the checking of fuzzy strings is done, translators should remove fuzzy marks.
  • Obsolete strings are commented out at the end of .po files when merging. Those comments can be removed at anytime if we wish.
  • When the translation or modification is done, translators only need to commit .po file(s) that they are working on.
  • Whenever new languages are decided to add in. New .po file can be added directly in %EIFFEL_SRC%\Delivery\studio\lang\po_files. Eiffel Studio should have the ability to detect at runtime what languages are available.

Translator Guide

  • Update $EIFFEL_SRC/Delivery.
  • Download a po editor. poEdit for Windows and KBabel or gtranslator for KDE and Gnome.
  • In $EIFFEL_SRC/Delivery/studio/lang/po_files, find out the .po file(s) one should work on. Take zh_CN.po as example. Open zh_CN.po in po editor. In the po editor, there should be a command to update from pot file. Update from $EIFFEL_SRC/Delivery/studio/lang/po_files/estudio.pot within the po editor. If there is any change took place in estudio.pot, the po editor should inform. Translator fills empty entries, solve FUZZY strings or modify translated entries.
  • When the translation is done, just commit those modified po files.
  • Make sure that po file are saved in UTF-8 encoding.

Developer Guide

  • The major thing a developer should take care of is code quality. All names need to be translated should in principle be put in framework/interface_names. Whenever a string of sentence is needed in the interface, just leave it as a sentence to be translated. Be careful to SEPERATE a sentence into terms or phrases, because ways to sequence those terms again into sentence vary in different languages. Plural form should be used whenever needed. There are a lot of examples in INTERFACE_NAMES.
  • If a developer wants to take changes into effect immediately, see what a maintainer and a translator should do.

Maintainer Guide

  • Build po generation tool which is located at internal svn repository /ise_svn/trunk/Src/tools/po_generation_tool.
  • Make sure gettext and perl is installed. On windows cygwin cantains perl and gettext modules.
  • When there are new or modified strings need to be translated in the code. $EIFFEL_SRC/Delivery/studio/lang/estudio.pot should be regenerated.
 To regenerate estudio.pot, one should do:
 po_generation_tool -D $EIFFEL_SRC/Eiffel $EIFFEL_SRC/framework -o $EIFFEL_SRC/Delivery/studio/lang/estudio.pot
 On windows:
 $EIFFEL_SRC/Delivery/studio/script/build_preference_entries.bat
 On Unix:
 perl $EIFFEL_SRC/Delivery/studio/script/preference_po_extraction.pl
 msguniq -o ../po_files/estudio.pot ../po_files/estudio.pot
  • Commit the estudio.pot file to let translators to update.
  • To add a new language support, simply copy estudio.pot to LOCALE_ID.po where LOCALE_ID should be:
 Case 1: LL-RR
 Case 2: LL-SS-RR
 Case 3: LL_RR
 Case 4: LL_RR.Enc
 Case 5: LL_RR@SS  [sometimes the SS is simply variant information]
 LL is a two-letter language identifier from ISO 639-1 or, if there is none, a three-letter
 identifier from ISO 639-2/T
 RR is a two-letter country coding from ISO 3166-1, except when it is not (en-029 ('English (Carribean)') under Windows)
 SS under windows is mostly either 'Latn' or 'Cyrl'. @SS on linux is sometimes useful and sometimes meaningless
 List for reference:
       aa
       ab
       ace
       ach
       ada
       ady
       ae
       af
       afa
       afh
       af_ZA
       ain
       ak
       akk
       ale
       alg
       alt
       am
       am_ET
       an
       ang
       anp
       apa
       ar
       arc
       arn
       arp
       art
       arw
       as
       ast
       ast_ES
       ath
       aus
       av
       awa
       ay
       az
       az_IR
       ba
       bad
       bai
       bal
       ban
       bas
       bat
       be
       bej
       bem
       ber
       bg
       bh
       bho
       bi
       bik
       bin
       bla
       bm
       bn
       bn_IN
       bnt
       bo
       br
       bra
       bs
       btk
       bua
       bug
       byn
       C
       ca
       cad
       ca_ES
       ca_ES@valencian
       cai
       car
       cau
       ce
       ceb
       cel
       ch
       chb
       chg
       chk
       chm
       chn
       cho
       chp
       chr
       chy
       cmc
       co
       cop
       cpe
       cpf
       cpp
       cr
       crh
       crp
       cs
       csb
       cs_CZ
       cu
       cus
       cv
       cy
       da
       dak
       dar
       day
       de
       de_AT
       de_CH
       de_DE
       del
       den
       dgr
       din
       doi
       dra
       dsb
       dua
       dum
       dv
       dyu
       dz
       ee
       efi
       egy
       eka
       el
       el_GR
       elx
       en
       en_AU
       en@boldquot
       en_CA
       en_GB
       enm
       en@quot
       en_US
       eo
       es
       es_AR
       es_CL
       es_CO
       es_CR
       es_DO
       es_EC
       es_ES
       es_GT
       es_HN
       es_MX
       es_NI
       es_PA
       es_PE
       es_PR
       es_SV
       es_UY
       es_VE
       et
       et_EE
       eu
       eu_ES
       ewo
       fa
       fa_IR
       fan
       fat
       ff
       fi
       fil
       fiu
       fj
       fo
       fon
       fr
       fr_BE
       fr_CA
       fr_CH
       fr_FR
       frm
       fro
       frr
       frs
       fur
       fy
       ga
       gaa
       gay
       gba
       gd
       gem
       gez
       gil
       gl
       gmh
       gn
       goh
       gon
       gor
       got
       gr
       grb
       grc
       gsw
       gu
       gv
       gwi
       ha
       hai
       haw
       he
       he_IL
       hi
       hil
       him
       hit
       hmn
       ho
       hr
       hr_HR
       hsb
       ht
       hu
       hu_HU
       hup
       hy
       hz
       ia
       iba
       id
       ie
       ig
       ii
       ijo
       ik
       ilo
       inc
       ine
       inh
       io
       ira
       iro
       is
       it
       it_CH
       it_IT
       iu
       ja
       ja_JP
       jbo
       jpr
       jrb
       jv
       ka
       kaa
       kab
       kac
       kam
       kar
       kaw
       kbd
       kg
       kha
       khi
       kho
       ki
       kj
       kk
       kl
       km
       kmb
       kn
       ko
       kok
       ko_KR
       kos
       kpe
       kr
       krc
       krl
       kro
       kru
       ks
       ku
       kum
       kut
       kv
       kw
       ky
       la
       lad
       lah
       lam
       lb
       lez
       lg
       li
       ln
       lo
       lol
       loz
       lt
       lu
       lua
       lui
       lun
       luo
       lus
       lv
       mad
       mag
       mai
       mak
       man
       map
       mas
       mdf
       mdr
       men
       mg
       mga
       mh
       mi
       mic
       min
       mis
       mk
       mkh
       ml
       mn
       mnc
       mni
       mno
       mo
       moh
       mos
       mr
       ms
       mt
       mul
       mun
       mus
       mwl
       mwr
       my
       my_MM
       myn
       myv
       na
       nah
       nai
       nap
       nb
       nb_NO
       nd
       nds
       nds@NFE
       ne
       new
       ng
       nia
       nic
       niu
       nl
       nl_BE
       nl_NL
       nn
       no
       nog
       non
       nqo
       nr
       nso
       nub
       nv
       nwc
       ny
       nym
       nyn
       nyo
       nzi
       oc
       oj
       om
       or
       os
       osa
       ota
       oto
       pa
       paa
       pag
       pal
       pam
       pap
       pau
       peo
       phi
       phn
       pi
       pl
       pl_PL
       pon
       pra
       pro
       ps
       pt
       pt_BR
       pt_PT
       qu
       raj
       rap
       rar
       rm
       rn
       ro
       roa
       rom
       ru
       rup
       ru_RU
       rw
       sa
       sad
       sah
       sai
       sal
       sam
       sas
       sat
       sc
       scn
       sco
       sd
       se
       sel
       sem
       sg
       sga
       sgn
       shn
       si
       sid
       sio
       sit
       sk
       sl
       sla
       sl_SI
       sm
       sma
       smi
       smj
       smn
       sms
       sn
       snk
       so
       sog
       son
       sq
       sq_AL
       sr
       sr@ije
       sr@Latn
       srn
       srr
       ss
       ssa
       st
       su
       suk
       sus
       sux
       sv
       sv_SE
       sw
       syr
       ta
       tai
       te
       tem
       ter
       tet
       tg
       th
       ti
       tig
       tiv
       tk
       tkl
       tl
       tlh
       tli
       tmh
       tn
       to
       tog
       tpi
       tr
       ts
       tsi
       tt
       tum
       tup
       tut
       tvl
       tw
       ty
       tyv
       udm
       ug
       uga
       uk
       uk_UA
       umb
       und
       ur
       uz
       uz@Latn
       vai
       ve
       vi
       vo
       vot
       wa
       wak
       wal
       war
       was
       wen
       wo
       xal
       xh
       yao
       yap
       yi
       yo
       ypk
       za
       zap
       zen
       zh
       zh_CN
       zh_HK
       zh_TW
       znd
       zu
       zun