Appcelerator Blog

The Leading Resource for All Things Mobile

Alloy 1.8 relocates i18n and platform directories

4 Flares 4 Flares ×

The upcoming Appcelerator CLI 5.2.1 will include a significant update of Alloy, which is already available if you use the Titanium & Alloy CLI directly from NPM.

This also fixes the breaking change in Titanium SDK 5.2.0 that caused i18n and platform directories in Alloy Themes and Widgets to no longer be used.

Everything Alloy controls is now under ‘app’

This update changes the location of your /i18n and /platform source directories for Alloy. These used to live in your project root, just like they do for classic Titanium projects. Starting with Alloy 1.8 they are now expected to be at /app/i18n and /app/platform.

When you build your app, Alloy will generate the root /i18n and /platform directories, just like it generates the /Resources directory. Any manual change to files in these directories will be lost during the next build.

What this means for existing Alloy projects

Existing Alloy projects that already have /i18n or /platform directories in the project’s root directory that have not been generated by Alloy will fail to build until you have moved these directories into the /app directory, saying:

Detected legacy "/i18n" directory in project directory.
Please move the "/i18n" directory to "/app/i18n" for Alloy 1.8.0 or later.

Detected legacy "/platform" directory in project directory.
Please move the "/platform" directory to "/app/platform" for Alloy 1.8.0 or later.

Rest assured that Alloy will not delete these directories if they don’t contain the alloy_generated file, which they would have if they were generated.

Alloy will also warn if the generated directories are missing in your .gitignore file:

Generated "/i18n" directory is not in ignored by Git, please add it to your .gitignore

Generated "/platform" directory is not in ignored by Git, please add it to your .gitignore

What this means for new Alloy projects

When you run [appc] alloy new to upgrade a classic Titanium project to Alloy or when you create a new project using one of our Alloy templates, Alloy will move the /i18n and /platform directories into /app for you and make sure the generated directories are ignored.

Refreshing how i18n and platform directories under Themes & Widgets work (again)

With this update you can once again override i18n strings and platform resources via Alloy Themes and Widgets. Let’s refresh our memory on how that works.

When you build your app, Alloy will first delete /i18n and /platform and then generate new directories, sourcing from the following paths:

For /i18n:

  1. /app/i18n
  2. /app/themes/my-theme/i18n (overriding strings)
  3. /app/widgets/my.widget/i18n (not overriding strings)

For /platform/<platform> with <platform> being the platform you build for:

  1. /app/platform/<platform>
  2. /app/themes/my-theme/platform/<platform>

Be aware that the i18n XML files are merged, while the platform resources simply overwrite each other.

Also notice that although i18n strings from widgets come last, they won’t override existing strings. This means you can override strings from (third-party) widgets via your theme or main i18n files.

Code Strong! 🚀

4 Flares Twitter 0 Facebook 0 Google+ 4 LinkedIn 0 Email -- 4 Flares ×

4 Comments

  1. Cesar

    Hi there.

    Are you guys updating the automatic generated .gitignore file? Or should us, developers, add those lines to ignore this auto-generated folders?

    • Alloy will warn but not automatically update the .gitignore file.

  2. Michael

    Hi,

    What if we add or import modules in our project, I’m using the 5.2.2 SDK working with a module it does not work properly. I need to do the same process you explain with models?. Or I can not use modules such as ‘com.acktie.mobile.ios.qr’ for that version

    • Only the i18n and platform directories have been relocated. Please contact the maintainer of the module if it is not working for Titanium SDK 5.2.2.GA.

Comments are closed.

Sign up for updates!

Become a mobile leader. Take the first step to scale mobile innovation throughout your enterprise.
Get in touch
computer and tablet showing Appcelerator software
Start free, grow from there.
4 Flares Twitter 0 Facebook 0 Google+ 4 LinkedIn 0 Email -- 4 Flares ×