Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Localization l10n #1264

Merged
merged 27 commits into from
Jun 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
f7a4796
carete l10n feature
Eldar2021 Jun 7, 2023
2c08edd
added home translations
Eldar2021 Jun 7, 2023
f5326d0
added account translations
Eldar2021 Jun 7, 2023
eb0ceed
added Assets translations
Eldar2021 Jun 7, 2023
6a75d28
added bazaar translations
Eldar2021 Jun 7, 2023
5bdee97
added encointer translations
Eldar2021 Jun 7, 2023
59dc3d1
Added profile translations
Eldar2021 Jun 7, 2023
30a2632
added transaction translations
Eldar2021 Jun 7, 2023
d92bbc5
deleted repeated words
Eldar2021 Jun 8, 2023
34dadab
commented encointer translations
Eldar2021 Jun 8, 2023
2c5e25c
fix all lint error
Eldar2021 Jun 8, 2023
8de09f0
try fix some dictitionary
Eldar2021 Jun 8, 2023
e210da4
try fix varibles arb
Eldar2021 Jun 8, 2023
149d078
rename dic -> l10n
Eldar2021 Jun 9, 2023
7f8afe3
format arb files
Eldar2021 Jun 9, 2023
0d06435
deleted unused old translations
Eldar2021 Jun 9, 2023
1b4edb8
deleted unused warnings json file
Eldar2021 Jun 9, 2023
68d7f0d
rename translation -> l10n
Eldar2021 Jun 9, 2023
daab1ea
refactoring code
Eldar2021 Jun 9, 2023
0767076
pulled origin master fixed all conflicts
Eldar2021 Jun 9, 2023
1b07f5c
pulled origin master
Eldar2021 Jun 12, 2023
21f9ef4
pulled origin master and fixed all conflicts
Eldar2021 Jun 13, 2023
d1b0910
deleted validateAccount
Eldar2021 Jun 13, 2023
85e618f
fix by comment
Eldar2021 Jun 14, 2023
e77d2aa
pulled origin master and fixed all conflicts
Eldar2021 Jun 14, 2023
910abeb
try fix unit test
Eldar2021 Jun 14, 2023
e08e4e4
try fix pdf Cyrillic alphabet
Eldar2021 Jun 15, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions app/l10n.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
arb-dir: lib/l10n/arb
template-arb-file: app_en.arb
output-localization-file: app_localizations.dart
nullable-getter: false
Comment on lines +1 to +4
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

arb-dir: lib/l10n/arb - Path to the directory containing the texts
template-arb-file: app_en.arb - Will generate based on app_en.arb. The parameter type it takes, for example...
output-localization-file: app_localizations.dart - Name of the file to be generated
nullable-getter: false - We don't have nullable texts yet

12 changes: 3 additions & 9 deletions app/lib/app.dart
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import 'package:flutter/material.dart';
import 'package:flutter_localizations/flutter_localizations.dart';
import 'package:flutter_mobx/flutter_mobx.dart';
import 'package:provider/provider.dart';
import 'package:encointer_wallet/l10n/l10.dart';

import 'package:encointer_wallet/modules/modules.dart';
import 'package:encointer_wallet/router/app_router.dart';
import 'package:encointer_wallet/utils/snack_bar.dart';
import 'package:encointer_wallet/utils/translations/index.dart';

class WalletApp extends StatelessWidget {
const WalletApp({super.key});
Expand All @@ -28,13 +27,8 @@ class WalletApp extends StatelessWidget {
return MaterialApp(
title: 'EncointerWallet',
locale: appSettings.locale,
localizationsDelegates: [
AppLocalizationsDelegate(appSettings.locale),
GlobalMaterialLocalizations.delegate,
GlobalCupertinoLocalizations.delegate,
GlobalWidgetsLocalizations.delegate,
],
supportedLocales: appSettings.locales,
Comment on lines -31 to -37
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now these are available within AppLocalizations.

localizationsDelegates: AppLocalizations.localizationsDelegates,
supportedLocales: AppLocalizations.supportedLocales,
initialRoute: SplashView.route,
theme: appSettings.theme.light,
scaffoldMessengerKey: rootScaffoldMessengerKey,
Expand Down
5 changes: 2 additions & 3 deletions app/lib/common/components/address_input_field.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import 'package:encointer_wallet/theme/theme.dart';
import 'package:encointer_wallet/store/account/types/account_data.dart';
import 'package:encointer_wallet/store/app.dart';
import 'package:encointer_wallet/utils/format.dart';
import 'package:encointer_wallet/utils/translations/index.dart';
import 'package:encointer_wallet/l10n/l10.dart';

class AddressInputField extends StatefulWidget {
const AddressInputField(
Expand Down Expand Up @@ -97,7 +97,6 @@ class _AddressInputFieldState extends State<AddressInputField> {

@override
Widget build(BuildContext context) {
final dic = I18n.of(context)!.translationsForLocale();
return DecoratedBox(
decoration: BoxDecoration(
color: context.colorScheme.background,
Expand All @@ -124,7 +123,7 @@ class _AddressInputFieldState extends State<AddressInputField> {
),
selectedItem: widget.initialValue,
compareFn: (AccountData i, s) => i.pubKey == s.pubKey,
validator: (AccountData? u) => u == null ? dic.profile.errorUserNameIsRequired : null,
validator: (AccountData? u) => u == null ? context.l10n.errorUserNameIsRequired : null,
items: widget.store.account.accountListAll,
filterFn: filterByAddressOrName,
onChanged: (AccountData? data) {
Expand Down
10 changes: 5 additions & 5 deletions app/lib/common/components/error/error_view.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import 'package:flutter/material.dart';

import 'package:encointer_wallet/theme/theme.dart';
import 'package:encointer_wallet/utils/translations/index.dart';
import 'package:encointer_wallet/l10n/l10.dart';

class ErrorView extends StatelessWidget {
const ErrorView({
Expand All @@ -15,7 +15,7 @@ class ErrorView extends StatelessWidget {

@override
Widget build(BuildContext context) {
final dic = I18n.of(context)!.translationsForLocale().home;
final l10n = context.l10n;
final textTheme = Theme.of(context).textTheme;
return Center(
child: Column(
Expand All @@ -24,21 +24,21 @@ class ErrorView extends StatelessWidget {
const Icon(Icons.error_outline, size: 70),
const SizedBox(height: 40),
Text(
dic.error,
l10n.error,
style: textTheme.displayLarge!.copyWith(color: AppColors.encointerGrey),
textAlign: TextAlign.center,
),
const SizedBox(height: 20),
Text(
errorMessage ?? dic.unknownError,
errorMessage ?? l10n.unknownError,
style: textTheme.titleLarge!.copyWith(color: AppColors.encointerGrey),
textAlign: TextAlign.center,
),
const SizedBox(height: 20),
if (onRetryPressed != null)
ElevatedButton(
onPressed: onRetryPressed,
child: Text(dic.retry),
child: Text(l10n.retry),
),
const SizedBox(height: 40),
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,19 @@ import 'package:flutter/material.dart';

import 'package:encointer_wallet/theme/theme.dart';
import 'package:encointer_wallet/service/launch/app_launch.dart';
import 'package:encointer_wallet/utils/translations/index.dart';
import 'package:encointer_wallet/l10n/l10.dart';

class SendToTrelloListTile extends StatelessWidget {
const SendToTrelloListTile({super.key});

@override
Widget build(BuildContext context) {
final dic = I18n.of(context)!.translationsForLocale().profile;
final h3Grey = context.textTheme.displaySmall!.copyWith(color: AppColors.encointerGrey);
return ListTile(
title: Text(dic.contactUs, style: h3Grey),
title: Text(context.l10n.contactUs, style: h3Grey),
onTap: () async => AppLaunch.sendEmail(
'bugreports@mail.encointer.org',
snackBarText: dic.checkEmailApp,
snackBarText: context.l10n.checkEmailApp,
context: context,
),
);
Expand Down
Loading