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:path/path.dart' as p;
|
||||||
import 'package:flutter_runtime_env/flutter_runtime_env.dart' as runtime_env;
|
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:git_bindings/git_bindings.dart';
|
||||||
|
|
||||||
import 'package:gitjournal/apis/git.dart';
|
import 'package:gitjournal/apis/git.dart';
|
||||||
@ -59,7 +62,7 @@ class JournalApp extends StatelessWidget {
|
|||||||
appState.save(pref);
|
appState.save(pref);
|
||||||
}
|
}
|
||||||
|
|
||||||
runApp(ChangeNotifierProvider(
|
var app = ChangeNotifierProvider(
|
||||||
create: (_) {
|
create: (_) {
|
||||||
return StateContainer(appState);
|
return StateContainer(appState);
|
||||||
},
|
},
|
||||||
@ -70,6 +73,14 @@ class JournalApp extends StatelessWidget {
|
|||||||
return appState.notesFolder;
|
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(
|
return MaterialApp(
|
||||||
key: const ValueKey("App"),
|
key: const ValueKey("App"),
|
||||||
title: 'GitJournal',
|
title: 'GitJournal',
|
||||||
|
|
||||||
|
localizationsDelegates: EasyLocalization.of(context).delegates,
|
||||||
|
supportedLocales: EasyLocalization.of(context).supportedLocales,
|
||||||
|
locale: EasyLocalization.of(context).locale,
|
||||||
|
|
||||||
theme: themeData,
|
theme: themeData,
|
||||||
navigatorObservers: <NavigatorObserver>[JournalApp.observer],
|
navigatorObservers: <NavigatorObserver>[JournalApp.observer],
|
||||||
initialRoute: initialRoute,
|
initialRoute: initialRoute,
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:easy_localization/easy_localization.dart';
|
||||||
|
|
||||||
import 'package:gitjournal/core/notes_folder_fs.dart';
|
import 'package:gitjournal/core/notes_folder_fs.dart';
|
||||||
import 'package:gitjournal/screens/settings_editors.dart';
|
import 'package:gitjournal/screens/settings_editors.dart';
|
||||||
import 'package:gitjournal/settings.dart';
|
import 'package:gitjournal/settings.dart';
|
||||||
@ -91,10 +93,10 @@ class SettingsListState extends State<SettingsList> {
|
|||||||
key: gitAuthorEmailKey,
|
key: gitAuthorEmailKey,
|
||||||
style: Theme.of(context).textTheme.title,
|
style: Theme.of(context).textTheme.title,
|
||||||
keyboardType: TextInputType.emailAddress,
|
keyboardType: TextInputType.emailAddress,
|
||||||
decoration: const InputDecoration(
|
decoration: InputDecoration(
|
||||||
icon: Icon(Icons.email),
|
icon: Icon(Icons.email),
|
||||||
hintText: 'Who should author the changes?',
|
hintText: 'Who should author the changes?',
|
||||||
labelText: 'Email',
|
labelText: tr('email'),
|
||||||
),
|
),
|
||||||
validator: (String value) {
|
validator: (String value) {
|
||||||
value = value.trim();
|
value = value.trim();
|
||||||
|
30
pubspec.lock
30
pubspec.lock
@ -141,6 +141,13 @@ packages:
|
|||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.16.1"
|
version: "0.16.1"
|
||||||
|
csv:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: csv
|
||||||
|
url: "https://pub.dartlang.org"
|
||||||
|
source: hosted
|
||||||
|
version: "4.0.3"
|
||||||
dart_git:
|
dart_git:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
@ -171,6 +178,20 @@ packages:
|
|||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.0.1"
|
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:
|
equatable:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
@ -251,6 +272,11 @@ packages:
|
|||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.7.4"
|
version: "0.7.4"
|
||||||
|
flutter_localizations:
|
||||||
|
dependency: "direct main"
|
||||||
|
description: flutter
|
||||||
|
source: sdk
|
||||||
|
version: "0.0.0"
|
||||||
flutter_markdown:
|
flutter_markdown:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
@ -687,7 +713,7 @@ packages:
|
|||||||
name: shared_preferences
|
name: shared_preferences
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.5.6"
|
version: "0.5.7"
|
||||||
shared_preferences_macos:
|
shared_preferences_macos:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@ -977,4 +1003,4 @@ packages:
|
|||||||
version: "0.0.5"
|
version: "0.0.5"
|
||||||
sdks:
|
sdks:
|
||||||
dart: ">=2.7.0 <3.0.0"
|
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:
|
dependencies:
|
||||||
flutter:
|
flutter:
|
||||||
sdk: flutter
|
sdk: flutter
|
||||||
|
flutter_localizations:
|
||||||
|
sdk: flutter
|
||||||
intl: "^0.16.0"
|
intl: "^0.16.0"
|
||||||
path: ^1.6.2
|
path: ^1.6.2
|
||||||
uuid: ^2.0.1
|
uuid: ^2.0.1
|
||||||
@ -52,6 +54,8 @@ dependencies:
|
|||||||
flutter_webview_plugin:
|
flutter_webview_plugin:
|
||||||
git: https://github.com/breez/flutter_webview_plugin.git
|
git: https://github.com/breez/flutter_webview_plugin.git
|
||||||
image_picker: ^0.6.6+1
|
image_picker: ^0.6.6+1
|
||||||
|
easy_localization: ^2.2.1
|
||||||
|
easy_localization_loader: ^0.0.2
|
||||||
|
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
flutter_launcher_icons: "^0.7.2"
|
flutter_launcher_icons: "^0.7.2"
|
||||||
@ -71,6 +75,7 @@ flutter:
|
|||||||
- "assets/icon/gitlab-icon.png"
|
- "assets/icon/gitlab-icon.png"
|
||||||
- "assets/OnBoardingMarkdown.png"
|
- "assets/OnBoardingMarkdown.png"
|
||||||
- "assets/OnBoardingGitProviders.png"
|
- "assets/OnBoardingGitProviders.png"
|
||||||
|
- "assets/langs/en.yaml"
|
||||||
fonts:
|
fonts:
|
||||||
- family: Lato
|
- family: Lato
|
||||||
fonts:
|
fonts:
|
||||||
|
Reference in New Issue
Block a user