Skip to content

Localizations.override override the whole app #19

@EdwynZN

Description

@EdwynZN

Perhaps this is a problem with flutter itself and not this awesome package but maybe you can help me narrow the problem so I can open the issue in the Flutter project instead (There is already a similar problem in Flutter issues flutter/flutter#33300)

When using AboutListTile() > Opening Dialog > See Licenses > Tap on any License the Localization becomes English for the whole app, Reading the code they use Localizations.override(locale: const Locale('en', 'US'), ...) so the license page load only in English, the problem is that Localizations.override should only override that page, but it changes the whole app language to English


void main() {
  runApp(const App());
}

// Run the app in other language (Spanish) and after opening licenses and visualizes one

class Appextends StatelessWidget {
  const GameShop({Key key}) : super(key: key);

  @override
  Widget build(BuildContext contexth) {
    return MaterialApp(
      localizationsDelegates: [
        S.delegate,
        GlobalMaterialLocalizations.delegate,
        GlobalWidgetsLocalizations.delegate,
        GlobalCupertinoLocalizations.delegate,
      ],
      supportedLocales: S.delegate.supportedLocales,
      home: Builder(
          builder: (context) => Scaffold(
              body: AboutListTile(
                  applicationName: S.of(context).example_text
              ),
          )
      ),
    );
  }
}
[√] Flutter (Channel stable, 1.22.5, on Microsoft Windows [Versión 10.0.18363.1316], locale es-MX)
    • Flutter version 1.22.5 at E:\Programs\flutter
    • Framework revision 7891006299 (5 weeks ago), 2020-12-10 11:54:40 -0800
    • Engine revision ae90085a84
    • Dart version 2.10.4

 
[√] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
    • Android SDK at C:\Users\dartz\AppData\Local\Android\Sdk
    • Platform android-30, build-tools 30.0.2
    • ANDROID_HOME = C:\Users\dartz\AppData\Local\Android\Sdk
    • Java binary at: E:\Programs\Android\Android Studio\jre\bin\java
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)
    • All Android licenses accepted.

[!] Android Studio (version 4.1.0)
    • Android Studio at E:\Programs\Android\Android Studio
    X Flutter plugin not installed; this adds Flutter specific functionality.
    X Dart plugin not installed; this adds Dart specific functionality.
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions