PocketByte / LocoLaser

Localization tool to import localized strings from external source to your project.
Apache License 2.0
31 stars 1 forks source link

HTML tags corruption #1

Closed Akkell closed 3 years ago

Akkell commented 7 years ago

1. Bare HTML tags corruption. GoogleSheet: key1 <b>Hello</b>

Android:

2. HTML tags wrapped into <![CDATA[ ...raw html... ]]> GoogleSheet:

key1    <![CDATA[
<p>This is a html-formatted string with <b>bold</b> and <i>italic</i> text</p>
<p>This is another paragraph of the same string.</p>
]]>

Android:

KamiSempai commented 7 years ago

LocoLaser escapes characters so in the TextView will be shown the same text as in Sheet. Also new line characters replaces with "\n". So described behaviour is expected behawiour. I understand that in some cases the escaping not needed. It should be solved in the future by additional row attributes that defines how to handle such cases. Until it done, if you want to use HTML formated string you should use programmaticaly way someTextView.setText(Html.fromHtml(someString));

KamiSempai commented 3 years ago

CDATA bracers can be added by using Meta Data.
To do it Google Sheet should contain meta data column with following value "xml-cdata=true".
Unfortunately there is no easy way to read CDATA bracers from strings.xml. So required metadata can be provided only from Google Sheet.