[AC-1983] Android: App name localization error
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | n/a |
Status | Closed |
Resolution | Needs more info |
Resolution Date | 2013-04-04T20:34:36.000+0000 |
Affected Version/s | n/a |
Fix Version/s | n/a |
Components | Titanium SDK & CLI |
Labels | n/a |
Reporter | Christoph Atteneder |
Assignee | Mauro Parra-Miranda |
Created | 2012-12-27T07:20:57.000+0000 |
Updated | 2016-03-08T07:40:55.000+0000 |
Description
*Problem description*
I tried to get the app name localization working on Android and iOS and walked through the guide provided and cross-compared it with the example on github.
I've re-checked the AndroidManifest XML file from the build folder and the android:label='@string/app_name' attributes are set as documented.
When I deploy it on an Android device it takes the package string as app name (e.g. org.myapp.) and not the localized app string from the strings.xml in the platform folder.
*platform/android/res/values-de/strings.xml*
<?xml version="1.0" encoding="UTF-8"?>
<resources>
<string name="app_name">Meine App</string>
</resources>
*platform/android/res/values-en/strings.xml*
<?xml version="1.0" encoding="UTF-8"?>
<resources>
<string name="app_name">My App</string>
</resources>
platform/android/AndroidManifest.xml
<?xml version="1.0" ?><manifest android:versionCode="1" android:versionName="1" package="org.myapp.test" xmlns:android="http://schemas.android.com/apk/res/android">
<uses-sdk android:minSdkVersion="8"/>
<uses-feature android:name="android.hardware.camera"/>
<uses-feature android:name="android.hardware.autofocus"/>
<uses-feature android:name="android.hardware.flash"/>
<application android:debuggable="false" android:icon= "@drawable/appicon" android:label= "@string/app_name" android:name="MyAppMobileApplication">
<!-- TI_APPLICATION -->
<activity android:configChanges="keyboardHidden|orientation" android:label= "@string/app_name" android:name=".MyAppMobileActivity" android:theme= "@style/Theme.Titanium" >
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<activity android:configChanges="keyboardHidden|orientation" android:name="org.appcelerator.titanium.TiActivity"/>
<activity android:configChanges="keyboardHidden|orientation" android:name="org.appcelerator.titanium.TiTranslucentActivity" android:theme= "@android:style/Theme.Translucent" />
<activity android:configChanges="keyboardHidden|orientation" android:name="org.appcelerator.titanium.TiModalActivity" android:theme= "@android:style/Theme.Translucent" />
<activity android:configChanges="keyboardHidden|orientation" android:name="ti.modules.titanium.ui.TiTabActivity"/>
<activity android:name="ti.modules.titanium.ui.android.TiPreferencesActivity"/>
<service android:exported="false" android:name="org.appcelerator.titanium.analytics.TiAnalyticsService"/>
</application>
<uses-permission android:name="android.permission.VIBRATE"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.CAMERA"/>
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
<uses-permission android:name="android.permission.INTERNET"/>
</manifest>
After a lot of testing I think I know what part breaks the localization. I'm able to reproduce it in the github Example from Appcelerator. Just do following:
1. Add support for German by adding a app name localization file (i18n/de/app.xml, platform/android/res/values-de/strings.xml).
2. After that app name localization works in German on iOS and Android.
3. Now add a strings.xml file to the i18n language folders for each language with the following content:
<?xml version="1.0" encoding="UTF-8"?>
<resources>
<string name="testKey">Hallo Welt</string>
</resources>
Install the app again on an Android device and suddenly the app name that was e.g. 'Katze' in German before now displays e.g. org.myapp. If I switch the language on the Android phone it still works for English, but every other language fails.
Work around
- File: i18n/