[ALOY-1052] Alloy: Support use of L in XML proxy elements
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Medium |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2014-07-03T14:28:30.000+0000 |
Affected Version/s | n/a |
Fix Version/s | Alloy 1.5.0 |
Components | I18N, XML |
Labels | alloy, proxy, qe-manualtest, view, xml |
Reporter | Fokke Zandbergen |
Assignee | Feon Sua Xin Miao |
Created | 2014-06-11T06:51:33.000+0000 |
Updated | 2014-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
File | Date | Size |
---|---|---|
ios.png | 2014-07-02T22:26:02.000+0000 | 40259 |
iOS Simulator Screen shot 11 Jun 2014 08.45.36.png | 2014-06-11T06:51:33.000+0000 | 21807 |
l.zip | 2014-06-11T06:51:33.000+0000 | 5900757 |
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".
[~sliang], I know it's confusing, but for [
BarItemType
](http://docs.appcelerator.com/titanium/latest/#!/api/BarItemType) it *is*title
, nottext
. And as my example (project) shows it's not working. So please have another look ;)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.
Not so fast [~sliang] :) I don't see a reason why Alloy couldn't compile
<Label title="L('foo')" />
in a<TabbedBar>
totitle: L('foo')
instead oftitle: "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.changed type to New Feature
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
PR merged
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.