i18n_extension icon indicating copy to clipboard operation
i18n_extension copied to clipboard

The current iOS system locale always seems to be en_US

Open maguro opened this issue 4 years ago • 11 comments

I changed the locale on my iPhone, iOS 13.3.1 to Spanish and the region to Mexico. However, The mechanisms this extension seems to use seem to be stuck at en_US.

maguro avatar Mar 20 '20 23:03 maguro

It seems that one needs to add an es localization in Xcode, per https://github.com/flutter/flutter/issues/14128. However, the way I18n picks up its locale, it obtains the correct local after its child widgets have been built and it doesn't bother rebuilding them.

maguro avatar Mar 21 '20 03:03 maguro

Hey, i facing with same issue, but i can resolve my problem changing the development language, in project.pbxproj have the: DevelopmentRegios = en; // Change this to your language (or the language you want) (example: French = fr, Portuguese = pt...)

and have the knownRegions too, you need change, my knowRegions is default = knownRegions = ( en, Base, ), and i added in first my language, and its works to mee, if not working, we'll try find your problem

lucas-sesti avatar Apr 09 '20 13:04 lucas-sesti

Maybe it has something to do with this issue: https://github.com/flutter/flutter/issues/14128

What do you think?

marcglasberg avatar Apr 09 '20 18:04 marcglasberg

Yes... but i can't resolve just seeing this issue... i found in a post of stackoverflow (i don't have the link anymore, but i'll try again)

lucas-sesti avatar Apr 09 '20 22:04 lucas-sesti

@lucas-sesti Ok!

@maguro Does that solve your problem?

marcglasberg avatar Apr 10 '20 01:04 marcglasberg

I tried solution from https://github.com/flutter/flutter/issues/14128, it works in debug but failed in release build. Any other clue?

suesitran avatar Apr 15 '20 13:04 suesitran

@suesitran Did you try what i said? Because i tested in debug and release build, and both works

lucas-sesti avatar Apr 15 '20 13:04 lucas-sesti

Yes I tried it, does not work. My development region is English (not sure if i have to change to en), and known region is (en, Base)

suesitran avatar Apr 15 '20 13:04 suesitran

Probably you don't need change to en.. but, if you want change to other languages, you need put in first options off knownRegions and in development region

lucas-sesti avatar Apr 15 '20 13:04 lucas-sesti

I can vouch for the solution.

The following code wasn't working properly:

localeListResolutionCallback: (locales, supported) {
  Locale locale = Locale('en', 'US');

  for (var loc in locales) {
    if (supported.contains(loc)) {
      locale = loc;
      break;
    }
  }

  return locale;
}

Even though the Device's Locale was set to a different language the locales parameter was returning: [en_US, pt_BR, en]. Not honoring the priority set on the device.

The solution:

  • Add the supported languages on the XCode project (picture 1).
  • Add Localized resources can be mixed to YES on the Info.plist (picture 2).

References: (Picture 1) Screen Shot 2020-04-22 at 18 23 05

(Picture 2) Screen Shot 2020-04-22 at 18 24 50

After those settings set, the locales param is rightfully being returned as [pt_US, pt_BR, en] (pt_US in this case is expected to be first because the phone region is set to the USA)

kelvne avatar Apr 22 '20 21:04 kelvne

Any updates on it?

ivan-pavliuk avatar Jul 16 '20 07:07 ivan-pavliuk