Skip to content

localeResolutionCallback doesn't work correctly #36

Closed
@bbrto21

Description

@bbrto21

Problem

  • If you use localeResolutioncallback, you get the wrong locale value
  • Sample codes
    // ...
    import 'package:flutter_localizations/flutter_localizations.dart';
    // ...
          localizationsDelegates: [
            GlobalMaterialLocalizations.delegate,
            GlobalWidgetsLocalizations.delegate,
            GlobalCupertinoLocalizations.delegate,
          ],
          localeResolutionCallback:
              (Locale locale, Iterable<Locale> supportedLocales) {
            print("localeResolutionCallback!!");
            print("locale.countryCode : " + locale.countryCode.toString());
            print("locale.languageCode : " + locale.languageCode.toString());
            return locale;
         }

How to reproduce

  1. Launch the app
  2. Change device language to another language
  3. Resume the app

as is

  • The locale value is always wrong.
    image

expected

  • The locale value should reflect the language of the device.
    image

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions