[TIMOB-20527] Android (Tooling): Support setting source for the default strings
| GitHub Issue | n/a |
|---|---|
| Type | New Feature |
| Priority | Medium |
| Status | Open |
| Resolution | Unresolved |
| Affected Version/s | n/a |
| Fix Version/s | n/a |
| Components | Tooling |
| Labels | android, cb-tooling, i18n, internationalization, parity |
| Reporter | Fokke Zandbergen |
| Assignee | Chris Barber |
| Created | 2014-02-02T18:51:41.000+0000 |
| Updated | 2020-01-30T11:28:03.000+0000 |
Description
The Titanium CLI always assumes English (
en) as the default language for an app. When using a i18n folder, you must always have en/strings.xml as well, or the default build/android/res/values/strings.xml will only contain app_name and thus give errors reporting missing strings when running the app on a non-Dutch system.
In iOS you can set the default language using:
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>nl_NL</string>
</dict>
For Android, it would be nice to have a ti.android.defaultLanguage property so you can determine the language where the CLI will look for strings for build/android/res/values/strings.xml.
Steps to reproduce:
1. Create a new Android project: ti create -p android -n strings --id test.strings -d .
2. Create a Dutch i18n strings.xml at i18n/nl/strings.xml
<?xml version="1.0" encoding="UTF-8"?>
<resources>
<string name="hello_world">Hallo wereld!</string>
</resources>
3. Build the project: ti build -p android -b
4. Check out build/android/res/values/strings.xml and build/android/res/values-nl/strings.xml and see the first only contains app_name.
Moving this improvement request to engineering for further evaluation and prioritization as I can reproduce the stated behavior.
Workaround for Alloy projects:
task("pre:load", function(event,logger) { var path = require('path'), fs = require('fs'), wrench = require('wrench'); var DEFAULT = 'nl'; // set your default locale here wrench.copyDirSyncRecursive(path.join(event.dir.project, 'i18n', DEFAULT), path.join(event.dir.project, 'i18n', 'en')); });Can we get an update on this ticket? Would be great to set a default language for android apps
pinging...
Can't be very hard. New 1st class property
<default-locale />together with some CLI logic to handle it.