fix(mobile): Mark more strings for translation (#5132)

* fix(mobile): Mark more strings for translation

Moving more strings to the `i18n` JSON file, and also including their
es-US translations.

* Add more translatable strings
This commit is contained in:
Michael Manganiello 2023-11-18 21:32:28 -05:00 committed by GitHub
parent f5ce3deb3a
commit 6d310d6297
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 181 additions and 72 deletions

View file

@ -30,7 +30,7 @@ class AlbumOptionsPage extends HookConsumerWidget {
Navigator.pop(context);
ImmichToast.show(
context: context,
msg: "Error leaving/removing from album",
msg: "shared_album_section_people_action_error".tr(),
toastType: ToastType.error,
gravity: ToastGravity.BOTTOM,
);
@ -81,7 +81,7 @@ class AlbumOptionsPage extends HookConsumerWidget {
actions = [
ListTile(
leading: const Icon(Icons.exit_to_app_rounded),
title: const Text("Leave album"),
title: const Text("shared_album_section_people_action_leave").tr(),
onTap: leaveAlbum,
),
];
@ -91,7 +91,7 @@ class AlbumOptionsPage extends HookConsumerWidget {
actions = [
ListTile(
leading: const Icon(Icons.person_remove_rounded),
title: const Text("Remove user from album"),
title: const Text("shared_album_section_people_remove_user").tr(),
onTap: () => removeUserFromAlbum(user),
),
];
@ -130,11 +130,11 @@ class AlbumOptionsPage extends HookConsumerWidget {
style: TextStyle(color: Colors.grey[500]),
),
trailing: const Text(
"Owner",
"shared_album_section_people_owner_label",
style: TextStyle(
fontWeight: FontWeight.bold,
),
),
).tr(),
);
}
@ -215,7 +215,7 @@ class AlbumOptionsPage extends HookConsumerWidget {
subtitle:
const Text("shared_album_activity_setting_subtitle").tr(),
),
buildSectionTitle("PEOPLE"),
buildSectionTitle("shared_album_section_people_title".tr()),
buildOwnerInfo(),
buildSharedUsersList(),
],

View file

@ -358,7 +358,7 @@ class LoginForm extends HookConsumerWidget {
TextButton.icon(
icon: const Icon(Icons.arrow_back),
onPressed: () => serverEndpoint.value = null,
label: const Text('Back'),
label: const Text('login_form_back_button_text').tr(),
),
],
),

View file

@ -176,7 +176,7 @@ class AssetsInBoundBottomSheetState extends ConsumerState<MapPageBottomSheet> {
Widget buildDragHandle(ScrollController scrollController) {
final textToDisplay = assetsInBound.value.isNotEmpty
? "${assetsInBound.value.length} photo${assetsInBound.value.length > 1 ? "s" : ""}"
? "map_assets_in_bounds".plural(assetsInBound.value.length)
: "map_no_assets_in_bounds".tr();
final dragHandle = Container(
height: 60,

View file

@ -76,18 +76,21 @@ class MapSettingsDialog extends HookConsumerWidget {
showRelativeDate.value = value!;
},
dropdownMenuEntries: [
const DropdownMenuEntry(value: 0, label: "All"),
const DropdownMenuEntry(
DropdownMenuEntry(
value: 0,
label: "map_settings_date_range_option_all".tr(),
),
DropdownMenuEntry(
value: 1,
label: "Past 24 hours",
label: "map_settings_date_range_option_days".plural(1),
),
const DropdownMenuEntry(
DropdownMenuEntry(
value: 7,
label: "Past 7 days",
label: "map_settings_date_range_option_days".plural(7),
),
const DropdownMenuEntry(
DropdownMenuEntry(
value: 30,
label: "Past 30 days",
label: "map_settings_date_range_option_days".plural(30),
),
DropdownMenuEntry(
value: now
@ -102,7 +105,7 @@ class MapSettingsDialog extends HookConsumerWidget {
),
)
.inDays,
label: "Past year",
label: "map_settings_date_range_option_years".plural(1),
),
DropdownMenuEntry(
value: now
@ -117,7 +120,7 @@ class MapSettingsDialog extends HookConsumerWidget {
),
)
.inDays,
label: "Past 3 years",
label: "map_settings_date_range_option_years".plural(3),
),
],
);

View file

@ -1,3 +1,4 @@
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
import 'package:immich_mobile/extensions/build_context_extensions.dart';
import 'package:immich_mobile/modules/map/ui/map_thumbnail.dart';
@ -64,18 +65,18 @@ class CuratedPlacesRow extends CuratedRow {
),
),
),
const Align(
Align(
alignment: Alignment.bottomCenter,
child: Padding(
padding: EdgeInsets.only(bottom: 10),
child: Text(
"Your Map",
padding: const EdgeInsets.only(bottom: 10),
child: const Text(
"search_page_your_map",
style: TextStyle(
color: Colors.white,
fontWeight: FontWeight.bold,
fontSize: 14,
),
),
).tr(),
),
),
],

View file

@ -1,3 +1,4 @@
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';
@ -27,15 +28,15 @@ class PersonNameEditForm extends HookConsumerWidget {
return AlertDialog(
title: const Text(
"Add a name",
"search_page_person_add_name_dialog_title",
style: TextStyle(fontWeight: FontWeight.bold),
),
).tr(),
content: SingleChildScrollView(
child: TextFormField(
controller: controller,
autofocus: true,
decoration: const InputDecoration(
hintText: 'Name',
decoration: InputDecoration(
hintText: 'search_page_person_add_name_dialog_hint'.tr(),
),
),
),
@ -49,12 +50,12 @@ class PersonNameEditForm extends HookConsumerWidget {
);
},
child: Text(
"Cancel",
"search_page_person_add_name_dialog_cancel",
style: TextStyle(
color: Colors.red[300],
fontWeight: FontWeight.bold,
),
),
).tr(),
),
TextButton(
onPressed: () {
@ -70,12 +71,12 @@ class PersonNameEditForm extends HookConsumerWidget {
);
},
child: Text(
"Save",
"search_page_person_add_name_dialog_save",
style: TextStyle(
color: context.primaryColor,
fontWeight: FontWeight.bold,
),
),
).tr(),
),
],
);

View file

@ -1,3 +1,4 @@
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';
@ -52,9 +53,9 @@ class PersonResultPage extends HookConsumerWidget {
ListTile(
leading: const Icon(Icons.edit_outlined),
title: const Text(
'Edit name',
'search_page_person_edit_name',
style: TextStyle(fontWeight: FontWeight.bold),
),
).tr(),
onTap: showEditNameDialog,
),
],
@ -72,15 +73,15 @@ class PersonResultPage extends HookConsumerWidget {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'Add a name',
'search_page_person_add_name_title',
style: context.textTheme.titleSmall?.copyWith(
color: context.themeData.colorScheme.secondary,
),
),
).tr(),
Text(
'Find them fast by name with search',
'search_page_person_add_name_subtitle',
style: context.textTheme.labelSmall,
),
).tr(),
],
),
);

View file

@ -198,7 +198,7 @@ class SearchPage extends HookConsumerWidget {
).tr(),
),
ListTile(
title: Text('Screenshots', style: categoryTitleStyle).tr(),
title: Text('search_page_screenshots', style: categoryTitleStyle).tr(),
leading: Icon(
Icons.screenshot,
color: categoryIconColor,

View file

@ -68,11 +68,10 @@ class AdvancedSettings extends HookConsumerWidget {
),
ListTile(
dense: true,
title: Text(
// Not translated because the levels are only English
"Log level: $logLevel",
style: const TextStyle(fontWeight: FontWeight.bold),
),
title: const Text(
"advanced_settings_log_level_title",
style: TextStyle(fontWeight: FontWeight.bold),
).tr(args: [logLevel]),
subtitle: Slider(
value: levelId.value.toDouble(),
onChanged: (double v) => levelId.value = v.toInt(),

View file

@ -42,12 +42,12 @@ class LocalStorageSettings extends HookConsumerWidget {
children: [
ListTile(
title: Text(
"Duplicated Assets (${cacheItemCount.value})",
"cache_settings_duplicated_assets_title",
style: context.textTheme.labelLarge
?.copyWith(fontWeight: FontWeight.bold),
).tr(),
).tr(args: ["${cacheItemCount.value}"]),
subtitle: const Text(
"Photos and videos that are black listed by the app",
"cache_settings_duplicated_assets_subtitle",
style: TextStyle(
fontSize: 13,
),
@ -55,7 +55,7 @@ class LocalStorageSettings extends HookConsumerWidget {
trailing: TextButton(
onPressed: cacheItemCount.value > 0 ? clearCache : null,
child: Text(
"CLEAR",
"cache_settings_duplicated_assets_clear_button",
style: TextStyle(
fontSize: 12,
color: cacheItemCount.value > 0 ? Colors.red : Colors.grey,

View file

@ -230,31 +230,34 @@ class SharedLinkEditPage extends HookConsumerWidget {
borderSide: BorderSide(color: Colors.grey),
),
),
dropdownMenuEntries: const [
DropdownMenuEntry(value: 0, label: "Never"),
dropdownMenuEntries: [
DropdownMenuEntry(
value: 0,
label: "shared_link_edit_expire_after_option_never".tr(),
),
DropdownMenuEntry(
value: 30,
label: '30 minutes',
label: "shared_link_edit_expire_after_option_minutes".plural(30),
),
DropdownMenuEntry(
value: 60,
label: '1 hour',
label: "shared_link_edit_expire_after_option_hours".plural(1),
),
DropdownMenuEntry(
value: 60 * 6,
label: '6 hours',
label: "shared_link_edit_expire_after_option_hours".plural(6),
),
DropdownMenuEntry(
value: 60 * 24,
label: '1 day',
label: "shared_link_edit_expire_after_option_days".plural(1),
),
DropdownMenuEntry(
value: 60 * 24 * 7,
label: '7 days',
label: "shared_link_edit_expire_after_option_days".plural(7),
),
DropdownMenuEntry(
value: 60 * 24 * 30,
label: '30 days',
label: "shared_link_edit_expire_after_option_days".plural(30),
),
],
);
@ -265,15 +268,15 @@ class SharedLinkEditPage extends HookConsumerWidget {
ClipboardData(
text: passwordController.text.isEmpty
? newShareLink.value
: "Link: ${newShareLink.value}\nPassword: ${passwordController.text}",
: "shared_link_clipboard_text".tr(
args: [newShareLink.value, passwordController.text],
),
),
).then((_) {
ScaffoldMessenger.of(context).showSnackBar(
const SnackBar(
content: Text(
"Copied to clipboard",
),
duration: Duration(seconds: 2),
SnackBar(
content: const Text("shared_link_clipboard_copied_massage").tr(),
duration: const Duration(seconds: 2),
),
);
});
@ -310,7 +313,7 @@ class SharedLinkEditPage extends HookConsumerWidget {
context.autoPop();
},
child: const Text(
"Done",
"share_done",
style: TextStyle(
fontSize: 14,
fontWeight: FontWeight.bold,
@ -353,7 +356,7 @@ class SharedLinkEditPage extends HookConsumerWidget {
context: context,
gravity: ToastGravity.BOTTOM,
toastType: ToastType.error,
msg: 'Error while creating shared link',
msg: 'shared_link_create_error'.tr(),
);
}
}