Skip to content
This repository has been archived by the owner on Oct 29, 2022. It is now read-only.

Support for Android Apps / APK Localization (strings.xml) #401

Closed
regnete opened this issue Jan 15, 2015 · 18 comments
Closed

Support for Android Apps / APK Localization (strings.xml) #401

regnete opened this issue Jan 15, 2015 · 18 comments

Comments

@regnete
Copy link

regnete commented Jan 15, 2015

Android Apps (APK) build with PGB do not contain any localization files. Because of this, the google play store marks them as "available in standard locale only".

For iOS Apps (IPA) a simple mechanism is offered by PGB. Place local.strings files in locale specific folders below www folder like this:

-- www
--- locales
---- en
----- local.strings

The content of the local.strings files may be :
"DummyKey" = "Dummyvalue";

The iOS solution is described here: http://community.phonegap.com/nitobi/topics/problem_with_binary_details_ios_localization_builded_with_phonegap_build

We need a comparable android solution. We could e.g. place an additonal folder tree below www folder:

-- www
--- res
---- values
----- strings.xml
---- values-en
----- strings.xml
---- values-de
----- strings.xml

PGB should then copy the res folder one level up when assembling the apk. The folder could be identified by ist name "res" (as it is done for the above mentioned iOS solution for the name "locales") or by a special configuration tag/directive in config.xml (see #386 ) which is obviously the smarter solution.

@azabala
Copy link

azabala commented Mar 16, 2015

+1...its a must to build localized apps for Google Play

@jumanji27
Copy link

+1 )

@bheijns
Copy link

bheijns commented May 22, 2015

+1!

@alexkvak
Copy link

+1

6 similar comments
@Omnem
Copy link

Omnem commented Aug 30, 2015

+1

@roidayan
Copy link

roidayan commented Nov 2, 2015

+1

@kentmw
Copy link

kentmw commented Nov 2, 2015

+1

@bau720123
Copy link

+1

@sdrubish
Copy link

sdrubish commented Nov 4, 2015

+1

@Luigi123
Copy link

Luigi123 commented Nov 4, 2015

+1

@wildabeast
Copy link
Collaborator

PGB has added beta support for Android localization files. To add, create directory locales/android/ in the root of your PGB application zip / repo, and place your localization files there. The contents will be copied into the Android res/ directory, and any nested sub-directory structures will persist. Here's an example of how these files will be compiled into your APK:

<www.zip>/locales/android/values-fr/strings.xml --> <android_apk>/res/values-fr/strings.xml
<www.zip>/locales/android/xml/custom.xml        --> <android_apk>/res/xml/custom.xml

Existing directories will be merged, but at this time any individual files you include will overwrite their target if it exists, so if any of your plugins have matching localization files, you'll need to merge them into your own locales directory manually.

iOS notes
If you are utilizing the locales directory for iOS localization, this will continue to work as before. However if you wish to use both iOS and Android localization, you should move your iOS localization files from locales/ to locales/ios/.

Note that its a beta feature; try it out and let us know.

Side note: it seems to be implied above that adding localization files will add that to your supported locales in the Play store, however from my research and testing, the contents of your translation files will not affect this, you must manually select your locales when uploading your app.

@bau720123
Copy link

hi @wildabeast
could I ask..

[Q1]
when in iOS,the local.strings content is => "DummyKey" = "Dummyvalue";
so when in ndroid,is the strings.xml or custom.xml have any default value ?

[Q2]
if I just want to use the ios localization function (android won't)
is the => "ios" folder necessary? or just put in "locales" folder ?

@wildabeast
Copy link
Collaborator

@bau720123 the default content is whatever is created by the cordova cli, which you can see here. strings.xml and custom.xml are just examples ... you can add whatever files you need. check out the android resource docs for what you might want to have in the res/ directory.

as mentioned in the iOS notes above, if you're only using iOS locales you can put your content in either locales/ or locales/ios/.

@bau720123
Copy link

ok
thanks @wildabeast

@wildabeast
Copy link
Collaborator

Closing re above solution.

@vdias38
Copy link

vdias38 commented Jun 14, 2016

Hi, @wildabeast is this "beta" support continues ? I've tested with on PGB with cli-6.1.0 it works for android but cannot do it work for iOS.

I'm trying to localize app_name adding local.strings files

-- www
--- locales
---- ios
----- pt
------ local.strings
----- en
------ local.strings

The content of the local.strings file are :
"CFBundleDisplayName" = "Brasil";
"CFBundleName" = "Brasil";
and
"CFBundleDisplayName" = "England";
"CFBundleName" = "England";

Should I add stg on config.xml ? I've tried adding following config without success:

            <config-file parent="CFBundleLocalizations" mode="replace"> 
                <array>
                  <string>pt</string>
                  <string>en</string>
                </array>
            </config-file>

Thanks for your help

@vdias38
Copy link

vdias38 commented Jul 6, 2016

I've opened a ticket concerning this issue to adobe support

@jskrepnek
Copy link

jskrepnek commented May 7, 2018

@wildabeast Hi, can you comment on continued support for the beta feature you describe above or suggest alternatives if it is no longer supported with newer versions of PGB?

There does not seem to be support for the resource-file element.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

No branches or pull requests