Localized app title (DEF-1725)

How would I do to make the title of an app localized on the home screen on iOS and Android…?

On Android you’d normally set the app name to refer to a string in a resource file, and that specific string could have localized variants. But for Defold apps the app title is hardcoded and can’t be localized. I think we haven’t bothered with this for the asian launch of Blossom Blast, but I guess it was discussed at some point. @Andreas_Jirenius, do you remember the discussion around the app name and if it was ever discussed to add this as a feature of the Defold editor?

We don’t have any built in support for this, but maybe something we should add…

I did take a quick look at it for iOS though.
Seems that you need to supply InfoPlist.strings files with entries for CFBundleDisplayName and CFBundleName inside <localizaion-name>.lproj folders, all inside your app-folder… I think you should be able to manually do this after you have bundled your app and then re-sign it again… I will do a quick test and do this myself.

Update: So this seems to work for iOS. :slight_smile: It’s not very user friendly to do, I essentially had to create these files manually after bundling, inside my app-folder:

  • MyProject.app/Base.lproj/InfoPlist.strings
  • MyProject.app/en.lproj/InfoPlist.strings
  • MyProject.app/sv.lproj/InfoPlist.strings

My en.lproj/InfoPlist.strings looked like this:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
        <key>CFBundleDisplayName</key>
        <string>MyProject</string>
        <key>CFBundleName</key>
        <string>MyProject</string>
</dict>
</plist>

And my sv.lproj/InfoPlist.strings looked like this:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
        <key>CFBundleDisplayName</key>
        <string>CoolaBananer</string>
        <key>CFBundleName</key>
        <string>CoolaBananer</string>
</dict>
</plist>

Then I needed to re-sign the app again with: codesign -s 'iPhone Distribution' -f MyProject.app
Once I had the app on my phone I tried changing the device language to Swedish, the app name displayed “CoolaBananer”. :slight_smile:

(I’m definitely not saying this is the best way to do it, we should probably expose an easier way to do this. But if you need the functionality now, this is how you would do it for iOS.)

3 Likes

Coola bananer!

Ok - so Android then… The proper way to do it is change android:label to something like “@strings/app_title” and then in the strings.xml have that string present for each localization. I guess this is harder to achieve, but it might be possible. I will create an apk and see what I can do.

1 Like

As you said, I think it should be possible to do something like described here. The tricky part is to actually add your own resource files that is needed for values-en/Strings.xml, it’s not currently possible to do automatically in the Defold build process…
However, a workaround for now would be to repack your APK after bundling with your own resources and of course also update your manifest to use the correct string resource. I would recommend having a look at this tool; http://ibotpeaches.github.io/Apktool/

Again, let me stress these are only workarounds, indicating we should have some sort of support for this in Defold in the future. :slight_smile:

Late to the party…
Yes, we encountered this and as we want to have a pretty good automated release-process we skipped the above kind of manual re-signing.
We just went with same title but are awaiting the possibilities to do this from within Defold.

1 Like

Yes, I am in the process of releasing a game that needs this - so workarounds are necessary. For the future, better support would be nice though.

I have run in to another problem though, so I haven’t been able to try it out on Android: Bundling for Android hangs

Added a ticket for this: DEF-1725

3 Likes

So here I am again creating a game with local titles, so I am bumpin this as it is a very cumbersome procedure atm

So I am trying this again now but after resigning the app, when I upload with Application Loader I get “ERROR ITMS-90166: “Missing Code Signing Entitlements. No entitlements found in bundle ‘xxx’ for executable 'xxx””. I have tried both signing with and without the “–entitlements”-option

1 Like

Hm, alright, I’ll give it a try here as well!

I messaged @Johan privately and we managed to resolve the issue. :slight_smile: In my initial post how to resign an iOS app I left out a couple of steps, here is the full workflow for resigning;

  • Resign an iOS app:
$ security cms -D -i "<path_to_.mobileprovision>" > provision.plist
$ /usr/libexec/PlistBuddy -x -c 'Print :Entitlements' provision.plist > entitlement.plist
$ cp "<path_to_.mobileprovision>" "MyProject.app/embedded.mobileprovision"
$ rm -rf MyProject.app/_CodeSignature
$ codesign -s 'iPhone Distribution' -f --entitlements entitlement.plist MyProject.app
  • Repackage App folder into an IPA archive:
$ mkdir Payload
$ cp -r MyProject.app Payload/
$ zip -r MyProject.ipa Payload
3 Likes