473,399 Members | 3,038 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

i18n via XSLT import?

Hi,
I have a documentation tool based on Java and XSLT that I want to add i18n
capability to. There are around 8 stylesheets that process a Source
generated by the Java code and some of the static labels across the
stylesheets are the same.

Ideally I'd like to import a set of variables into each template, and
preferably based on an XSLT parameter (the locale) but this obviously
doesn't work:

<xsl:param name="locale">lang-en_GB.xslt</xsl:param>
<xsl:import href="$locale"/>

I don't want to define the generic stylesheets as imports from the
language specific ones because then I would have 8 duplicates for each
supported langauge. So is there a suitable mechanism I can use?

Regards,

--
darren@****************public*key
davisononline.org******0xDD356B0D

Oct 22 '05 #1
3 1607
(replying to my own post here)

don't know if this is the best way to do this, but I solved it for now by
importing a stylesheet containing only parameter declarations into each of
the other stylesheets. The parameters themselves are set in the Java
code. Seems to work ok.

Regards,

--
darren@****************public*key
davisononline.org******0xDD356B0D

Oct 23 '05 #2
Darren Davison wrote:
(replying to my own post here)

don't know if this is the best way to do this, but I solved it for now by
importing a stylesheet containing only parameter declarations into each of
the other stylesheets. The parameters themselves are set in the Java
code. Seems to work ok.

Regards,

A better solution is to make your own xml document containing all
translations, like this:

i18n_en_GB.xml:

<i18n lang="en_GB">
<lang id="help_msg"> Click here if you want help</lang>
<lang id="error_msg"> An error occured</lang>
</i18n>
You can create different translation documents for each language,
now in the xsl you do this

<xsl:variable name="lang" value="'en_GB'"/>
<xsl:param name="i81n" value="document(./i18n_{$lang}.xml)"/>

And now if you want to put a help_msg somewhere you do:

<xsl:value-of select="$i18n//lang[@id='help_msg']"/>

Understand?
Oct 24 '05 #3
On Mon, 24 Oct 2005 10:56:22 +0200, Tjerk Wolterink wrote:
Understand?


I do. Thanks for the help.
--
darren@****************public*key
davisononline.org******0xDD356B0D

Oct 25 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Harry Zoroc | last post by:
I would like to treat an xsd Schema file as XML file and to display the targetNamespace and all the imports. That's it. But the following does not work. Why? I did not enter the stylesheet in the...
0
by: Laszlo Zsolt Nagy | last post by:
Hello, I wonder if there is a standard for making i18n in Python projects. I have several Python projects that are internationalized. I also have Python packages with i18n. But it is still not...
1
by: Sonu Kapoor | last post by:
Hi, I would like to use xpath with xslt. I know that this should be possible, but I dont get it ! Here is what I have tried so far: ==================================== my xml file:...
1
by: geoffblanduk_nospam | last post by:
Using Apache Tomcat 5.0.28 I'm having a problem with the xsl:import command. I have several Tomcat running on the same server (they could be different releases of code so can't share resources)....
21
by: Damian | last post by:
Hi, I'm from an ASP.NET background an am considering making the switch to Python. I decided to develop my next project in tandem to test the waters and everything is working well, loving the...
8
by: CptDondo | last post by:
I have a small, embedded app that uses a webserver to serve up pages showing status, etc. Right now all the pages are hard-coded in English. We need to provide multi-lingual support. All of...
12
by: Chris | last post by:
Hi, Just wondering if anyone out there knows if it is possible to convert a CSV to xml using XSLT? I've seen a lot of examples of xml to CSV, but is it possible to go back the other way? I...
5
by: adelhay | last post by:
Hello, I have a problem trying to internationalize a simple file in Python. the main folder is called "simple" here is the file: hello.py
4
by: Donn Ingle | last post by:
Hi, A soon-to-be happy new year to everyone! I'm 100% new to this i18n lark and my approach so far has been to create a .mo file per module in my app. My thinking was, why load one huge .mo...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.