Skip to content

Incorrect Japanese Kanji Display on Android with Japanese Locale #65

@edo-bari-ikutsu

Description

@edo-bari-ikutsu

When an Android device is set to the Japanese language, some Kanji characters in the S3Drive app are displayed in their Chinese form instead of their Japanese form.

Image

I understand S3Drive uses Flutter. I propose that the app should detect the device's language setting upon startup and adjust the font rendering accordingly.

class MainApp extends StatelessWidget {
  const MainApp({super.key});

  @override
  Widget build(BuildContext context) {
    // Retrieve locale of the terminal without countryCode
    // to avoid misconfiguration of font in some OPPO terminal
    var locale = WidgetsBinding.instance.platformDispatcher.locale;
    locale = Locale.fromSubtags(
      languageCode: locale.languageCode,
      scriptCode: locale.scriptCode,
    );
    return MaterialApp(
      // set locale of the terminal to supportedLocales
      supportedLocales: [locale],
      home: ...
    );
  }
}

I've tested a solution where the Japanese Kanji displayed correctly on Android terminals set to Japanese.

Image

Conversely, on Android terminals with non-Japanese language settings, Chinese Kanji were displayed, which is the expected behavior.

Image

Full sample code content is available as follows:
https://github.com/edo-bari-ikutsu/flutter-font-eval

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions