ehusmann
ehusmann

Reputation: 37

How to translate the location service request dialog on iOS in a Flutter app

I want to use the location service in a Flutter app with multiple languages. This all is no problem and works fine, except for the translation of the location service usage request in iOS. For some reason, whatever I try, the language used remains the base language (English). Not just the extra string that I give through the NSLocationWhenInUseUsageDescription info.plist entry, but the complete dialog.

I have added the languages through the Project Runner > Info tab > Localizations

I have added the languages in the info.plist file Localizations key.

The above mentioned NSLocationWhenInUseUsageDescription key in the info.plist file is set.

I have separate InfoPlist.strings files for each language in the lproj directories with each an entry for the NSLocationWhenInUseUsageDescription key.

When I run the app (simulator or real device) I can change the language in the app settings as expected and the app changes language. All strings are translated as expected, but when I want to access the location service for the first time, the dialog to request permission remains in English. And I have checked with different strings, it uses the entry from the Base.lproj/InfoPlist.strings file. Why does it not recognize the correct language setting?

Edit after checking the comment below: the dialog changes language when the device language is changed (not the app). However, the app info string that is included remains the string from the base.lproj/InfoPlist.strings file, not the specific language string. How to change that as well?

Upvotes: 0

Views: 525

Answers (0)

Related Questions