mirror of
https://github.com/GitJournal/GitJournal.git
synced 2025-06-28 18:03:14 +08:00
Add basic scaffolding for translations
I still need to go through all the public string and document them.
This commit is contained in:
1
assets/langs/en.yaml
Normal file
1
assets/langs/en.yaml
Normal file
@ -0,0 +1 @@
|
||||
email: Email
|
18
lib/app.dart
18
lib/app.dart
@ -11,6 +11,9 @@ import 'package:provider/provider.dart';
|
||||
import 'package:path/path.dart' as p;
|
||||
import 'package:flutter_runtime_env/flutter_runtime_env.dart' as runtime_env;
|
||||
|
||||
import 'package:easy_localization/easy_localization.dart';
|
||||
import 'package:easy_localization_loader/easy_localization_loader.dart';
|
||||
|
||||
import 'package:git_bindings/git_bindings.dart';
|
||||
|
||||
import 'package:gitjournal/apis/git.dart';
|
||||
@ -59,7 +62,7 @@ class JournalApp extends StatelessWidget {
|
||||
appState.save(pref);
|
||||
}
|
||||
|
||||
runApp(ChangeNotifierProvider(
|
||||
var app = ChangeNotifierProvider(
|
||||
create: (_) {
|
||||
return StateContainer(appState);
|
||||
},
|
||||
@ -70,6 +73,14 @@ class JournalApp extends StatelessWidget {
|
||||
return appState.notesFolder;
|
||||
},
|
||||
),
|
||||
);
|
||||
|
||||
runApp(EasyLocalization(
|
||||
child: app,
|
||||
supportedLocales: [const Locale('en', 'US')],
|
||||
path: 'assets/langs',
|
||||
useOnlyLangCode: true,
|
||||
assetLoader: YamlAssetLoader(),
|
||||
));
|
||||
}
|
||||
|
||||
@ -135,6 +146,11 @@ class JournalApp extends StatelessWidget {
|
||||
return MaterialApp(
|
||||
key: const ValueKey("App"),
|
||||
title: 'GitJournal',
|
||||
|
||||
localizationsDelegates: EasyLocalization.of(context).delegates,
|
||||
supportedLocales: EasyLocalization.of(context).supportedLocales,
|
||||
locale: EasyLocalization.of(context).locale,
|
||||
|
||||
theme: themeData,
|
||||
navigatorObservers: <NavigatorObserver>[JournalApp.observer],
|
||||
initialRoute: initialRoute,
|
||||
|
@ -1,4 +1,6 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:easy_localization/easy_localization.dart';
|
||||
|
||||
import 'package:gitjournal/core/notes_folder_fs.dart';
|
||||
import 'package:gitjournal/screens/settings_editors.dart';
|
||||
import 'package:gitjournal/settings.dart';
|
||||
@ -91,10 +93,10 @@ class SettingsListState extends State<SettingsList> {
|
||||
key: gitAuthorEmailKey,
|
||||
style: Theme.of(context).textTheme.title,
|
||||
keyboardType: TextInputType.emailAddress,
|
||||
decoration: const InputDecoration(
|
||||
decoration: InputDecoration(
|
||||
icon: Icon(Icons.email),
|
||||
hintText: 'Who should author the changes?',
|
||||
labelText: 'Email',
|
||||
labelText: tr('email'),
|
||||
),
|
||||
validator: (String value) {
|
||||
value = value.trim();
|
||||
|
30
pubspec.lock
30
pubspec.lock
@ -141,6 +141,13 @@ packages:
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.16.1"
|
||||
csv:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: csv
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "4.0.3"
|
||||
dart_git:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
@ -171,6 +178,20 @@ packages:
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.0.1"
|
||||
easy_localization:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: easy_localization
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.2.1"
|
||||
easy_localization_loader:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: easy_localization_loader
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.0.2"
|
||||
equatable:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
@ -251,6 +272,11 @@ packages:
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.7.4"
|
||||
flutter_localizations:
|
||||
dependency: "direct main"
|
||||
description: flutter
|
||||
source: sdk
|
||||
version: "0.0.0"
|
||||
flutter_markdown:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
@ -687,7 +713,7 @@ packages:
|
||||
name: shared_preferences
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.5.6"
|
||||
version: "0.5.7"
|
||||
shared_preferences_macos:
|
||||
dependency: transitive
|
||||
description:
|
||||
@ -977,4 +1003,4 @@ packages:
|
||||
version: "0.0.5"
|
||||
sdks:
|
||||
dart: ">=2.7.0 <3.0.0"
|
||||
flutter: ">=1.12.13+hotfix.4 <2.0.0"
|
||||
flutter: ">=1.12.13+hotfix.5 <2.0.0"
|
||||
|
@ -5,6 +5,8 @@ version: 1.50.0+10
|
||||
dependencies:
|
||||
flutter:
|
||||
sdk: flutter
|
||||
flutter_localizations:
|
||||
sdk: flutter
|
||||
intl: "^0.16.0"
|
||||
path: ^1.6.2
|
||||
uuid: ^2.0.1
|
||||
@ -52,6 +54,8 @@ dependencies:
|
||||
flutter_webview_plugin:
|
||||
git: https://github.com/breez/flutter_webview_plugin.git
|
||||
image_picker: ^0.6.6+1
|
||||
easy_localization: ^2.2.1
|
||||
easy_localization_loader: ^0.0.2
|
||||
|
||||
dev_dependencies:
|
||||
flutter_launcher_icons: "^0.7.2"
|
||||
@ -71,6 +75,7 @@ flutter:
|
||||
- "assets/icon/gitlab-icon.png"
|
||||
- "assets/OnBoardingMarkdown.png"
|
||||
- "assets/OnBoardingGitProviders.png"
|
||||
- "assets/langs/en.yaml"
|
||||
fonts:
|
||||
- family: Lato
|
||||
fonts:
|
||||
|
Reference in New Issue
Block a user