p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


Go Back   p2p.wrox.com Forums > XML > XML
I forgot my password Register Now
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
XML General XML discussions.

Welcome to the p2p.wrox.com Forums.

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.

Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old November 6th, 2009, 04:47 PM
Authorized User
Points: 48, Level: 1
Points: 48, Level: 1 Points: 48, Level: 1 Points: 48, Level: 1
Activity: 5%
Activity: 5% Activity: 5% Activity: 5%
 
Join Date: Aug 2009
Posts: 11
Thanks: 3
Thanked 0 Times in 0 Posts
Default 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>
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>
What do you say?

Thanks for your time and brain-scratching.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
XML Schema translation w/ included schemas elliottg XSLT 2 May 16th, 2008 05:14 PM
WordprocessingML 2 XML Translation ROCXY XSLT 3 July 11th, 2007 05:47 AM
XML to XML "Selective" translation : Need Help charleshua XSLT 4 November 12th, 2006 05:22 AM
java to C# translation vinny4545 ASP.NET 1.0 and 1.1 Professional 0 July 2nd, 2004 08:19 PM
Code translation gbaker BOOK: Beginning Java 2 3 December 3rd, 2003 11:08 AM



All times are GMT -4. The time now is 07:35 PM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
© 2008 Wiley Publishing, Inc