Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IOS 8 NSLocationAlwaysUsageDescription custom translation

I understood that I can have localized NSLocationAlwaysUsageDescription text using standard iOS localization mechanism. Since we are using our custom dynamic localisation mechanism I wonder if there is another way to translate that string. I thought of editing application info.plist file on app start, but it seems to be read only.

Can I change this value from withing the app?

like image 458
Misha Avatar asked Oct 30 '14 14:10

Misha


2 Answers

There is a way. Add a new Strings file called "InfoPlist". Then localize it using a Localize button in attributes inspector and add localizations to the InfoPlist's keys. To localize CLLocation premission's description add in every version proper key and loacalised value.

//English file
"NSLocationAlwaysUsageDescription" = "English description";

_

//Polish file
"NSLocationAlwaysUsageDescription" = "Polski opis";
like image 89
Kubba Avatar answered Oct 13 '22 19:10

Kubba


There's no way to use a custom localisation system with the info.plist strings.

That part of your app will have to use iOS's default localisation mechanism.

This is how to localise the location request description with iOS's built in strings file localisation system.

// English.strings file
"NSLocationAlwaysUsageDescription" = "English description";

// AnotherLanguage.strings
"NSLocationAlwaysUsageDescription" = "ajbdknfuied wibnrf";

EDIT: At everyone down voting me. The question asked about using a custom "custom localisation system". They explicitly said they did not want to use the built in localisation system, but instead their own custom one. That is why I said it was impossible.

Localising NSLocationAlwaysUsageDescription is completely possible. Using your own custom localisation system to do it is not.

like image 23
Kyle Howells Avatar answered Oct 13 '22 18:10

Kyle Howells