You are currently viewing the XML section of the Wrox p2p Programmer to Programmer discussion community. This is a community of more than 40,000 computer programmers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining our free Wrox p2p community you can post your own programming questions and respond to other programmers’ questions. Registered users also don't have to see the ads that are displayed to guests. Registration is fast, simple and absolutely free so please, join today!
Join today and post to win prizes! Post more to increase your chances of being Wrox’s top poster of the month.
I want to translate this XML to many languages with these permissions:
- Only these elements must be translated //menu/@name and //app/@name
- Do not clone XML and translate it. It isn't a big waste of size, but I don't want to make a change to all XMLs
- Translations must be in separated files. Not all translations in the same file.
Any directions? I can change the whole structure of XML, if you want. No limits.
My thoughts:
- Convert all XMLs to PHPs and use gettext like this:
<menu name="<?=_('Menu #2')?>" path="demolitions" />
- instead of loading e.g. apps.xml load translator.php?apps.xml (use very tricky code to translate with gettext, elements //menu/@name and //app/@name)
- Use apps.xml with apps.french.xml included and change elements //menu/@name and //app/@name with translator.xsl.
apps.french.xml here:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<translations>
<translation name="Main Menu in french" path="">
<translation name="Menu #1 in french" path="classification">
<translation name="Application #1 in french" path="vehicle" />
<translation name="Application #2 in french" path="bridge" />
<translation name="Menu #2 in french" path="demolitions" />
<translation name="Menu #3 in french" path="minefield" />
<translation name="Menu #4 in french" path="river_cross_op" />
</translations>