Android Game Title Localization

Game title localization is simple for iOS.

How is it done for Android?

I don’t know how to do it but I asked ChatGPT and I think I got a good answer:

In Solar2D, localizing the game title for Android is done by modifying the strings.xml file, which is part of the Android project structure. Here’s a step-by-step guide to localizing the game title for Android:

1. Create strings.xml Files for Each Language

Android handles localization by storing string resources in different values folders, one for each language.

  • Default Language: In your project folder, navigate to the res/values/ directory and find or create a file named strings.xml. This file contains the default strings, including your game title.
  • Localized Strings: To support additional languages, create new directories with language codes. For example:
    • res/values-es/ for Spanish
    • res/values-fr/ for French
    • res/values-pt/ for Portuguese

Each of these directories should have its own strings.xml file. The structure for each file should look like this:

xml

<resources>
    <string name="app_name">Your Game Title</string>
</resources>
  • For example, the res/values-es/strings.xml for Spanish might contain:

xml

<resources>
    <string name="app_name">Título de tu juego</string>
</resources>

2. Modify build.settings in Solar2D

In your Solar2D project, the build.settings file may need to reference Android’s strings.xml to localize the title properly.

Example build.settings snippet:

lua

android =
{
    versionCode = "1",
    versionName = "1.0",
    applicationChildElements =
    {
        -- This will look for the localized strings in `strings.xml`
        [[
        <application android:label="@string/app_name">
        </application>
        ]]
    },
}

3. Packaging the Project

Once you’ve set up the localized strings.xml files, Solar2D will use these to display the correct title based on the user’s device language settings.

4. Testing the Localization

To test localization, change the language on your Android device and ensure that the title updates correctly in the launcher and other areas where it appears.

By setting up the localized strings.xml files and referencing them in your Solar2D project, Android will handle displaying the correct game title based on the user’s language preferences.

@aclementerodrguez thank you for the answer!

To be honest I did the same thing, hehe.

But after further digging I got the information that strings.xml is not supported by Solar2D :/.

I see… well, let’s hope it supports it soon.