Hi all,
I want to introduce localization possibilities in my xsl transformations.
To do that, I created a directory "locale" with a subdirectory for each
lang "en", "es", "fr", "de" where I put xml files with translated text.
The information of the lang to use is in my data xml file.
To retrieve the good translation file, I use something like :
<xsl:variable name="labels" select="document(concat('locale/',
/*/@lang,'/test_locale.xml'))//label" />
To retrieve a label I use :
<xsl:value-of select="$labels[(_at_)id='ALabelId']"/>
My problem is when the translation file doesn't exist. I'd like to choose
a default file in this case :
If in my data file the "lang" parameter = "fr" then use the labels in file
locale/fr/test_locale.xml. If this file doesn't exist, I want to use the
file locale/en/test_locale.xml.
Is this possible and how ?
Is there a better way to implement localization ?
--
A. ROY