Browse Source

l10n: Extract strings

Neeraj Gupta 2 years ago
parent
commit
6b10c3d315

+ 0 - 1
lib/core/constants.dart

@@ -27,7 +27,6 @@ const String sharedMediaIdentifier = 'ente-shared-media://';
 
 
 const int maxLivePhotoToastCount = 2;
 const int maxLivePhotoToastCount = 2;
 const String livePhotoToastCounterKey = "show_live_photo_toast";
 const String livePhotoToastCounterKey = "show_live_photo_toast";
-const String fileCaptionDefaultHint = "Add a description...";
 
 
 const thumbnailDiskLoadDeferDuration = Duration(milliseconds: 40);
 const thumbnailDiskLoadDeferDuration = Duration(milliseconds: 40);
 const thumbnailServerLoadDeferDuration = Duration(milliseconds: 80);
 const thumbnailServerLoadDeferDuration = Duration(milliseconds: 80);

+ 2 - 0
lib/generated/intl/messages_en.dart

@@ -590,6 +590,8 @@ class MessageLookup extends MessageLookupByLibrary {
         "faqs": MessageLookupByLibrary.simpleMessage("FAQs"),
         "faqs": MessageLookupByLibrary.simpleMessage("FAQs"),
         "favorite": MessageLookupByLibrary.simpleMessage("Favorite"),
         "favorite": MessageLookupByLibrary.simpleMessage("Favorite"),
         "feedback": MessageLookupByLibrary.simpleMessage("Feedback"),
         "feedback": MessageLookupByLibrary.simpleMessage("Feedback"),
+        "fileInfoAddDescHint":
+            MessageLookupByLibrary.simpleMessage("Add a description..."),
         "fileSavedToGallery":
         "fileSavedToGallery":
             MessageLookupByLibrary.simpleMessage("File saved to gallery"),
             MessageLookupByLibrary.simpleMessage("File saved to gallery"),
         "filesBackedUpFromDevice": m50,
         "filesBackedUpFromDevice": m50,

+ 10 - 0
lib/generated/l10n.dart

@@ -6914,6 +6914,16 @@ class S {
       args: [],
       args: [],
     );
     );
   }
   }
+
+  /// `Add a description...`
+  String get fileInfoAddDescHint {
+    return Intl.message(
+      'Add a description...',
+      name: 'fileInfoAddDescHint',
+      desc: '',
+      args: [],
+    );
+  }
 }
 }
 
 
 class AppLocalizationDelegate extends LocalizationsDelegate<S> {
 class AppLocalizationDelegate extends LocalizationsDelegate<S> {

+ 2 - 1
lib/l10n/intl_en.arb

@@ -968,5 +968,6 @@
   },
   },
   "freeStorageSpace" : "{freeAmount} {storageUnit} free",
   "freeStorageSpace" : "{freeAmount} {storageUnit} free",
   "appVersion": "Version: {versionValue}",
   "appVersion": "Version: {versionValue}",
-  "verifyIDLabel" : "Verify"
+  "verifyIDLabel" : "Verify",
+  "fileInfoAddDescHint": "Add a description..."
 }
 }

+ 8 - 4
lib/ui/viewer/file/file_caption_widget.dart

@@ -1,5 +1,5 @@
 import 'package:flutter/material.dart';
 import 'package:flutter/material.dart';
-import 'package:photos/core/constants.dart';
+import "package:photos/generated/l10n.dart";
 import 'package:photos/models/file.dart';
 import 'package:photos/models/file.dart';
 import 'package:photos/theme/ente_theme.dart';
 import 'package:photos/theme/ente_theme.dart';
 import 'package:photos/ui/components/keyboard/keybiard_oveylay.dart';
 import 'package:photos/ui/components/keyboard/keybiard_oveylay.dart';
@@ -65,7 +65,8 @@ class _FileCaptionWidgetState extends State<FileCaptionWidget> {
   final _textController = TextEditingController();
   final _textController = TextEditingController();
   final _focusNode = FocusNode();
   final _focusNode = FocusNode();
   String? editedCaption;
   String? editedCaption;
-  String hintText = fileCaptionDefaultHint;
+  late String defaultHintText = S.of(context).fileInfoAddDescHint;
+  String hintText = '';
   Widget? keyboardTopButtons;
   Widget? keyboardTopButtons;
 
 
   @override
   @override
@@ -90,6 +91,9 @@ class _FileCaptionWidgetState extends State<FileCaptionWidget> {
 
 
   @override
   @override
   Widget build(BuildContext context) {
   Widget build(BuildContext context) {
+    if (hintText.isEmpty) {
+      hintText = defaultHintText;
+    }
     final colorScheme = getEnteColorScheme(context);
     final colorScheme = getEnteColorScheme(context);
     final textTheme = getEnteTextTheme(context);
     final textTheme = getEnteTextTheme(context);
     return TextField(
     return TextField(
@@ -121,7 +125,7 @@ class _FileCaptionWidgetState extends State<FileCaptionWidget> {
         filled: true,
         filled: true,
         fillColor: colorScheme.fillFaint,
         fillColor: colorScheme.fillFaint,
         hintText: hintText,
         hintText: hintText,
-        hintStyle: hintText == fileCaptionDefaultHint
+        hintStyle: hintText == defaultHintText
             ? textTheme.small.copyWith(color: colorScheme.textMuted)
             ? textTheme.small.copyWith(color: colorScheme.textMuted)
             : textTheme.small,
             : textTheme.small,
       ),
       ),
@@ -134,7 +138,7 @@ class _FileCaptionWidgetState extends State<FileCaptionWidget> {
       keyboardType: TextInputType.multiline,
       keyboardType: TextInputType.multiline,
       onChanged: (value) {
       onChanged: (value) {
         setState(() {
         setState(() {
-          hintText = fileCaptionDefaultHint;
+          hintText = defaultHintText;
           currentLength = value.length;
           currentLength = value.length;
           editedCaption = value;
           editedCaption = value;
         });
         });