Map localization in Carto Mobile SDK - ios

Does anybody know whether it is available to localize captions of the map objects using Carto Mobile SDK? And if it is possible, how can I obtain it?
For example, I would like to see "Kazakhstan" instead of "Казахстан", however caption above the objects depends on country language where object is located. I want make it localized into, let me say, English.
Click the link to see screenshot.
Just in case it is useful and can help: I am using Xamarin.iOS platform. Version of Carto Mobile SDK - 4.0.2.
Thank you in advance.

CartoVectorTileLayer (both CartoOnlineVectorTileLayer and CartoOfflineVectorTileLayer are subclasses of it) has method setLanguage(String) for it, so e.g.:
layer.setLanguage("en");
will give you English language maps.
In SDK 4.0.2 SDK and nutiteq.osm tile source you can use following languages: local/default (will give Казахстан in your case), en, es, de, fr, it, ru, zh (Chinese), tr (Turkish) and et (Estonian) as language
From CARTO SDK 4.1.0 and new carto.streets source you can use any OSM language. I would suggest to configure map based on device language settings, with something like:
// Android
layer.setLanguage(Locale.getDefault().getLanguage());
// iOs / Xamarin
layer.Language = Foundation.NSLocale.PreferredLanguages[0].Substring(0, 2);
What if specific name is not available in given language? Then the MapView will fallback to 'local' language by default, the map will not be empty. But if the 'local' language is still unreadable, so I'd prefer latin alphabet names? In SDK 4.1.0 you can configure primary and secondary fallback languages, e.g. you set primary language to 'de' for Germans, then to avoid strange alphabets (say Hebrew, Greek, most of Asia) set 'en' as primary fallback; then local is used only if both your primary and English names are missing.

Related

iOS Localization of bundle display name for en-GB and en-US

We are developing an app for football (Soccer). The app is only supporting English, but football has different meaning around the world. I.e in US / Australia / Japan / New Zealand they use soccer instead of football. We want to determine the display name based on the language selected on the device.
We want to achieve that the display name in US / Australia / Japan / New Zealand is "Soccer" and in the rest of the world it should be "Football".
Implementation
We thought after reading this documentation from Apple, that we could have a fallback language mechanism. So we implemented following.
We created a file called InfoPlist.strings that supports following:
en-GB
en-US
en-AU
en-NZ
ja
The InfoPlist.strings files is constructed like so:
en-GB
CFBundleDisplayName = "Football";
CFBundleName = "Football";
en-[US / AU / NZ] / ja
CFBundleDisplayName = "Soccer";
CFBundleName = "Soccer";
Project structure
Other than this we specified the CFBundleDevelopmentRegion in the Info.plist to en-GB / United Kingdom.
We have also tried to add following to the Info.plist but with no luck:
<key>CFBundleDisplayName</key>
<string>$(PRODUCT_NAME)</string>
<key>LSHasLocalizedDisplayName</key>
<true/>
When you are selecting one of the supported languages as preferred language on the device it works fine. But when you choose a not supported language (i.e. German) it falls back to the en-US localization. Can you help us understand that?
In theory the OS looks up the preferred language (in this case German), and finds out that it is not supported. After that, if it the has the base language (without a dialect) supported it will use that one. It is also not available in this case. Then it end up at the last step:
If none of the user’s preferred languages are supported by your app, iOS chooses the language matching your app's development region (CFBundleDevelopmentRegion).
In our case we have CFBundleDevelopmentRegion defined to en-GB / United Kingdom.
We will expect to see "Football" as the display name, but we see "Soccer" (en-US localization). We don't understand.
Hope you can help us - thanks in advance :)
I am experiencing same issue in ios 14, seems a bug, whenever there is definicion for a specific locale en-XX the general one is never used. Instead, the alphabetical order is used for the specific ones.
https://developer.apple.com/forums/thread/663628
In order to workaround this, there is an specific language en-001, I add that to the project and fill the values with the default ones. So it always solve the not defined specific with en-001 definition.

IOS apps that will support both RTL and LTR in one application which can be changed dynamically

I am confused to design the application in RTL as well as LTR
1: I have created two story board for Arabic and normal home for all languages except Arabic.
2: I have tried to change the app language in application but it will require restart the application so how can i restart ?? .
3: ios9 provide new feature but at time only one language we have to select from project->edit scheme-> language but I need two language support English as well as Arabic at one application which can be change dynamically.
Please give me your suggestions. Thanks.
You can save the user language preference. Acc. to the language specified you can display the data in the specified language. You don't need to create separate storyboards for each languages. Just dynamically retrieve the language specified and display the data accordingly.

iOS Bundle Display Name - en-GB and en-US

Context:
We are developing an iOS app that has the word Math/Maths in it. This needs to change depending if the device's language is English or British English.
Problem:
So, I have two InfoPlist.string files for en-GB and en-US and in the iOS simulator the App displays either an en-GB or en-US App name depending if the language was set to English or British English. However, it's very glitchy (sometimes working, sometimes not) and according to Apple's Dev guide it's not (or shouldn't be) possible! That's not to say the doc isn't outdated or wrong.
From: https://developer.apple.com/library/ios/documentation/MacOSX/Conceptual/BPInternational/Articles/LanguageDesignations.html#//apple_ref/doc/uid/20002144-BBCEGGFF
Important: In iOS, the bundle interfaces do not take dialect or script
information into account when looking for localized resources; only
the language designator code is considered. Therefore if your project
includes language-specific project directories with both a language
and region designator, those directories are ignored. The bundle
interfaces in OS X do support region designators in language-specific
project directories.
Am I on a wild goose chase and it's not actually possible or it is, and just very buggy? If it is possible, how?
You are right. It is not possible automatically. For localizeng the os looks for the language, not for the region. So it just takes into account the en. But the good news is that there is a indirect solution which requires little effort: check the approved answer here.

localised.string in a language that is not available in settings

I am creating an app and I have some translations.
The app is programmed to detect the ios language and most of the languages are in the settings, except Slovenian.
Is there any other way to do that.
Perhaps read region format?
Or, how to add a list.
While the OS itself my not support the language (iPhone Language setting) you can still use the below option in Settings to Add Language… to add the language to your preferred list of languages. Then if an app supports that language it still will even if the OS does not (ie. The OS's strings aren't translated).

can I change an app's language based on an iOS Device's default language?

I have Created one simple in-house app for ipads. I would like to have 2 language for that app. Based on ipad default language App language should be same as ipad default language.
I tried to goggling it but didn't find proper answer.
Is it possible?
How can I do that?
Any Links, examples any documents?
You can use TSLanguageManager SDK in order to do that. In basic, you define different string for each languages. Then the SDK checks your language and converts your defined strings/view elements into that language string. Also, you can switch between language by using this SDK in your app.
This is a good starting point for internationalization and localization resources for iOS apps.

Resources