Translate .lang or xml

Hello, I need some help to translate a file but I can’t figure it out.

it can be on .lang or .xml file.


<?xml version="1.0" encoding="UTF-8"?>
					<ad_name_error>Please enter a name for the Advertisment</ad_name_error>
<ad_code_error>Error : Please enter a code for the Advertisement</ad_code_error>
<ad_exists_error1>Advertisement does not exist</ad_exists_error1>
<ad_exists_error2>Error : Advertisement with this name already exist</ad_exists_error2>
<ad_add_msg>Advertisment was added succesfully</ad_add_msg>
<ad_msg>Ad Has Been </ad_msg>
<ad_update_msg>Advertisment has been Updated</ad_update_msg>
<ad_del_msg>Advertisement has been Deleted</ad_del_msg>
<ad_placment_delete_msg>Placement has been Removed</ad_placment_delete_msg>
<ad_placement_err1>Placement already exists</ad_placement_err1>
<ad_placement_err2>Please Enter a name for the Placement</ad_placement_err2>
<ad_placement_err3>Please Enter a Code for the Placement</ad_placement_err3>
<ad_placement_msg>Placement has been Added</ad_placement_msg>
<cat_img_error>Please Upload JPEG, GIF or PNG image only</cat_img_error>
<cat_exist_error><![CDATA[Category doesn&#8217;t exist]]></cat_exist_error>
<cat_add_msg>Category has been added successfully</cat_add_msg>
<cat_update_msg>Category has been updated</cat_update_msg>
<grp_err><![CDATA[Group Doesn&#8217;t Exist]]></grp_err>
<grp_fr_msg>Group has been set as featured</grp_fr_msg>

How do I translate something like this, without having to select each individual string at a time?

CDDATA and can’t be translated.

basicly I need to translate what is in white only!

Install an intern who speaks the languages and tell them to translate it. That’s how it’s usually done.

1 Like

Hi! thanks for the tip. Apparently they used to do it with Microsoft Azure. But that thing is a pain and I can’t get my mind around it. I wish I could just install a plugin on VScode and do it. Or use some kind of software for this.

If it were in .po format, you might get some tooling around it, but this looks like some custom format. And a highly inappropriate use of XML at that (XML documents should fit a schema; you don’t just surround arbitrary identifiers with angle brackets)

1 Like

Yes, I could also work with this .lang file:

Which goes like this:

I’d suggest writing a one-liner to turn that json into a java .properties file, using the Resource Bundle naming format for each translation you do. There’s likely better IDE tools around those, such as flagging when you have a missing translation. I don’t know for sure, L10N is really not my bag.

99% of the work is still going to be someone translating by hand. I suppose you could use Google translate, but the results from that tend to be hilarious.

1 Like

ahaha, not very worried about the translation result as we can easily replace each string that doesn’t sound so well.

I’ll be pretty happy just if I can translate it without screwing up the code.

Thank you Chuck, I’ll try to check your solution as soon as possible.

Hi chuck, I just realized that If I change the Text rows in the database, the language will be correctly translated. Problem is, by myPHPadmin I can only change one row at a time. Do you know how to change all of them at the same time? any software for that?
I tried exporting to XML, CSV, etc and doing the changes on those and then importing back, but it always gives some error when importing.

I don’t see how you’d do more than one translation at a time, so I guess I’m not entirely sure what you’re trying to do. Does sound like you’d need a custom app for it though.