Search code examples
macoslocale

Add a locale in Mac OSX


I'm using gettext in a MAMP environment. I have locale files for es_ES, ca_ES, en_US and gl_ES. No problem with the first three, but for the forth, I get an error when trying to bind the locale translations files to the gl_ES language (galician in Spain). This is not a problem with apache or PHP because the others work (and in my CentOS server I have the gl_ES package and works fine)

So I realize my Mac OS X version 10.6.8 came without Galician support. That's strange because it has support to Spanish, Catalan and Euskera, the other three official languages in Spain. Some terminal to show you:

$ locale -a | grep _ES
ca_ES
ca_ES.ISO8859-1
ca_ES.ISO8859-15
ca_ES.UTF-8
es_ES
es_ES.ISO8859-1
es_ES.ISO8859-15
es_ES.UTF-8
eu_ES
eu_ES.ISO8859-1
eu_ES.ISO8859-15
eu_ES.UTF-8
$ ll /usr/share/locale/ | grep _ES
drwxr-xr-x   8 root  wheel   272B  3 dic  2010 ca_ES/
drwxr-xr-x   8 root  wheel   272B  3 dic  2010 ca_ES.ISO8859-1/
drwxr-xr-x   8 root  wheel   272B  3 dic  2010 ca_ES.ISO8859-15/
drwxr-xr-x   8 root  wheel   272B  3 dic  2010 ca_ES.UTF-8/
drwxr-xr-x   8 root  wheel   272B  3 dic  2010 es_ES/
drwxr-xr-x   8 root  wheel   272B  3 dic  2010 es_ES.ISO8859-1/
drwxr-xr-x   8 root  wheel   272B  3 dic  2010 es_ES.ISO8859-15/
drwxr-xr-x   8 root  wheel   272B  3 dic  2010 es_ES.UTF-8/
drwxr-xr-x   8 root  wheel   272B  3 dic  2010 eu_ES/
drwxr-xr-x   8 root  wheel   272B  3 dic  2010 eu_ES.ISO8859-1/
drwxr-xr-x   8 root  wheel   272B  3 dic  2010 eu_ES.ISO8859-15/
drwxr-xr-x   8 root  wheel   272B  3 dic  2010 eu_ES.UTF-8/

Regression

  • I tried the installation disks (adding language packs) but no success: they're just translations of the operating system.
  • I found this similar question, but doesn't have as much information and no good answers.
  • I came to localedef as an option, but it seems to be just for creating the .UTF-8 or similar when you already have the base file.

I have no clue on how to add galician support (or any other) to Mac OS X.

How to add a new locale in Mac OS X?


Solution

  • This should do the trick:

    cd /usr/share/locale
    sudo cp -R es_ES gl_ES
    

    Then open a new terminal session and list the locales again. Galician should be there :)