LoginSignup
1
0

More than 1 year has passed since last update.

[Flutter]アプリを日本語化したい

Last updated at Posted at 2021-09-19

カウントダウンタイマーを作る上で、日本語版にしたいという希望を解決できたので、共有しておきます。

参考になったサイト : https://hazm.jp/archives/90

① pubspecにプラグインを追加する

pubspec.yamlの中に追加する(コピペでOK)

dependencies:
  flutter:
    sdk: flutter
  flutter_localizations:
    sdk: flutter

② Pub get する

自分のファイルで使えるようにしましょう。

③ main.dartに追加していく。

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

class MyApp extends StatelessWidget {
  const MyApp({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return const MaterialApp(
      localizationsDelegates: [
        GlobalMaterialLocalizations.delegate,
        GlobalWidgetsLocalizations.delegate,
        GlobalCupertinoLocalizations.delegate,
      ],
      supportedLocales: [Locale('English'), Locale('ja')],
      debugShowCheckedModeBanner: false,
      home: ????Screen(),
    );
  }
}

これでやってみるとできると思います。僕はできました。

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0