Internationalization (German) of the mobile app. ()

* Add i18n framework to mobile app and write simple translation generator

* Replace all texts in login_form with i18n keys

* Localization of sharing section

* Localization of asset viewer section

* Use JSON as base translation format

* Add check for missing/unused translation keys

* Add localizely

* Remove i18n directory in favour of localizely

* Backup Translation

* More translations

* Translate home page

* Translation of search page

* Translate new server version announcement

* Reformat code

* Fix typo in german translation

* Update englisch translations

* Change translation keys to match dart filenames

* Add /api to translated endpoint_urls

* Update localizely.yml

* Add languages to ios plist

* Remove unused keys

* Added script to check outdated key in other translations

* Add download key to localizely.yml

Co-authored-by: Alex <alex.tran1502@gmail.com>
This commit is contained in:
Matthias Rupp 2022-07-07 20:40:54 +02:00 committed by GitHub
parent f3032f74a4
commit 2b5cef156c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
36 changed files with 601 additions and 213 deletions
mobile/lib/modules/backup/views

View file

@ -1,4 +1,5 @@
import 'package:auto_route/auto_route.dart';
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
import 'package:flutter_hooks/flutter_hooks.dart';
import 'package:hooks_riverpod/hooks_riverpod.dart';
@ -44,9 +45,9 @@ class BackupControllerPage extends HookConsumerWidget {
color: Theme.of(context).primaryColor,
),
title: const Text(
"Server storage",
"backup_controller_page_server_storage",
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 14),
),
).tr(),
subtitle: Padding(
padding: const EdgeInsets.only(top: 8.0),
child: Column(
@ -66,8 +67,11 @@ class BackupControllerPage extends HookConsumerWidget {
),
Padding(
padding: const EdgeInsets.only(top: 12.0),
child: Text(
'${backupState.serverInfo.diskUse} of ${backupState.serverInfo.diskSize} used'),
child: const Text('backup_controller_page_storage_format').tr(
args: [
backupState.serverInfo.diskUse,
backupState.serverInfo.diskSize
]),
),
],
),
@ -76,11 +80,13 @@ class BackupControllerPage extends HookConsumerWidget {
}
ListTile _buildBackupController() {
var backUpOption =
authenticationState.deviceInfo.isAutoBackup ? "on" : "off";
var backUpOption = authenticationState.deviceInfo.isAutoBackup
? "backup_controller_page_status_on".tr()
: "backup_controller_page_status_off".tr();
var isAutoBackup = authenticationState.deviceInfo.isAutoBackup;
var backupBtnText =
authenticationState.deviceInfo.isAutoBackup ? "off" : "on";
var backupBtnText = authenticationState.deviceInfo.isAutoBackup
? "backup_controller_page_turn_off".tr()
: "backup_controller_page_turn_on".tr();
return ListTile(
isThreeLine: true,
leading: isAutoBackup
@ -90,7 +96,7 @@ class BackupControllerPage extends HookConsumerWidget {
)
: const Icon(Icons.cloud_off_rounded),
title: Text(
"Back up is $backUpOption",
backUpOption,
style: const TextStyle(fontWeight: FontWeight.bold, fontSize: 14),
),
subtitle: Padding(
@ -100,9 +106,9 @@ class BackupControllerPage extends HookConsumerWidget {
children: [
if (!isAutoBackup)
const Text(
"Turn on backup to automatically upload new assets to the server.",
"backup_controller_page_desc_backup",
style: TextStyle(fontSize: 14),
),
).tr(),
Padding(
padding: const EdgeInsets.only(top: 8.0),
child: OutlinedButton(
@ -123,7 +129,7 @@ class BackupControllerPage extends HookConsumerWidget {
.setAutoBackup(true);
}
},
child: Text("Turn $backupBtnText Backup",
child: Text(backupBtnText,
style: const TextStyle(fontWeight: FontWeight.bold)),
),
)
@ -134,13 +140,13 @@ class BackupControllerPage extends HookConsumerWidget {
}
Widget _buildSelectedAlbumName() {
var text = "Selected: ";
var text = "backup_controller_page_backup_selected".tr();
var albums = ref.watch(backupProvider).selectedBackupAlbums;
if (albums.isNotEmpty) {
for (var album in albums) {
if (album.name == "Recent" || album.name == "Recents") {
text += "${album.name} (All), ";
text += "${album.name} (${'backup_all'.tr()}), ";
} else {
text += "${album.name}, ";
}
@ -160,7 +166,7 @@ class BackupControllerPage extends HookConsumerWidget {
return Padding(
padding: const EdgeInsets.only(top: 8.0),
child: Text(
"None selected",
"backup_controller_page_none_selected".tr(),
style: TextStyle(
color: Theme.of(context).primaryColor,
fontSize: 12,
@ -171,7 +177,7 @@ class BackupControllerPage extends HookConsumerWidget {
}
Widget _buildExcludedAlbumName() {
var text = "Excluded: ";
var text = "backup_controller_page_excluded".tr();
var albums = ref.watch(backupProvider).excludedBackupAlbums;
if (albums.isNotEmpty) {
@ -207,17 +213,18 @@ class BackupControllerPage extends HookConsumerWidget {
borderOnForeground: false,
child: ListTile(
minVerticalPadding: 15,
title: const Text("Backup Albums",
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 20)),
title: const Text("backup_controller_page_albums",
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 20))
.tr(),
subtitle: Padding(
padding: const EdgeInsets.only(top: 8.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const Text(
"Albums to be backed up",
"backup_controller_page_to_backup",
style: TextStyle(color: Color(0xFF808080), fontSize: 12),
),
).tr(),
_buildSelectedAlbumName(),
_buildExcludedAlbumName()
],
@ -234,14 +241,14 @@ class BackupControllerPage extends HookConsumerWidget {
onPressed: () {
AutoRouter.of(context).push(const BackupAlbumSelectionRoute());
},
child: const Padding(
padding: EdgeInsets.symmetric(
child: Padding(
padding: const EdgeInsets.symmetric(
vertical: 16.0,
),
child: Text(
"Select",
child: const Text(
"backup_controller_page_select",
style: TextStyle(fontWeight: FontWeight.bold),
),
).tr(),
),
),
),
@ -387,9 +394,9 @@ class BackupControllerPage extends HookConsumerWidget {
appBar: AppBar(
elevation: 0,
title: const Text(
"Backup",
"backup_controller_page_backup",
style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold),
),
).tr(),
leading: IconButton(
onPressed: () {
ref.watch(websocketProvider.notifier).listenUploadEvent();
@ -405,27 +412,27 @@ class BackupControllerPage extends HookConsumerWidget {
child: ListView(
// crossAxisAlignment: CrossAxisAlignment.start,
children: [
const Padding(
padding: EdgeInsets.all(8.0),
child: Text(
"Backup Information",
Padding(
padding: const EdgeInsets.all(8.0),
child: const Text(
"backup_controller_page_info",
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 16),
),
).tr(),
),
_buildFolderSelectionTile(),
BackupInfoCard(
title: "Total",
subtitle: "All unique photos and videos from selected albums",
title: "backup_controller_page_total".tr(),
subtitle: "backup_controller_page_total_sub".tr(),
info: "${backupState.allUniqueAssets.length}",
),
BackupInfoCard(
title: "Backup",
subtitle: "Backed up photos and videos",
title: "backup_controller_page_backup".tr(),
subtitle: "backup_controller_page_backup_sub".tr(),
info: "${backupState.selectedAlbumsBackupAssetsIds.length}",
),
BackupInfoCard(
title: "Remainder",
subtitle: "Remaining photos and albums to back up from selection",
title: "backup_controller_page_remainder".tr(),
subtitle: "backup_controller_page_remainder_sub".tr(),
info:
"${backupState.allUniqueAssets.length - backupState.selectedAlbumsBackupAssetsIds.length}",
),
@ -452,12 +459,12 @@ class BackupControllerPage extends HookConsumerWidget {
ref.read(backupProvider.notifier).cancelBackup();
},
child: const Text(
"CANCEL",
"backup_controller_page_cancel",
style: TextStyle(
fontSize: 14,
fontWeight: FontWeight.bold,
),
),
).tr(),
)
: ElevatedButton(
style: ElevatedButton.styleFrom(
@ -467,12 +474,12 @@ class BackupControllerPage extends HookConsumerWidget {
),
onPressed: shouldBackup ? startBackup : null,
child: const Text(
"START BACKUP",
"backup_controller_page_start_backup",
style: TextStyle(
fontSize: 14,
fontWeight: FontWeight.bold,
),
),
).tr(),
),
),
)