[TIMOB-15628] Android: i18n strings.xml lose the formatted=false attr after compiling
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | High |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2013-11-08T21:57:41.000+0000 |
Affected Version/s | Release 3.2.0 |
Fix Version/s | 2013 Sprint 23, 2013 Sprint 23 Core, Release 3.2.0 |
Components | Android |
Labels | android, androidbuild, module_android, qe-manualtest, qe-testadded, triage |
Reporter | Dan Tamas |
Assignee | Chris Barber |
Created | 2013-10-31T13:44:46.000+0000 |
Updated | 2014-11-19T18:26:30.000+0000 |
Description
I need to use this version of the sdk as it fixes some big bugs, but the strings.xml don't seem to keep the attributes - formatted="false" - so the build will fail :(
[ERROR] Failed to package application:
[ERROR]
[ERROR] /Volumes/Work/clients/tobias_group_time/TEAMWIRE/gt/build/android/res/values/strings.xml:49: error: Multiple substitutions specified in non-positional format; did you mean to add the formatted="false" attribute?
[ERROR] /Volumes/Work/clients/tobias_group_time/TEAMWIRE/gt/build/android/res/values/strings.xml:49: error: Unexpected end tag string
[ERROR] /Volumes/Work/clients/tobias_group_time/TEAMWIRE/gt/build/android/res/values-de/strings.xml:19: error: Multiple substitutions specified in non-positional format; did you mean to add the formatted="false" attribute?
[ERROR] /Volumes/Work/clients/tobias_group_time/TEAMWIRE/gt/build/android/res/values-de/strings.xml:19: error: Unexpected end tag string
@Dan, do your strings contain a single quote? Can you send me a sample strings.xml file (preferably from the i18n folder)? Can you do this soon?
Another issue seems to be that the *values-de* folder is not being created. I cleaned the project and got this:
@Chris - yes it does have a single quote. Please download the i18n folder from here (no idea how to attach it in Jira) https://www.dropbox.com/s/jh8t4al6xv6fhtb/i18n_dan_tamas.zip I cleaned all the ' in the files but it does the same. A hacky solution is to check in _build.js in generateI18N function if the string has some substitution parts and add formatted false to the node (inside the forEach loop)
(I only test for s/d/i)
We experienced the ENOENT error when we tested 3.2.x two nights ago. Project still had the default en and ja language string files in place. Removed, project built just fine. Just a reference point.
If I add after the first failed build the folder in place, and build without cleaning it will go through.
Medium ? :(
Thank you @Ingo :)
[~rborn] I did some thinking and talked about it with the other guys and we have come to the conclusion to set formatted="false" on ALL strings in strings.xml. For strings that don't have a %, it should be fine. Then we don't have to do any funky regular expressions. We are not clear yet if this is going to cause other issues, specifically with older Android target SDKs, but I suppose we'll find out soon enough. :)
Pull request: https://github.com/appcelerator/titanium_mobile/pull/4927
Not a bad idea, I guess :) But what happens with the strings that have % ? In this case we would need to have '%%' to show the % char, and this might break the ios version - just throwing questions here, didn't test it.
If a string has %, nothing happens. Nothing is formatted. You can have a bunch of % and it'll be fine. :)
Neh, ignore me, was thinking the wrong case (no formatting=false) but I have the perfect excuse: didn't drink my coffee yet :P
Verified fixed on: Mac OSX 10.9 Mavericks Titanium Studio, build: 3.2.0.201311140700 Titanium SDK, build: 3.2.0.v20131114120849 CLI: 3.2.0 Alloy: 1.3.0 Android Emulator : 2.3.3, 4.4 Localization file doesn't lose formatted=false attribute after compilation. i18n folder used from comments. Closing.