Sunday, 04 September 2011 14:48
As part of our effort to support the Spanish JomSocial platform, we've needed to solve the List of Countries subject. In this post, we present how you can apply the same fix.
First of all, there's only a list of countries in JomSocial. The critical file countries.xml is located at components/com_community/libraries/fields. And it's in English.
The file has a simple XML format:
<?xml version="1.0" encoding="utf-8"?>
<jomsocial>
<countries>
<country>
<name>Afghanistan</name>
<code>AF</code>
...
Now, the problem is to get a proper Spanish list of countries with a similar coding. There's a standard for this: ISO_3166-1. And it has the same coding! Perfect! (You may ask why JomSocial does not use just the original XML... I guess it may be a copyright issue).
Next step, a XSLT conversion to convert the new XML. As always, there's a catch. It's not only an XML conversion between formats. The original xml has all names with uppercase, and JomSocial publishes a capitalized list. The planets are in our side, we get a handy library to format the names.
At the end, we build a new ISO_3166-1 compliant Spanish list of countries; and we can happily publish it to have a perfect Spanish Jomsocial.
In case you want to just publish the Spanish list of countries and save the coding stuff, here you can download the file: iso_3166-1_list_es-jomsocial-countries.xml.zip
UPDATE JomSocial 2.4The new version has multi-language support. The list of countries must be published as countries_es_ES.xml in components/com_community/libraries/fields/. (Thank you, Fernando Ipabel !)