Details
-
Type:
Bug
-
Status: Closed
-
Priority:
High
-
Resolution: Fixed
-
Affects Version/s: None
-
Fix Version/s: 2013 Sprint 16, Release 3.1.2, Release 3.2.0
-
Component/s: Alloy
-
Labels:
-
Environment:
Titanium SDK 3.1.2.v20130806034554
Alloy 1.2.0-alpha6
Appcelerator Studio 3.1.2.201308021524
CLI 3.1.1
Node 0.10.13
-
Story Points:8
Description
Problem description
Specifying a String localized in the Styles .tss, Appclerator Studio marks it as an error (unexpected token "L").
1. Create a new Alloy project
2. Edit views/index.xml
<Alloy>
|
<Window>
|
<!-- Localization via XML attribute -->
|
<Label class="header">via XML attribute:</Label>
|
<Label text="L('hello_world')"/>
|
|
<!-- Localization via TSS -->
|
<Label class="header">via TSS:</Label>
|
<Label id="viaTss"/>
|
|
<!-- Localization via JS code in controller -->
|
<Label class="header">via controller:</Label>
|
<Label id="viaController"/>
|
</Window>
|
</Alloy>
|
3. Edit styles/styles.tss
'Label': {
|
top: '5dp',
|
color: '#222',
|
font: {
|
fontSize: '42dp',
|
fontWeight: 'bold'
|
},
|
height: Ti.UI.SIZE,
|
width: Ti.UI.SIZE,
|
textAlign: 'center'
|
}
|
|
'.header': {
|
top: '30dp',
|
color: '#a00',
|
font: {
|
fontSize: '24dp',
|
fontWeight: 'normal'
|
}
|
}
|
|
'#index': {
|
backgroundColor: '#fff',
|
fullscreen: false,
|
exitOnClose: true,
|
layout: 'vertical'
|
}
|
|
'#viaTss': {
|
text: L('hello_world')
|
}
|
|
4. Edit controllers/index.js
$.viaController.text = L('hello_world');
|
|
$.index.open();
|
Result: Studio is showing two error markings in the styles/index.tss - the first on the first line ('Cannot recover from the syntax error'), the second on the localization line (unexpected token "L").