0

So I am trying to localize my app. Right now my whole App, all the Strings are in German. My Goal is that in German speaking countries (Germany, Austria & Switzerland) the language should be German and everywhere else it should be English. I understand that I can simply add a .localization-file for `english. But I think that this is only changes the language for english speaking countries and for the rest it still shows the base language right? What is the best way to achieve my goal here?

I do not want to change all the labels inside my app and make the base language english and just add a German localization file because that would be way too much work... However I am not quite sure if there is another way. Happy for every help, I hope my problem is clear.

enter image description here

Chris
  • 1,828
  • 6
  • 40
  • 108
  • iOS respects user preference in language settings. The one way is to detect region and then read the localisation file. Refer: https://developer.apple.com/news/?id=u2cfuj88 https://stackoverflow.com/questions/9939885/manual-language-selection-in-an-ios-app-iphone-and-ipad/10142363#10142363 – Anshul Dec 24 '20 at 15:01
  • so the only way to achieve this is setting everything to english and then localize it for German ?? – Chris Dec 24 '20 at 15:30
  • Using localization uses the phone's language not necessarily the country in which the user lives. The base/default language is usually English/Developement Language and it uses this language when the phone is setup to another language like `French` that you don't support. https://developer.apple.com/library/archive/documentation/MacOSX/Conceptual/BPInternational/InternationalizingYourUserInterface/InternationalizingYourUserInterface.html#//apple_ref/doc/uid/10000171i-CH3-SW4 – lorem ipsum Dec 24 '20 at 19:01

1 Answers1

0

I am solving it now by changing all the Strings inside my main app to English and then add a localization for German. This helper makes that quite easy:

extension String {
    func localized() -> String {
        return NSLocalizedString(
            self,
            tableName: "Localizable",
            bundle: .main,
            value: self,
            comment: self)
    }
}
Chris
  • 1,828
  • 6
  • 40
  • 108