JAVAGALICIAN is an extension for the Java Virtual Machine which adds support for the Galician locales (gl, gl_ES). Some quick facts:


The problem

Take this code, which should output a date formatted in Galician language...

    final Locale glLocale = new Locale("gl","ES");        // language = Galician, country = Spain
    final String myDateStr = DateFormat.getDateInstance(DateFormat.FULL, glLocale).format(myDate);

...but have a look at its output:

Monday, September 21, 2009

That's not Galician! And this happens because, although we have specified a 'gl_ES' locale to be used, this locale does not exist in the standard Java VM... and so what we get is a standard English format.

The solution

Java SE 6 (JDK 1.6.0) added to its API a hierachy of Service Provider Interfaces (SPIs) that enable the easy addition of localization-related features to the Java Virtual Machine. This SPIs extend the java.util.spi.LocaleServiceProvider class and cover the following features:

FeatureSPILocalized JAVAGALICIAN examples
Date formattingjava.text.spi.DateFormatProviderxoves 31 de decembro de 2009 23H59' CET
Date format symbolsjava.text.spi.DateFormatSymbolsProviderxaneiro, venres
Number formattingjava.text.spi.NumberFormatProvider2.312.600,35, 2.312.600,35  200
Decimal format symbolsjava.text.spi.DecimalFormatSymbolsProvider2.312.600,35
Collation (text comparison and ordering)java.text.spi.CollatorProvider{at 363mico,  301tomo, at 363nito,  301tono}
Break iterationjava.text.spi.BreakIteratorProvider|O| 341baco|sit 372ase|sobre|o|capitel|
Locale names (country + language names)java.util.spi.LocaleNameProviderArxentina, Alema 361a, castel 341n
Time Zone namesjava.util.spi.TimeZoneNameProviderHora de ver 341n de Europa Central
Currency symbolsjava.util.spi.CurrencyNameProviderEUR,USD

ALL these localization features are covered by JAVAGALICIAN, so that it works as a complete solution to the lack of native Galician support in the JVM, making 'gl' and 'gl_ES' fully supported locales in the Java Virtual Machine.

As an example, with JAVAGALICIAN installed, the same fragment of code we saw above would output:

luns 21 de setembro de 2009


Galician language

Galician is a language spoken by more than 3 million people in the northwest of Spain, mostly in the Autonomous Region of Galicia. It is a romance language originated from Latin during the middle ages and very closely related to Portuguese, and it currently has the status of co-official in the Autonomous Region of Galicia as recognized in the Spanish Constitution, sharing this status with Castilian language (often known outside Spain as 'Spanish') and in equal rights with it within the region.

Galician is also the official language of the Government and official institutions of this Autonomous Region, it is taught in all Galician schools and used for teaching in a 50% distribution of subjects with Castilian. Several regional television channels and radio stations broadcast their contents exclusively in Galician, and several newspapers also use the language (both in bilingual and monolingual form).

Galician is studied and standardized by an official institution called Real Academia Galega (Royal Galician Academy), which promulgates norms of grammar, spelling and vocabulary, and works to promote the language.

You can read further about this topics at Wikipedia: [Galicia] [Galician language] [Real Academia Galega]

Galician locale

The standard language code for Galician language is 'gl', in accordance with the ISO 639-1 specification for language codes. Thus, Galician locales are 'gl' for language-only locale and 'gl_ES' for language+country locale.

Galician language in Java

Sun Microsystem's Java Virtual Machine has never included support for the Galician locale, although it was accepted in 2004 as RFE (Request For Enhancement) 5104387 for JDK 1.4.2 and has been a hot topic ever since.

For all this time, Java software development companies in Galicia and elsewhere working for the Galician Government or institutions, or simply focusing their software products on Galician speakers, had to develop their own solutions (often incomplete or non-standards-compliant) to work around the lack of native support for Galician in the Java Virtual Machine.