Custom Localization Overwriting Build Template Localizations on iOS

  • 4
  • Problem
  • Updated 7 years ago
  • In Progress
I've found that PhoneGap Build's template project for iOS contains localizations for 4 strings in 4 different languages. These localizations cause the App Store to report my App supports those 4 languages, when it doesn't. I've fixed this by including my own locale folder with appropriate languages, like so:

locales
|-en
| |- local.strings
|-de
| |- local.strings

The problem is that when I include this locales folder, the PhoneGap Build template localization is not merged with my localization - meaning that I need to include them manually.

Instead of the current behavior, I'd like it if the build server merged it's localizations with the custom localizations, while removing template localizations that aren't included in the custom package. In essence, if I include the locales folder above, the generated IPA should include en.lproj and de.lproj. The lproj folders should contain both my localizations and the default localizations.

Let me know if this is possible. Thanks!
Photo of artlogic

artlogic

  • 8 Posts
  • 0 Reply Likes

Posted 7 years ago

  • 4
Photo of Amir

Amir

  • 8261 Posts
  • 263 Reply Likes
Hello there,

Sorry for the late response however the localization on Build doesn't work that way. The folder structure above only helps Appstore to identify supported language while the translation itself have to be done via Javascript or some other way (load from local/remote storage, etc..)

Anyway, lets change this topic to and Idea so other people can vote for your suggestion.

Thanks

Photo of artlogic

artlogic

  • 8 Posts
  • 0 Reply Likes
I understand what you are saying, but I feel as though you've missed my main point: When I include the above folder structure which "helps the Appstore identify supported language[s]", it wipes out the template's localization, thus making parts of my app not localize, when they once did.

For instance, if I include locales>de>local.strings with a dummy string in it (that I can't even use, according to you), then I would expect that the following strings would be merged from the template: https://github.com/phonegap/phonegap/...

I'd call this a bug, unless your intention was to cause this feature to remove localizations included in the template by default.
Photo of Amir

Amir

  • 8261 Posts
  • 263 Reply Likes
Unless if you build it locally, it could be a bug. Here at Build, the only option for localization is as per my previous post - thought we were happy to hear feedback from community on how to improve things, in your case merging.

By the way, what could be the template you are planing to localize other than https://github.com/phonegap/phonegap/...?. Are they a plugin-specific template?

Thanks
Photo of artlogic

artlogic

  • 8 Posts
  • 0 Reply Likes
I'm not building locally, I'm using PhoneGap Build - specifically with iOS.

You might try it yourself - build an iOS App with PhoneGap Build without any localization customization, and you'll see it's localized in 4 languages. The same four languages and localizations listed here: https://github.com/phonegap/phonegap/...

This means that every App built with PhoneGap Build without localization shows up in the App Store as having support for these 4 languages - when it may not in reality support any of these languages. I was curious as to what strings these localized, and so I've pasted the strings that are included by default in any PhoneGap Build iOS project below:

// controller title for Videos
"Videos title" = "Videos";
// accessibility label for recording button
"toggle audio recording" = "toggle audio recording";
// notification spoken by VoiceOver when timed recording finishes
"timed recording complete" = "timed recording complete";
// accessibility hint for display of recorded elapsed time
"recorded time in minutes and seconds" = "recorded time in minutes and seconds";

Let me be very clear. I did not add these. These are part of PhoneGap Build's template.

You can see where these are used in the following files:
https://github.com/phonegap/phonegap/...
https://github.com/phonegap/phonegap/...

Just search for NSLocalizedString and you'll see where these are used.

The problem is that when I use the techniques mentioned above to localize my application properly, it wipes the out the default PhoneGap Build localizations for iOS.

For instance, if my App is Localized for German, and I include locales>de>local.strings with a dummy string in it, then the default localizations from the Build's iOS template (located here: https://github.com/phonegap/phonegap/...) are wiped out.

That means that NSLocalizedString can't find the German versions of the localization for CordovaLib's Capture or Camera modules and defaults to English by default.

Do you understand why this could be a problem? My short term solution has been to simply copy and paste the values from the default template into my custom localization, but you can't expect users to do this as a matter of course.
Photo of Amir

Amir

  • 8261 Posts
  • 263 Reply Likes
Hi Artlogic

Apologize for the late response as this topic has fall out of my radar. I just come across your post while looking at the old topics. Really sorry about that.

Anyway, lets clarify this once and for all :)

PhoneGap Build is a service to build the app over the cloud. PhoneGap (framework) is a platform to allow webapp becoming nativeapp. In this sense, PhoneGap Build uses PhoneGap (framework) to build/compile an app.

PhoneGap Build doesn't have localization template. PhoneGap (framework) has it. Although PhoneGap Build uses PhoneGap (framework) to build an apps, it still unable to utilize every single configuration PhoneGap (framework) can offer, include the localization.

The links you are referring to, are belongs to PhoneGap (framework) local installation. Hence it is not really mean anything to PhoneGap Build in the sense of translating word-by-word, because Build did not make use of it.

However, there were an official hack introduced sometimes ago where we can specify supported language at Appstore and perform the translation programatically.

1- Use a path [eg: locales/de/local.strings] to define supported languages
2- Use javascript/localStorage/etc to do the translation, programatically.

Is that mean custom localization? Yes sir. Absolutely!

=====================================
Q & A
=====================================

Q: Why there are still 4 language without any localization customization
A: Because PhoneGap (framework) has it by default, not Build. To avoid having this default languages, add a path. The more/less path we add, the more/less language will be shown at Appstore. Example:

locales/cn/local.strings
> Appstore will show only Chinese language supported

locales/cn/local.strings
locales/jp/local.strings
> Appstore will show only Chinese and Japanese language supported

... and so forth.

I hope that will clear the air. But if it's not, shoot me. I might be wrong in some way but lets learn it together! :)

Cheers~
Photo of artlogic

artlogic

  • 8 Posts
  • 0 Reply Likes
Amir - Thanks for your response. I don't seem to be communicating the issue very clearly, so I'm going to prepare some samples tonight to illustrate my point.
Photo of artlogic

artlogic

  • 8 Posts
  • 0 Reply Likes
Amir - here are two repos, one that uses your "official hack":

https://github.com/artlogic/CaptureAudio
https://github.com/artlogic/CaptureAu...

1. Build both of these for iOS with PhoneGap Build
2. Turn on voice over in the accessibility settings.
3. Switch the phone's language to German.
4. Start CaptureAudio, click on "Capture Audio".
5. Tap the record button (to get the accessibility text) - the voice over for the record button is in German, as it should be.
6. Start CaptureAudioGerman, which uses the "official hack", click on "Capture Audio".
7. Tap the record button (to get the accessibility text) - the voice over for the record button is in English. This is obviously incorrect.

Ideally, when I specify the language for my app using the "official hack", I would expect that it wouldn't disrupt strings already localized.
Photo of artlogic

artlogic

  • 8 Posts
  • 0 Reply Likes
Amir - any updates on this?
Photo of Amir

Amir

  • 8261 Posts
  • 263 Reply Likes
Hi Artlogic

Sorry for the late response. Now I'm fully understood the situation. I have create a bug report for this and please bookmark / watch / comments to get status update.

https://github.com/phonegap/build/iss...

Thanks you for your valuable feedback!

Cheers
Photo of artlogic

artlogic

  • 8 Posts
  • 0 Reply Likes
Thanks for sticking with this. I'm glad to see it's going to get fixed.
Photo of Ness

Ness

  • 1 Post
  • 0 Reply Likes
You should try localizing your iOS app with another localization tool such as this one: https://poeditor.com/. I never had such problems with my apps, and on top of that it has really useful features and a good price.
Photo of artlogic

artlogic

  • 8 Posts
  • 0 Reply Likes
POEditor is a great product, but it wouldn't help in this scenario. This is a problem with PhoneGap Build itself.
Photo of Zahir

Zahir

  • 3500 Posts
  • 40 Reply Likes
Hi,

This issue is now closed due to the inactivity.

Create a new issue if you wish to bring up the current situation or have any other problem with PhoneGap Build.

We seek your kind coorperation.

This conversation is no longer open for comments or replies.