Skip to content

Commit

Permalink
intl: Set up basic i18n framework
Browse files Browse the repository at this point in the history
Set up `flutter_localizations` integration and blank
test bundle of ARB files.

Fixes: zulip#275
  • Loading branch information
sirpengi authored and gnprice committed Sep 14, 2023
1 parent 7834dce commit c88b990
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 0 deletions.
1 change: 1 addition & 0 deletions assets/l10n/app_en.arb
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
1 change: 1 addition & 0 deletions assets/l10n/app_ja.arb
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
11 changes: 11 additions & 0 deletions l10n.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Docs on this config file:
# https://docs.flutter.dev/ui/accessibility-and-localization/internationalization#configuring-the-l10nyaml-file

arb-dir: assets/l10n
template-arb-file: app_en.arb
required-resource-attributes: true
output-localization-file: zulip_localizations.dart
untranslated-messages-file: build/untranslated_messages.json
output-class: ZulipLocalizations
preferred-supported-locales: [ en ]
nullable-getter: false
3 changes: 3 additions & 0 deletions lib/widgets/app.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/zulip_localizations.dart';

import '../model/narrow.dart';
import 'about_zulip.dart';
Expand Down Expand Up @@ -45,6 +46,8 @@ class ZulipApp extends StatelessWidget {
return GlobalStoreWidget(
child: MaterialApp(
title: 'Zulip',
localizationsDelegates: ZulipLocalizations.localizationsDelegates,
supportedLocales: ZulipLocalizations.supportedLocales,
theme: theme,
home: const ChooseAccountPage()));
}
Expand Down
5 changes: 5 additions & 0 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,11 @@ packages:
url: "https://pub.dev"
source: hosted
version: "2.0.2"
flutter_localizations:
dependency: "direct main"
description: flutter
source: sdk
version: "0.0.0"
flutter_plugin_android_lifecycle:
dependency: transitive
description:
Expand Down
7 changes: 7 additions & 0 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ dependencies:
package_info_plus: ^4.0.1
collection: ^1.17.2
url_launcher: ^6.1.11
flutter_localizations:
sdk: flutter

dev_dependencies:
flutter_test:
Expand All @@ -82,6 +84,11 @@ dev_dependencies:
# The following section is specific to Flutter packages.
flutter:

# Generate localization bindings from ARB files in lib/l10n/.
# This happens automatically with `flutter run`
# but can be manually run with `flutter gen-l10n`
generate: true

# The following line ensures that the Material Icons font is
# included with your application, so that you can use the icons in
# the material Icons class.
Expand Down

0 comments on commit c88b990

Please sign in to comment.