|
|||||||
| XML Discussion and technical support for using and deploying XML applications and websites. |
![]() |
|
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
XML Translation
I load with AJAX this XML (apps.xml) which is translated (//menu/@name and app/@name) in english:
Every menu or app element has a big depth of hierarchy but here I omit it. Code:
<?xml version="1.0" encoding="UTF-8"?> <menu name="Main Menu" path=""> <menu name="Menu #1" path="classification"> <app name="Application #1" path="vehicle" /> <app name="Application #2" path="bridge" need="vehicle" /> </menu> <menu name="Menu #2" path="demolitions" /> <menu name="Menu #3" path="minefield" /> <menu name="Menu #4" path="river_cross_op" /> </menu> - 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> Thanks for your time and brain-scratching. |
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|