Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

The locale string ("en_US") for the application is set in config.js, and can be retrieved anywhere in the application by calling Titanium.App.Properties.getString('locale'). However, for convenience, the dictionary is added to the facade which should be accessible by every controller in the application. The proper way to implement text anywhere throughout the application is to write app.localDictionary.translatedTextStringKey.

Stylizing the Application

Styling in the application is managed through a javascript file in the Resources root of the project called "style.js". The "styles" object in the file is attached to the facade that's implemented and shared in every controller in the application, so it's easy to create and implement new styles as needed.

In titanium, when creating new "View" objects, or any UI object, a 'create' method accepts an object containing style attributes (and sometimes value attributes). The style.js creates the foundation for the object to be passed into the create method, which can be appended if additional values need to be passed in at creation time. For example:

In style.js:
titleLabel: {
color: '#000'
}

In implementation:
var titleLabelOptions = app.styles.titleLabel;
var titleLabelOptions.text = "Title Text";
var titleLabel = Titanium.UI.createLabel(titleLabelOptions);
}