Ubuntu e la configurazione dei locales


Sto usando il plugin smarty gettext per internazionalizzare smak e che usa smarty come templare manager. Smarty gettext si basa su gettext (lo standard de facto per l'internazionalizzazione delle applicazioni software mediante file .po). Gettext a sua volta si basa sui locales di sistema.
Come aggiungo un locale al sistema in ubuntu?

Il metodo per aggiungere un locale al sistema è diverso da quello usato su debian.

Per aggiungere il supporto alla lingua romena (limba romana) ho fatto cosi:

ho verificato se il pacchetto è gia installato nel sistema:
$ sudo cat /var/lib/locales/supported.d/local 
en_US.UTF-8 
UTF-8 en_US 
ISO-8859-1 
it_IT.UTF-8 
UTF-8 
it_IT 
ISO-8859-1
non era installato.
Ho verificato che fosse un locale supportato
$ sudo cat /usr/share/i18n/SUPPORTED | grep RO 
ro_RO.UTF-8 UTF-8 
ro_RO ISO-8859-2
Ho installato il locale:
$ sudo locale-gen ro_RO
Ho verificato che si fosse installato
$ sudo cat /var/lib/locales/supported.d/local 
en_US.UTF-8 UTF-8
en_US ISO-8859-1
it_IT.UTF-8 UTF-8
it_IT ISO-8859-1
ro_RO.UTF-8 UTF-8
ro_RO ISO-8859-2
Ho riconfigurato il pacchetto locales:
$ sudo dpkg-reconfigure locales Generating locales... en_AU.UTF-8... up-to-date en_BW.UTF-8... up-to-date en_CA.UTF-8... up-to-date en_DK.UTF-8... up-to-date en_GB.UTF-8... up-to-date en_HK.UTF-8... up-to-date en_IE.UTF-8... up-to-date en_IN.UTF-8... up-to-date en_NZ.UTF-8... up-to-date en_PH.UTF-8... up-to-date en_SG.UTF-8... up-to-date en_US.ISO-8859-1... up-to-date en_US.UTF-8... up-to-date en_ZA.UTF-8... up-to-date en_ZW.UTF-8... up-to-date it_CH.UTF-8... up-to-date it_IT.ISO-8859-1... up-to-date it_IT.UTF-8... up-to-date ro_RO.ISO-8859-2... up-to-date ro_RO.UTF-8... up-to-date Generation complete.
Ho configurato i miei script php per caricare il plugin smarty-gettext e ho creato questo albero di directory all'interno del progetto php:
damko@smoke:~/projects/dam/correnti/smak$ tree locale locale |-- en_US | `-- LC_MESSAGES | |-- header1280.mo | |-- header1280.po | |-- smartybook.mo | `-- smartybook.po |-- it_IT | `-- LC_MESSAGES | |-- header1280.mo | `-- header1280.po `-- ro_RO `-- LC_MESSAGES |-- header1280.mo `-- header1280.po
i file .po e .mo sono rispettivamente i file testuali e binari contenenti le traduzioni.

Comments

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.
  • Internal paths in double quotes, written as "internal:node/99", for example, are replaced with the appropriate absolute URL or relative path.

More information about formatting options

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
Image CAPTCHA
Enter the characters shown in the image.