Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Localize untranslated Photos strings

Neeraj Gupta96e7fca3f48c
diff --git a/mobile/apps/photos/lib/ui/rituals/start_new_ritual_card.dart b/mobile/apps/photos/lib/ui/rituals/start_new_ritual_card.dart
index 308ef22d18..7c0a44efe6 100644
--- a/mobile/apps/photos/lib/ui/rituals/start_new_ritual_card.dart
+++ b/mobile/apps/photos/lib/ui/rituals/start_new_ritual_card.dart
@@ -2,9 +2,9 @@ import "dart:math" as math;
import "package:ente_components/theme/text_styles.dart";
import "package:ente_icons/ente_icons.dart";
+import "package:ente_strings/ente_strings.dart";
import "package:flutter/material.dart";
import "package:photos/theme/ente_theme.dart";
-import "package:photos/utils/pending_translation.dart";
enum StartNewRitualCardVariant { compact, wide }
@@ -37,7 +37,7 @@ class StartNewRitualCard extends StatelessWidget {
static double compactHeightFor(BuildContext context) {
final titleHeight = _measuredTextHeight(
context,
- text: pendingTranslation("Start new ritual"),
+ text: context.strings.ritualStartNew,
style: _compactTitleStyle(Colors.black),
maxWidth: _compactWidth - 24,
);
@@ -55,10 +55,8 @@ class StartNewRitualCard extends StatelessWidget {
final colorScheme = getEnteColorScheme(context);
final borderRadius = BorderRadius.circular(_cardRadius);
- final titleText = pendingTranslation("Start new ritual");
- final subtitleText = pendingTranslation(
- "Create a ritual, build streaks, and share your progress.",
- );
+ final titleText = context.strings.ritualStartNew;
+ final subtitleText = context.strings.ritualStartNewDescription;
return LayoutBuilder(
builder: (context, constraints) {
@@ -183,7 +181,7 @@ class _CompactStartNewRitualCard extends StatelessWidget {
Padding(
padding: const EdgeInsets.symmetric(horizontal: 12),
child: Text(
- pendingTranslation("Start new ritual"),
+ context.strings.ritualStartNew,
style: _compactTitleStyle(colorScheme.textBase),
textAlign: TextAlign.center,
textHeightBehavior: _tightTextHeightBehavior,
diff --git a/mobile/apps/photos/lib/ui/settings/gallery_settings_screen.dart b/mobile/apps/photos/lib/ui/settings/gallery_settings_screen.dart
index 911ed92da6..b3006319ab 100644
--- a/mobile/apps/photos/lib/ui/settings/gallery_settings_screen.dart
+++ b/mobile/apps/photos/lib/ui/settings/gallery_settings_screen.dart
@@ -23,13 +23,13 @@ class GallerySettingsScreen extends StatefulWidget {
class _GallerySettingsScreenState extends State<GallerySettingsScreen> {
late int _photoGridSize;
- late String _groupType;
+ late GroupType _groupType;
@override
void initState() {
super.initState();
_photoGridSize = localSettings.getPhotoGridSize();
- _groupType = localSettings.getGalleryGroupType().name;
+ _groupType = localSettings.getGalleryGroupType();
}
@override
@@ -47,7 +47,10 @@ class _GallerySettingsScreenState extends State<GallerySettingsScreen> {
const SizedBox(height: 8),
SettingsItem(
title: l10n.groupBy,
- trailing: _trailingLabel(context, _groupType),
+ trailing: _trailingLabel(
+ context,
+ _groupType.getLocalizedName(context),
+ ),
onTap: () async => _showGroupTypeSheet(context),
),
if (!widget.fromGalleryLayoutSettingsCTA && !isLocalGalleryMode) ...[
@@ -130,7 +133,6 @@ class _GallerySettingsScreenState extends State<GallerySettingsScreen> {
Future<void> _showGroupTypeSheet(BuildContext context) async {
final l10n = context.strings;
- final currentGroupType = localSettings.getGalleryGroupType();
await showBottomSheetComponent<void>(
context: context,
builder: (sheetContext) => BottomSheetComponent(
@@ -139,9 +141,9 @@ class _GallerySettingsScreenState extends State<GallerySettingsScreen> {
items: [
for (final groupType in _groupTypes)
MenuComponent(
- key: ValueKey(groupType.name),
+ key: ValueKey(groupType),
title: groupType.getLocalizedName(sheetContext),
- trailing: currentGroupType == groupType
+ trailing: _groupType == groupType
? Icon(
Icons.check,
color: sheetContext.componentColors.primary,
@@ -170,7 +172,7 @@ class _GallerySettingsScreenState extends State<GallerySettingsScreen> {
await localSettings.setGalleryGroupType(groupType);
if (mounted) {
setState(() {
- _groupType = groupType.name;
+ _groupType = groupType;
});
}
Bus.instance.fire(ForceReloadHomeGalleryEvent("group type changed"));
diff --git a/mobile/apps/photos/lib/ui/tools/editor/image_editor/image_editor_page.dart b/mobile/apps/photos/lib/ui/tools/editor/image_editor/image_editor_page.dart
index d4bdf8af09..0da02c6fe1 100644
--- a/mobile/apps/photos/lib/ui/tools/editor/image_editor/image_editor_page.dart
+++ b/mobile/apps/photos/lib/ui/tools/editor/image_editor/image_editor_page.dart
@@ -252,6 +252,19 @@ class _ImageEditorPageState extends State<ImageEditorPage> {
),
),
configs: ProImageEditorConfigs(
+ i18n: I18n(
+ tuneEditor: I18nTuneEditor(
+ brightness: context.strings.imageEditorBrightness,
+ contrast: context.strings.imageEditorContrast,
+ saturation: context.strings.imageEditorSaturation,
+ exposure: context.strings.imageEditorExposure,
+ hue: context.strings.imageEditorHue,
+ temperature: context.strings.imageEditorTemperature,
+ sharpness: context.strings.imageEditorSharpness,
+ fade: context.strings.imageEditorFade,
+ luminance: context.strings.imageEditorLuminance,
+ ),
+ ),
imageGeneration: const ImageGenerationConfigs(
jpegQuality: 100,
enableIsolateGeneration: true,
diff --git a/mobile/apps/photos/lib/ui/tools/editor/image_editor/image_editor_tune_bar.dart b/mobile/apps/photos/lib/ui/tools/editor/image_editor/image_editor_tune_bar.dart
index 3e1fa6eee6..1787f477cc 100644
--- a/mobile/apps/photos/lib/ui/tools/editor/image_editor/image_editor_tune_bar.dart
+++ b/mobile/apps/photos/lib/ui/tools/editor/image_editor/image_editor_tune_bar.dart
@@ -86,6 +86,7 @@ class _ImageEditorTuneBarState extends State<ImageEditorTuneBar>
(index) {
final item = tuneEditor.tuneAdjustmentList[index];
return TuneItem(
+ id: item.id,
icon: item.icon,
label: item.label,
isSelected: tuneEditor.selectedIndex == index,
@@ -125,6 +126,7 @@ class _ImageEditorTuneBarState extends State<ImageEditorTuneBar>
}
class TuneItem extends StatelessWidget {
+ final String id;
final IconData icon;
final String label;
final bool isSelected;
@@ -135,6 +137,7 @@ class TuneItem extends StatelessWidget {
const TuneItem({
super.key,
+ required this.id,
required this.icon,
required this.label,
required this.isSelected,
@@ -147,8 +150,8 @@ class TuneItem extends StatelessWidget {
@override
Widget build(BuildContext context) {
final colors = context.componentColors;
- final hugeIcon = _hugeIconForLabel(label);
- final svgPath = _svgPathForLabel(label);
+ final hugeIcon = _hugeIconForID(id);
+ final svgPath = _svgPathForID(id);
return GestureDetector(
onTap: onTap,
child: SizedBox(
@@ -179,8 +182,8 @@ class TuneItem extends StatelessWidget {
);
}
- List<List<dynamic>>? _hugeIconForLabel(String label) {
- return switch (label.toLowerCase()) {
+ List<List<dynamic>>? _hugeIconForID(String id) {
+ return switch (id) {
"brightness" => HugeIcons.strokeRoundedSun01,
"contrast" => HugeIcons.strokeRoundedSlidersHorizontal,
"exposure" => HugeIcons.strokeRoundedCameraLens,
@@ -192,10 +195,9 @@ class TuneItem extends StatelessWidget {
};
}
- String? _svgPathForLabel(String label) {
- return switch (label.toLowerCase()) {
- "luminance" ||
- "fade" => "assets/image-editor/image-editor-${label.toLowerCase()}.svg",
+ String? _svgPathForID(String id) {
+ return switch (id) {
+ "luminance" || "fade" => "assets/image-editor/image-editor-$id.svg",
_ => null,
};
}
diff --git a/mobile/packages/strings/lib/l10n/arb/strings_en.arb b/mobile/packages/strings/lib/l10n/arb/strings_en.arb
index cbf65805a3..d737dc6c08 100644
--- a/mobile/packages/strings/lib/l10n/arb/strings_en.arb
+++ b/mobile/packages/strings/lib/l10n/arb/strings_en.arb
@@ -1875,6 +1875,15 @@
"ignore": "Ignore",
"ignored": "ignored",
"ignorePerson": "Ignore person",
+ "imageEditorBrightness": "Brightness",
+ "imageEditorContrast": "Contrast",
+ "imageEditorExposure": "Exposure",
+ "imageEditorFade": "Fade",
+ "imageEditorHue": "Hue",
+ "imageEditorLuminance": "Luminance",
+ "imageEditorSaturation": "Saturation",
+ "imageEditorSharpness": "Sharpness",
+ "imageEditorTemperature": "Temperature",
"imageNotAnalyzed": "Image not analyzed",
"immediate": "Immediate",
"immediately": "Immediately",
@@ -3351,6 +3360,8 @@
"ritualSendReminderLabel": "Send reminder",
"ritualSetAlbumToLaunchCamera": "Set an album for this ritual to launch the camera.",
"ritualShareUnavailable": "Unable to share right now. Please try again.",
+ "ritualStartNew": "Start new ritual",
+ "ritualStartNewDescription": "Create a ritual, build streaks, and share your progress.",
"ritualsTitle": "Rituals",
"ritualUntitled": "Untitled ritual",
"ritualUpdate": "Update ritual",