Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-20527] Android (Tooling): Support setting source for the default strings

GitHub Issuen/a
TypeNew Feature
PriorityMedium
StatusOpen
ResolutionUnresolved
Affected Version/sn/a
Fix Version/sn/a
ComponentsTooling
Labelsandroid, cb-tooling, i18n, internationalization, parity
ReporterFokke Zandbergen
AssigneeChris Barber
Created2014-02-02T18:51:41.000+0000
Updated2020-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.

Comments

  1. Ritu Agrawal 2014-02-03

    Moving this improvement request to engineering for further evaluation and prioritization as I can reproduce the stated behavior.
  2. Fokke Zandbergen 2014-02-03

    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'));
       });
       
  3. Rene Pot 2017-09-13

    Can we get an update on this ticket? Would be great to set a default language for android apps
  4. Brian García 2019-07-10

    pinging...
  5. Hans Knöchel 2019-07-10

    Can't be very hard. New 1st class property <default-locale /> together with some CLI logic to handle it.

JSON Source