Titanium JIRA Archive
Alloy (ALOY)

[ALOY-1068] Runtime error if Label's text attribute starts with L() alias in quotes

GitHub Issuen/a
TypeBug
PriorityMedium
StatusClosed
ResolutionFixed
Resolution Date2014-07-18T19:30:35.000+0000
Affected Version/sn/a
Fix Version/sAlloy 1.5.0
ComponentsI18N, XML
Labelsalloy, i18n, label, qe-manualtest, view, xml
ReporterFeon Sua Xin Miao
AssigneeFeon Sua Xin Miao
Created2014-07-02T14:58:25.000+0000
Updated2014-08-25T18:28:33.000+0000

Description

1. Use following sample

<Alloy>
	<Window>
		<Label text="L(foo)" />
	</Window>
</Alloy>

2. Build and run

Results in Alloy runtime error.
[ERROR] :  Script Error {
[ERROR] :      backtrace = "#0 () at file:///Users/fmiao/Library/Application%20Support/iPhone%20Simulator/7.1/Applications/5E942DE7-5E41-4DE0-81EF-D3CB0000304A/ALOY-1052.app/alloy.js:231";
[ERROR] :      line = 46;
[ERROR] :      message = "Can't find variable: foo";
[ERROR] :      name = ReferenceError;
[ERROR] :      sourceId = 349641088;
[ERROR] :      sourceURL = "file:///Users/fmiao/Library/Application%20Support/iPhone%20Simulator/7.1/Applications/5E942DE7-5E41-4DE0-81EF-D3CB0000304A/ALOY-1052.app/alloy/controllers/index.js";
[ERROR] :  }

Comments

  1. Feon Sua Xin Miao 2014-07-07

    PR: https://github.com/appcelerator/alloy/pull/472 Test app: https://github.com/feons/alloy/tree/ALOY-1068/test/apps/testing/ALOY-1068 Functional Test: 1. Run test app on iOS 2. No runtime error, and <Label text="L(foo)" /> should display as L(foo)
  2. Tim Poulsen 2014-07-17

    Per our discussion, we'll implement the following: Any instance of L( will be treated as a trigger to implement the localization functionality. In other words, all three of the following forms should output the i18n string value for the key 'foo'
       <Alloy>
       	<Window>
       		<Label text="L(foo)" />
       		<Label text="L('foo')" />
       		<Label textid="foo" />
       	</Window>
       </Alloy>
       
  3. Feon Sua Xin Miao 2014-07-18

    Updated PR, now all three usage mention above will output the i18n string value for the key 'foo'.
  4. Tim Poulsen 2014-07-18

    Works as expected, PR merged.
  5. Ewan Harris 2014-08-25

    Verified fix on: Mac OSX 10.9.4 Appcelerator Studio, build: 3.4.0.201408210941 Titanium SDK build: 3.4.0.v20140813022514 Titanium CLI, build: 3.4.0-dev Alloy: 1.5.0-dev iOS Device 5S (8.0b5) iOS Simulator 7.1 Ran the test app on device and simulator, all the labels display 'foo'. Closing ticket.

JSON Source