BabelFx is a localization framework with run-time injection for Flash & Flex applications. It runs independently and transparently behind the scenes. The views and components no longer have to pull localized content into themselves.
BabelFx uses Inversion-of-Control (IoC) patterns to inject localized content into targeted views. Since it pushes content, the UI controls, components, and views will never have to pull any content. This means that view components will never have any knowledge nor dependencies upon localization issues.
Sample
package com.companyx.productY.model { import flash.events.Event; import mx.collections.ArrayList; import mx.events.PropertyChangeEvent; // *************************************************** // Metadata for Localization Injection // *************************************************** [BabelFx(bundle="header")] // Inject directly into arraylist items... [BabelFx(property = "dataProvider[0].label", key = "feedbackItem")] [BabelFx(property = "dataProvider[1].label", key = "problemsItem")] [BabelFx(property = "dataProvider[2].label", key = "accountItem")] [BabelFx(property = "dataProvider[3].label", key = "preferencesItem")] [BabelFx(property = "dataProvider[4].label", key = "internetItem")] [BabelFx(property = "dataProvider[5].label", key = "helpItem")] [BabelFx(property = "dataProvider[6].label", key = "mediaTourItem")] [BabelFx(property = "dataProvider[7].label", key = "logoutItem")] [BabelFx(property = "submenu1.label", key = "submenu1Item")] [BabelFx(property = "submenu2.label", key = "submenu2Item")] [Bindable] /** * Special `constants` model with properties that are localized dynamically. * This will trigger databindings and then update dependent UI components. * */ public class Feedback { // *************************************************** // Public Constants // *************************************************** public const GIVE_FEEDBACK :String = "feedback"; public const REPORT_PROBLEM :String = "report"; public const MY_ACCOUNT :String = "account"; public const PREFERENCES :String = "preferences"; public const ADD_INTERNET :String = "internetradio"; public const HELP :String = "faqs"; public const MEDIA_TOUR :String = "tour"; public const LOGOUT :String = "logout"; public const AUTO_PLAY :String = "submenu1"; public const SMART_TUNE :String = "submenu2"; // *************************************************** // Public Properties // *************************************************** /** * DataProvider for any UI control that needs a list of FeedbackMenuItems * with localized content always auto-synchronized with the current locale. */ public var dataProvider:ArrayList; /** * Sub-menu item exposed for l10n injection */ public var submenu1:FeedbackMenuItem; /** * Sub-menu item exposed for l10n injection */ public var submenu2:FeedbackMenuItem; // *************************************************** // Constructor // *************************************************** public function Feedback() { submenu1 = new FeedbackMenuItem("", AUTO_PLAY); submenu2 = new FeedbackMenuItem("", SMART_TUNE); dataProvider = new ArrayList(); dataProvider.addItem(new FeedbackMenuItem("", GIVE_FEEDBACK)); dataProvider.addItem(new FeedbackMenuItem("", REPORT_PROBLEM)); dataProvider.addItem(new FeedbackMenuItem("", MY_ACCOUNT)); dataProvider.addItem(new FeedbackMenuItem("", "", [ submenu1, submenu2 ])); dataProvider.addItem(new FeedbackMenuItem("", ADD_INTERNET)); dataProvider.addItem(new FeedbackMenuItem("", HELP)); dataProvider.addItem(new FeedbackMenuItem("", MEDIA_TOUR)); dataProvider.addItem(new FeedbackMenuItem("", LOGOUT)); } } }
RT @as3gamegears: New: BabelFx (localization framework with run-time injection ) http://t.co/LUuSIksA #as3 #flash #gamedev