lilmer Posted June 7, 2013 Share Posted June 7, 2013 <?xml version="1.0" encoding="utf-8"?> <home> <firstHeader>Welcome to my Site</firstHeader> <firstParagraph>You are here because your not there.</firstParagraph> <secondParagraph>You are Ugly because we are beautiful</secondParagraph> <thirdParagraph>If there no ugly people then there is no beautul people.</secondParagraph> <question>Make sense right?</question> </home> How do I translate the data of the xml file to other language? Anyones have an idea? or what tools should I use? Quote Link to comment https://forums.phpfreaks.com/topic/278879-change-language-of-xml-data/ Share on other sites More sharing options...
requinix Posted June 7, 2013 Share Posted June 7, 2013 Like people languages? You find somebody fluent in both English, whatever grammar you're using there, and the language you want it translated into, then ask/hire them to translate it. You can't automate it. Quote Link to comment https://forums.phpfreaks.com/topic/278879-change-language-of-xml-data/#findComment-1434595 Share on other sites More sharing options...
lilmer Posted June 7, 2013 Author Share Posted June 7, 2013 Sorry, I think my question is wrong. I'll going to try more specifically. I'm using codeigniter and it has already have a built in function on localization, but using codeigniter it will take more and more time to translate the language each page, so if you have a 30 language and my boss said that it is not frexible if we have many sites. My boss said that we can use XML on that to change the language. (What I understand is every page has it own XML file. e.g. home.xml, about.xml etc. . and that is were all the information of the page came from). . So what really my question is, how can I change the content of each XML file to other language. . e.g. to russian. . some like you will convert the data on the XML file. or other question is, It is possible? I don't really know about XML. . Quote Link to comment https://forums.phpfreaks.com/topic/278879-change-language-of-xml-data/#findComment-1434603 Share on other sites More sharing options...
requinix Posted June 7, 2013 Share Posted June 7, 2013 You can't do it just by editing XML. There has to be some code somewhere to handle the translations. I would structure the XML like <?xml version="1.0" encoding="utf-8"?> <home> <translation lang="en-us"> <firstHeader>Welcome to my Site</firstHeader> <firstParagraph>You are here because your not there.</firstParagraph> <secondParagraph>You are Ugly because we are beautiful</secondParagraph> <thirdParagraph>If there no ugly people then there is no beautul people.</secondParagraph> <question>Make sense right?</question> </translation> <translation lang="leet"> <firstHeader>VV3|_(0/\/\3 70 /\/\`/ 5173</firstHeader> <firstParagraph>I don't have the patience to translate the rest of them</firstParagraph> <secondParagraph>An insult</secondParagraph> <thirdParagraph>Some kind of justification for you not killing yourself even though you're so ugly</thirdParagraph> <question>Is your site full of snobs or is it just you?</question> </translation> </home> Quote Link to comment https://forums.phpfreaks.com/topic/278879-change-language-of-xml-data/#findComment-1434608 Share on other sites More sharing options...
lilmer Posted June 7, 2013 Author Share Posted June 7, 2013 I would structure the XML like That is what I'm also thinking but that`s the same logic as the codeigniter built function, so if you have a bunch of language then will going to translate it several times also. I think that is the best and easy option we have. There has to be some code somewhere to handle the translations. Do you have any idea or where can I study it to know how. ? Quote Link to comment https://forums.phpfreaks.com/topic/278879-change-language-of-xml-data/#findComment-1434611 Share on other sites More sharing options...
cpd Posted June 7, 2013 Share Posted June 7, 2013 I'm pretty sure this is the second time you've asked this question and once again haven't been clear about it. Both times its appeared as thought you want to translate a document on-the-fly, think about what you're writing in future and even more so if English isn't your first language. The better we understand, the better we can help. Regarding your question: requinix's answer is the best you'll get. When someone sends a request to your server for the first time, set a default language to use - you could potentially set it based on the IP origin although this will be somewhat inaccurate. Store the language in a cookie for future use (Assuming you've got permission. If not, just set a session). Then overwrite the cookie/session each time they select a new language. You can then retrieve the content from your XML file based on the language they have selected, format the text however and serve up the formatted content. Client Server FileSystem | | | | First Request | | |------------------>| | | SetDefaLang | | | | | | GetXMLContent | | |------------------>| | | | | | Content | | |<------------------| | | | | SelectLang | | | | |SendContentWithCookie | |<------------------| | | | | | | | |SecReqWithLangCookie | |------------------>| | | UseCookieToGetContent | | | | Quote Link to comment https://forums.phpfreaks.com/topic/278879-change-language-of-xml-data/#findComment-1434640 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.