Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

Creating "res/values-XX/strings.xml" files for each localization with build.settings
Started by atanasovskyjiri Mar 26 2020 09:35 AM

No replies to this topic
[TOPIC CONTROLS]
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

atanasovskyjiri

[GLOBAL: userInfoPane.html]
atanasovskyjiri
  • Observer

  • 11 posts
  • Corona SDK

I would like to create strings.xml files for each language my app supports. They should be each in values-XX folders, f.e. res/values-cs/strings.xml for Google play to detect localization.

 

I started only with title of app localized. I created strings.xml file:

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <string name="app_name">Localized name for app</string>
</resources>

This file should be in res/values/strings.xml in apk.

 

I found this build setting that might help me do this:

apkFiles — This directive causes files to be copied from the project directory to the root of the .apk file, preserving any directory hierarchy. In the following example, google-play-services.json is copied to the root of the .apk and res/raw/mypage.html is copied to res/raw. The file paths are always relative to the base directory of the project.

So I added res/values-cs/strings.xml file to my project folder (where main.lua is) and added this to build.settings:

settings =
{
	orientation =
	{
		-- Supported values for orientation:
		-- portrait, portraitUpsideDown, landscapeLeft, landscapeRight
		default = "landscapeRight",
		supported = { "landscapeRight", "landscapeLeft" },
	},

	--
	-- Android section
	--
	android =
	{
		usesPermissions =
		{
			"android.permission.INTERNET",
		},
		apkFiles =
        {
            "res/values-cs/strings.xml",
        },
	},
...

I built app in corona simulator (2020.357) and unpacked .apk package with apktool to make sure that res/values-cs folder was created and strings.xml is in it. It was not there.

 

I tried to copy file with apkFiles to existing folders to make sure this is not problem but it didnt work either.

 

What am I missing?




[topic_controls]
[/topic_controls]