Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-23307] Windows: Localized strings in strings.xml don't handle newlines

GitHub Issuen/a
TypeBug
PriorityCritical
StatusClosed
ResolutionFixed
Resolution Date2016-05-27T18:48:20.000+0000
Affected Version/sn/a
Fix Version/sRelease 5.4.0
ComponentsWindows
Labelsn/a
ReporterJonas Bjurhult
AssigneeKota Iguchi
Created2016-04-28T11:15:17.000+0000
Updated2016-06-30T12:01:12.000+0000

Description

SDK: 5.4.0.v20160426000033 When setting the text property of a Ti.UI.label object to something containing '\n' to represent new line, the '\n' is printed in the UI instead of inserting a new line.

Attachments

FileDateSize
Screen Shot 2016-04-28 at 13.16.09.png2016-04-28T11:17:29.000+000035415
win10_test.png2016-05-27T18:37:29.000+000028269

Comments

  1. Nazmus Salahin 2016-05-02

    Hello, I am unable to reproduce this issue. When setting the text property of a Ti.UI.label a new line is printed for \n rather than '\n'. Sample String: "A long label with\n a few line breaks\n and unicode (UTF8)\n symbols such as\n a white chess piece \u2655\nand the euro symbol \u20ac\nlooks like this!\n'" [Screenshot| https://i.imgsafe.org/903d5b7.png] *app.js:*
       var win = Ti.UI.createWindow({
         backgroundColor: 'white',
         exitOnClose: true,
         fullscreen: false,
         layout: 'vertical',
         title: 'Label Demo'
       });
       
       var label = Ti.UI.createLabel({
         color:'blue',
         text: 'A long label with\n a few line breaks\n and unicode (UTF8)\n symbols such as\n a white chess piece \u2655\nand the euro symbol \u20ac\nlooks like this!\n',
         textAlign: Ti.UI.TEXT_ALIGNMENT_LEFT,
         top: 30,
         width: 300, height: 200
       });
       
       win.add(label);
       win.open();
       
    *Environment*: *Device info:* Microsoft Lumia 640 (Windows Phone 8.1) *Node.js Version:* 0.12.7 *npm Version:* 2.11.3 *Titanium SDKs:* 5.4.0.v20160429102159 *Java Development Kit Version:* 1.8.0_73 *Titanium CLI Version:* 5.0.5 *Appcelerator CLI Version:* 5.2.2 *Appcelerator Studio:* 4.5.0
  2. Jonas Bjurhult 2016-05-02

    My text is set via the i18n stings.xml, like this:
       <string name="EulaTitle">The app will use your phone position to determine your country location.\nPlease review and accept the Privacy Policy.</string>
       
    and then in my .js:
       $.upperTitle.text = L('EulaTitle');
       
  3. Nazmus Salahin 2016-05-03

    Hello, I am able to reproduce this issue when the string is defined in strings.xml file. So it seems that the issue is not related to Label but with localized string values. *Steps:* 1. Create a default classic project for windows phone. 2. Replace app.js file code with following.
       var win = Ti.UI.createWindow({
         backgroundColor: 'white',
         exitOnClose: true,
         fullscreen: false,
         layout: 'vertical',
         title: 'Label Demo'
       });
       
       var label = Ti.UI.createLabel({
         color:'blue',
         text: L('TestText'),
         textAlign: Ti.UI.TEXT_ALIGNMENT_LEFT,
         top: 30,
         width: 300, height: 200
       });
       
       win.add(label);
       win.open();
       
    3. Create strings.xml file in the folder "i18n\en". 4. Replace content of strings.xml file with following.
       <resources>
       	<string name="TestText">A long label with\n a few line breaks\n and unicode (UTF8)\n symbols such as\n a white chess piece \u2655\nand the euro symbol \u20ac\nlooks like this!\n</string>
       </resources>
       
    5. Build and run the app on Windows device. >> It is seen in the label that newline is not printed in case of '\n' rather \n is printed. [Screenshot| https://i.imgsafe.org/8160c00.png]. Thanks *Environment*: *OS :Microsoft Windows 8.1 Enterprise N *Device info:* Microsoft Lumia 640 (Windows Phone 8.1) *Node.js Version:* 0.12.7 *npm Version:* 2.11.3 *Titanium SDKs:* 5.4.0.v20160429102159 *Java Development Kit Version:* 1.8.0_73 *Titanium CLI Version:* 5.0.5 *Appcelerator CLI Version:* 5.2.2 *Appcelerator Studio:* 4.5.0
  4. Kota Iguchi 2016-05-27

    https://github.com/appcelerator/titanium_mobile_windows/pull/722
  5. Ewan Harris 2016-06-30

    Verified using: Windows 10 Pro Ti SDK: 5.4.0.v20160629063537 Appc NPM: 4.2.7-2 Appc CLI: 5.4.0-23 Appc Studio: 4.7.0.201606220541 Lumia 930: 10.0 Lumia 520: 8.1 Using the example attached the string displayed now matches what is shown on iOS. Closing ticket.

JSON Source