Support forum of the software localization tool Sisulizer


.NET, Delphi, ... - Sisulizer Localization Tool Support Home

Get in contact with the makers of Sisulizer.
Our forum is open for all questions around Sisulizer from customers and prospects.
Don't hesitate to register and ask. The Sisulizer team will answer ASAP.

Search     Help Home Sisulizer Website Download
Search by username
Not logged in - Login | Register 

 Moderated by: Sisusupport, Renate.Reinartz, Markus.Kreisel, Ilkka.Salmenius
New Topic Reply Printer Friendly
Translation of Android Resource xml files - XML escape characters - Wish list for software localization tool - Technical Support (You need to be registered at the forum to write) - .NET, Delphi, ... - Sisulizer Localization Tool Support
AuthorPost
 Posted: Thu Dec 17th, 2015 06:58 am
PM Private Upload Quote Reply
Impact
Member
 

Joined: Wed Jul 11th, 2007
Location: Vienna, Austria
Posts: 90
Status: 
Offline
Hi,

I include Android XML Resource files as XML Sources in a Sisulizer Project. Sisulizer doesn't escape the special Character ' (Apostrophe) in generated files. This brakes the build process in Android Studio.

-> is there a switch/option to enable escaping of ' (apostrophe) in xml sources?

Example:

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <string name="close_app">AAAAA</string>
</resources>

Translated
<?xml version="1.0" encoding="utf-8"?>
<resources>
    <string name="close_app">'</string>
</resources>

It should be possible to generate:
<?xml version="1.0" encoding="utf-8"?>
<resources>
    <string name="close_app">&apos;</string>
</resources>

kind regards
impact

Back To Top PM Private Upload Quote Reply

 Posted: Thu Dec 17th, 2015 03:45 pm
PM Private Upload Quote Reply
Ilkka.Salmenius
Administrator


Joined: Wed Aug 8th, 2007
Location: Tokyo, Japan
Posts: 2011
Status: 
Offline
Both

apos

and

'

are valid XML.

Our XML parser works this way. Some characters such as < & must always be encoded in the element data. Other characters can or cannot be encoded. The parser uses encoding if the original element contains encoded character. If the original does not contain the character at all or if it is plain text then XML parses does not use encoding.

You can solve this by using encoded ' in the orignal XML file.

Why doesn't Android Studio accept valid XML?

Ilkka



____________________
http://www.sisulizer.com - Three simple steps to localize
Back To Top PM Private Upload Quote Reply

 Posted: Thu Dec 17th, 2015 03:48 pm
PM Private Upload Quote Reply
Ilkka.Salmenius
Administrator


Joined: Wed Aug 8th, 2007
Location: Tokyo, Japan
Posts: 2011
Status: 
Offline
-> is there a switch/option to enable escaping of ' (apostrophe) in xml sources?

Can you send me your SLP and Android resource file. I figure out a solution.

Ilkka



____________________
http://www.sisulizer.com - Three simple steps to localize
Back To Top PM Private Upload Quote Reply

 Posted: Thu Dec 17th, 2015 03:55 pm
PM Private Upload Quote Reply
Ilkka.Salmenius
Administrator


Joined: Wed Aug 8th, 2007
Location: Tokyo, Japan
Posts: 2011
Status: 
Offline
Can you also tell me what part of build process does unencoded ' break in Android Studio. I would like try it. What verison of Android Studio do you use?

Ilkka



____________________
http://www.sisulizer.com - Three simple steps to localize
Back To Top PM Private Upload Quote Reply

 Posted: Thu Dec 17th, 2015 10:59 pm
PM Private Upload Quote Reply
Ilkka.Salmenius
Administrator


Joined: Wed Aug 8th, 2007
Location: Tokyo, Japan
Posts: 2011
Status: 
Offline
I implemented this feature. Starting from the next build (359) you can force Sisulizer to use encoded items for all those five predefined character. See the screenshot.

Ilkka

Attachment: Untitled.png (Downloaded 30 times)



____________________
http://www.sisulizer.com - Three simple steps to localize
Back To Top PM Private Upload Quote Reply

 Posted: Mon Dec 21st, 2015 09:19 am
PM Private Upload Quote Reply
Impact
Member
 

Joined: Wed Jul 11th, 2007
Location: Vienna, Austria
Posts: 90
Status: 
Offline
Hi Ilkka,

thank you. Do you still need some information from me (sisulizer project/infos about android studio)?

Back To Top PM Private Upload Quote Reply

 Posted: Mon Dec 21st, 2015 02:10 pm
PM Private Upload Quote Reply
Ilkka.Salmenius
Administrator


Joined: Wed Aug 8th, 2007
Location: Tokyo, Japan
Posts: 2011
Status: 
Offline
No I don't need them.



____________________
http://www.sisulizer.com - Three simple steps to localize
Back To Top PM Private Upload Quote Reply

 Posted: Wed Mar 2nd, 2016 08:07 am
PM Private Upload Quote Reply
Impact
Member
 

Joined: Wed Jul 11th, 2007
Location: Vienna, Austria
Posts: 90
Status: 
Offline
Hi,

I just tried it with the current build. Escaping works fine.

There is still one glitch with Android Studio.
Building a Project with a Sisulizer-generated resource-file (e.g. strings.xml) that contains an Apostroph in the translation breaks the build. Android Studio returns an error: "Apostrophe not preceded by \ (in Je n'aime pas)"

Translated source is:


Je n'aime pas


So the Android studio needs the ' to be preceeded by backslash (\).

This is a special Android-Studio requirement, and not a general XML feature. Do you want to support this use case?

At this moment the translator has to know, that every apostrpohe has to be preceeded by \ (or the whole string has to be included in ""). This is a source of errors.

Back To Top PM Private Upload Quote Reply

 Posted: Wed Mar 2nd, 2016 01:09 pm
PM Private Upload Quote Reply
Ilkka.Salmenius
Administrator


Joined: Wed Aug 8th, 2007
Location: Tokyo, Japan
Posts: 2011
Status: 
Offline
Does it work if you check "Encode all predefined characters" check box in XML source. Then the translation would not use ' character but be like

Je n'aime pas

Would that work?

Ilkka



____________________
http://www.sisulizer.com - Three simple steps to localize
Back To Top PM Private Upload Quote Reply

 Posted: Thu Mar 3rd, 2016 02:08 pm
PM Private Upload Quote Reply
Impact
Member
 

Joined: Wed Jul 11th, 2007
Location: Vienna, Austria
Posts: 90
Status: 
Offline
the error I described is generated AFTER checking "Encode all predefined characters" in the source.

the generated xml fragment looks like:
<string name="dialog_like_button_like_it">J&apos;aime</string>


but Visual studio outputs

Error:(2) Apostrophe not preceded by \ (in J'aime)

Back To Top PM Private Upload Quote Reply

 Posted: Thu Mar 3rd, 2016 02:54 pm
PM Private Upload Quote Reply
Ilkka.Salmenius
Administrator


Joined: Wed Aug 8th, 2007
Location: Tokyo, Japan
Posts: 2011
Status: 
Offline
Thank you verifying this. Android Studio indeed requires its own "XML" format :-)

I will add and option to XML source to generate Android Studio compatible XML.

Ilkka



____________________
http://www.sisulizer.com - Three simple steps to localize
Back To Top PM Private Upload Quote Reply

 Posted: Thu Mar 3rd, 2016 03:02 pm
PM Private Upload Quote Reply
Impact
Member
 

Joined: Wed Jul 11th, 2007
Location: Vienna, Austria
Posts: 90
Status: 
Offline
cool. thx

Back To Top PM Private Upload Quote Reply

 Posted: Fri Mar 18th, 2016 01:20 pm
PM Private Upload Quote Reply
Ilkka.Salmenius
Administrator


Joined: Wed Aug 8th, 2007
Location: Tokyo, Japan
Posts: 2011
Status: 
Offline
Done. Starting from the next build (360) there is a new source: Android resource file. When you select a .xml file Sisulizer now prompts if you want to use the standard XML source or Android resource source. Select the later. The source knows the structure of the Anndroud resource XML fiel and there is no need to "teach" the structure to Sisulizer.

Ilkka



____________________
http://www.sisulizer.com - Three simple steps to localize
Back To Top PM Private Upload Quote Reply

Current time is 03:39 pm  
.NET, Delphi, ... - Sisulizer Localization Tool Support > Technical Support (You need to be registered at the forum to write) > Wish list for software localization tool > Translation of Android Resource xml files - XML escape characters



WowUltra modified by Sisulizer Copyright © 2007-18 by Jim Hale - Based on WowBB Copyright © 2003-2006 Aycan Gulez

Impress - Privacy statement

Sisulizer software localization tool - Three simple steps to localize