GitHub Issue | n/a |
Type | Bug |
Priority | Medium |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2013-11-15T00:16:25.000+0000 |
Affected Version/s | Release 3.0.0 |
Fix Version/s | 2013 Sprint 18 Core, 2013 Sprint 18, 2013 Sprint 23, 2013 Sprint 23 Core, Release 3.2.0 |
Components | Android, iOS |
Labels | androidbuild, cb-verified, exalture, ios, mobilesdk, module_label, qe-testadded |
Reporter | Meenakshi Pathak |
Assignee | Chris Barber |
Created | 2013-03-05T11:58:54.000+0000 |
Updated | 2013-12-04T00:08:53.000+0000 |
Use the following xml in the i18n en strings.xml file:
<string name="share">There should be space </string>
<string name="share2"> of that thing.</string>
And use the following in app js:
var win = Ti.UI.createWindow({
layout: "vertical"
});
// build a string from the strings file that has built-in space.
var s = L("share") + "!on each side!" + L("share2");
alert(s);
The result is different in 3.0 vs 2.1.3. In 3.0, it seems all whitespaces from strings from the language file are trimmed.
The same behavior is seen in Android also.
For Android, one could use unicode \u0020 to add space
Need a workaround or fix in IOS
Also facing the same issue. We are using 3.1.0GA. This issue is happening for both Android and iOS. In Android for space we need to add \u0020 but for iOS we need to add \U0020. This workaround is also of no use, cause \u0020 is not understood in iOS.
Pull request: https://github.com/appcelerator/titanium_mobile/pull/4612
Reopening the issue as issue not fixed for android. Verified the fix with: Appc-Studio: 3.2.0.201310170829 Sdk:3.2.0.v20131017152001 alloy:1.2.2 npm:1.3.2 titanium:3.2.0 titanium-code-processor:1.0.3 Device:Google Nexus 7(v4.3),iPhone Simulator(v7.0) Xcode: 5 WhiteSpace successfully being added from i18n strings.xml file for iOS. But for android no space are being added/reflected. Code used: app.js
strings.xml file
[~pagarwal] This is fixed in the new Android build, but it hasn't been merged into master yet.
PR: https://github.com/appcelerator/titanium_mobile/pull/4781
Reopening the issue as issue is still reproducible for android. Still not getting whitespace for string when declared in strings.xml file. Tested Environment: Appcelerator Studio: 3.2.0.201311122338 SDK:3.2.0.v20131113183932 alloy: 1.3.0 acs: 1.0.7 npm: 1.3.2 titanium: 3.2.0 titanium-code-processor: 1.1.0 Xcode:5.0.2 Device: Google Nexus 7(v4.3) OS: Mac OSX 10.9
This is NOT a CLI issue. The strings are being written to the res/values/strings.xml file correctly. The problem is in the Ti.Locale.getString() function and also affects L().
It looks like native Android is trimming spaces. One workaround is to denote a space as '\u0020' in strings.xml (http://stackoverflow.com/questions/1587056/android-string-concatenate-how-to-keep-the-spaces-at-the-end-and-or-beginnin)
Pull request: https://github.com/appcelerator/titanium_mobile/pull/4970
Able to get whitespace at the end of strings from i18 strings xml file. Closing as fixed and verified. Tested Environment: Appcelerator Studio: 3.2.0.201311140721 SDK:3.2.0.v20131114184328 alloy: 1.3.0 acs: 1.0.7 npm: 1.3.2 titanium: 3.2.0 titanium-code-processor: 1.1.0 Xcode:5.0.2 Device: Iphone 5s(v7.0.2), Google Nexus7(v4.3) OS: Mac OSX 10.9