Titanium JIRA Archive
Alloy (ALOY)

[ALOY-1052] Alloy: Support use of L in XML proxy elements

GitHub Issuen/a
TypeBug
PriorityMedium
StatusClosed
ResolutionFixed
Resolution Date2014-07-03T14:28:30.000+0000
Affected Version/sn/a
Fix Version/sAlloy 1.5.0
ComponentsI18N, XML
Labelsalloy, proxy, qe-manualtest, view, xml
ReporterFokke Zandbergen
AssigneeFeon Sua Xin Miao
Created2014-06-11T06:51:33.000+0000
Updated2014-08-25T17:27:56.000+0000

Description

Given the following index.xml:
<Alloy>
  <Window class="container">
    <Label text="L('foo')" top="100" />
    <TabbedBar id="planning_columns" top="200">
      <Labels>
        <Label title="L(foo)" />
        <Label title="L('foo')" />
        <Label titleid="foo" />
        <Label class="foo" />
      </Labels>
    </TabbedBar>
  </Window>
</Alloy>
Only the last <Label> of the <TabbedBar> , which has the title set using L('foo') in TSS works. The first 2 show L(foo) as titel and the 3rd one is empty, which is expected as [BarItemType](http://docs.appcelerator.com/titanium/latest/#!/api/BarItemType) doesn't support it (which of course it should, but thats a different story/ticket). I'd expect L() to work in proxy elements, just like they do in the regular elements like the first <Label> above. See the attached example project and screenshot.

Attachments

FileDateSize
ios.png2014-07-02T22:26:02.000+000040259
iOS Simulator Screen shot 11 Jun 2014 08.45.36.png2014-06-11T06:51:33.000+000021807
l.zip2014-06-11T06:51:33.000+00005900757

Comments

  1. Shuo Liang 2014-06-12

    In XML file, you can identifying a string from the locale file to some UI component. For you case, the property for label call "textid" not "titleid".
  2. Fokke Zandbergen 2014-06-12

    [~sliang], I know it's confusing, but for [BarItemType](http://docs.appcelerator.com/titanium/latest/#!/api/BarItemType) it *is* title, not text. And as my example (project) shows it's not working. So please have another look ;)
  3. Shuo Liang 2014-06-12

    Oh, I see. But Unfortunately,Not all the UI components support locale file string in XML file. Only those component, which has "textid" or "titleid" property (like Label, Button and so on), can use L() in XML file. You can check it from the document. http://docs.appcelerator.com/platform/latest/#!/api/Titanium.UI For your problem, the best option is identifying the title string in tss file, like you did in show 4.
  4. Fokke Zandbergen 2014-06-12

    Not so fast [~sliang] :) I don't see a reason why Alloy couldn't compile <Label title="L('foo')" /> in a <TabbedBar> to title: L('foo') instead of title: "L('foo')" if a regular <Label> can. So I understand right now it can't and though I don't find it documented anywhere I take it from you this is by design. So for that I have changed the ticket to a feature request because I really think it should.
  5. Shuo Liang 2014-06-13

    changed type to New Feature
  6. Feon Sua Xin Miao 2014-07-02

    PR: https://github.com/appcelerator/alloy/pull/469 Test app: https://github.com/feons/alloy/tree/ALOY-1052/test/apps/testing/ALOY-1052 Functional Test: 1. Run the test app 2. UI should look like attached screenshot
  7. Tim Poulsen 2014-07-03

    PR merged
  8. 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 Simulator 7.1 iOS Device 5S (8.0b5) Built the test app to iOS simulator and device, the UI matched the screenshot on both. Closing ticket.

JSON Source