Set up different language for iOS app using react-native and expo

2.6k views Asked by At

So I have an app written in react-native which uses expo and I want my app to support only one language - polish. The problem is some of built in components aren't translated, for example when app asks for permissions they are in english despite phone's language is polish. The problem occurs only for iOS, android is fine.

I think i need to set primary langue to polish but there is no such option in: iTunes Connect -> My apps -> App Store -> App information -> Localizable Information

I have also read this article: https://developer.apple.com/library/content/documentation/LanguagesUtilities/Conceptual/iTunesConnect_Guide/Chapters/DisplayInMoreLanguages.html

And they say that if I can't pick the language I want: "there’s no metadata entered for the language" so how to add one?

I don't have any experience as an iOS developer.

Any thoughts how I could solve this problem?

1

There are 1 answers

0
Diego Manuel Béjar On

Sure, you can at the app.json. Just this way (in the example, my real json for my app, spanish).

At expo.ios.infoPlist property just add:

        "CFBundleLocalizations" : ["es"],
        "CFBundleDevelopmentRegion" : "es",

Take note CFBundleLocalizations is an array, so you can add several languages.

At expo property add this:

    "locales": {
      "es": "./locales/es.json"
    }

Finally, create the ./locales/es.json (remember, this is my case for spanish, just change "es" by "fr", "de"...) with an empty json:

{
}

But if you are working with more than one language, take note:

  1. One entry at locales and one json for each language.
  2. Fill the locale json with the locale information for name, description and permissions:
{
    "NSLocationWhenInUseUsageDescription": "Necesitamos saber tu ubicación para poder mostrarte los eventos más cercanos a ti. Nunca la compartiremos con nadie."
}