Android: Localize app title with Corona SDK
I was bored and decided to take a break and have fun with some Android stuff.
I managed to get the app title localized more easily than I had thought on Android (it took me longer to write this post than it did to localize the app title. Tested on Android 2.3.6 and Android 4.3.
1) Android SDK installed and configured (to be able to sign and verify the APK)
2) apktool (To unpack/pack the APKs https://code.google.com/p/android-apktool available for Mac/Win/Linux)
Step 1: Compile your app with Corona.
Step 2: Unpack the APK created by Corona. From the command line run:
apktool d your-app-name.apk
Replace ‘your-app-name’ above with the name of your APK. This will create a folder named ‘your-app-name’ in the current folder.
Step 3: Go to the /res/values folder within the folder created in step 2 (this is the folder for the default language)
Step 4: Edit strings.xml. It will contain a lot of facebook stuff, but you just need to add a line below the <resources> tag:
<string name="apptitle">My App Title</string>
Since this is the default language, I enter the name I want to see under my app icon in English.
Step 5: Create new folders in the /res folder for every language you want to support.
For Japanese it would be values-ja and for French the folder name would be values-fr.
In each of these folders above create a file named strings.xml with the following content:
<?xml version="1.0" encoding="utf-8"?>
<string name="apptitle">My Localized App Title</string>
Replace ‘My localized App Title’ with the app name written in the desired language.
Step 6: Modify the manifest.
The manifest created by Corona needs to be modified. Open AndroidManifest.xml and search for ‘android:label’.
There are two places that need to updated. Both should be modified to read: android:label=”@string/apptitle”.
You might need to modify the FileContentProvider’s authorities string as well.
Search for FileContentProvider and check the authorities string on the same line. It should read “com.ansca.corona.files”. If it’s anything else, change it.
Step 7: Create a new APK.
Make sure you’re in the top-level folder (the same folder as when you ran step 2)
From the command line run:
apktool b your-app-name new.apk
IMPORTANT: Do not type ‘.apk’ after your-app-name as you want apktool to read from your modified folder.
Step 8: Sign and verify your new APK
I have a small script that does this for me (see below. I’m on Mac OSX)
WARNING: This is a bare-bones script with no validation. You’ll need to replace three things for it to work
1) /path/to/your/keystore is the path to your own Android keystore file.
2) your-password is the password for your keystore.
3) your-alias is the alias for your keystore.
I call my script ‘signapp’ so I run the following from the command line:
if [ -z "$1" ]; then
echo "Please specify a file to sign"
jarsigner -verbose -sigalg MD5withRSA -digestalg SHA1 -keystore /path/to/your/keystore -storepass your-password $1 your-alias
zipalign -v 4 $1 zip-$1
mv zip-$1 $1
Step 9: Delete your old APK and rename ‘new.apk’ to your original app name APK.
Done! Install and test on your device
Hope this helps…