Skip to content

Commit c4e8177

Browse files
committed
intl: Set up basic i18n framework
Set up `flutter_localizations` integration and blank test bundle of ARB files. Fixes #275
1 parent 11938c7 commit c4e8177

File tree

6 files changed

+27
-0
lines changed

6 files changed

+27
-0
lines changed

assets/l10n/app_en.arb

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{}

assets/l10n/app_ja.arb

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{}

l10n.yaml

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Docs on this config file:
2+
# https://docs.flutter.dev/ui/accessibility-and-localization/internationalization#configuring-the-l10nyaml-file
3+
4+
arb-dir: assets/l10n
5+
template-arb-file: app_en.arb
6+
required-resource-attributes: true
7+
output-localization-file: zulip_localizations.dart
8+
output-class: ZulipLocalizations
9+
preferred-supported-locales: [ en ]
10+
nullable-getter: false

lib/widgets/app.dart

+3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import 'package:flutter/material.dart';
2+
import 'package:flutter_gen/gen_l10n/zulip_localizations.dart';
23

34
import '../model/narrow.dart';
45
import 'about_zulip.dart';
@@ -45,6 +46,8 @@ class ZulipApp extends StatelessWidget {
4546
return GlobalStoreWidget(
4647
child: MaterialApp(
4748
title: 'Zulip',
49+
localizationsDelegates: ZulipLocalizations.localizationsDelegates,
50+
supportedLocales: ZulipLocalizations.supportedLocales,
4851
theme: theme,
4952
home: const ChooseAccountPage()));
5053
}

pubspec.lock

+5
Original file line numberDiff line numberDiff line change
@@ -358,6 +358,11 @@ packages:
358358
url: "https://pub.dev"
359359
source: hosted
360360
version: "2.0.2"
361+
flutter_localizations:
362+
dependency: "direct main"
363+
description: flutter
364+
source: sdk
365+
version: "0.0.0"
361366
flutter_plugin_android_lifecycle:
362367
dependency: transitive
363368
description:

pubspec.yaml

+7
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@ dependencies:
5757
package_info_plus: ^4.0.1
5858
collection: ^1.17.2
5959
url_launcher: ^6.1.11
60+
flutter_localizations:
61+
sdk: flutter
6062

6163
dev_dependencies:
6264
flutter_test:
@@ -82,6 +84,11 @@ dev_dependencies:
8284
# The following section is specific to Flutter packages.
8385
flutter:
8486

87+
# Generate localization bindings from ARB files in lib/l10n/.
88+
# This happens automatically with `flutter run`
89+
# but can be manually run with `flutter gen-l10n`
90+
generate: true
91+
8592
# The following line ensures that the Material Icons font is
8693
# included with your application, so that you can use the icons in
8794
# the material Icons class.

0 commit comments

Comments
 (0)