Skip to content

armgit / ente

Public Imported from GitHub
0

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

Add localization support

AmanRajSinghMourya1cb08fef28bc
diff --git a/mobile/apps/locker/lib/l10n/app_en.arb b/mobile/apps/locker/lib/l10n/app_en.arb
index dd96f61f0a..8f0b4c5dcf 100644
--- a/mobile/apps/locker/lib/l10n/app_en.arb
+++ b/mobile/apps/locker/lib/l10n/app_en.arb
@@ -613,5 +613,69 @@
"clear": "Clear",
"uploadAFile": "Upload a File",
"clickHereToUpload": "Click here to upload",
- "saveDocument": "Save document"
+ "saveDocument": "Save document",
+ "uploadFiles": "Upload Files",
+ "filesSelected": "{count, plural, =0{No files selected} =1{1 file selected} other{{count} files selected}}",
+ "@filesSelected": {
+ "description": "Number of files selected for upload",
+ "placeholders": {
+ "count": {
+ "type": "int",
+ "example": "3"
+ }
+ }
+ },
+ "addToCollection": "Add to collection",
+ "newCollection": "New collection",
+ "title": "Title",
+ "backToView": "Back to view",
+ "back": "Back",
+ "failedToLoadCollections": "Failed to load collections: {error}",
+ "@failedToLoadCollections": {
+ "description": "Error message when loading collections fails",
+ "placeholders": {
+ "error": {
+ "type": "String",
+ "example": "Network error"
+ }
+ }
+ },
+ "informationCollectionName": "Information",
+ "recordSavedToMultipleCollections": "Record saved to {count, plural, =1{1 collection} other{{count} collections}} successfully",
+ "@recordSavedToMultipleCollections": {
+ "description": "Success message when record is saved to multiple collections",
+ "placeholders": {
+ "count": {
+ "type": "int",
+ "example": "3"
+ }
+ }
+ },
+ "copiedToClipboard": "{fieldName} copied to clipboard",
+ "@copiedToClipboard": {
+ "description": "Message when a field is copied to clipboard",
+ "placeholders": {
+ "fieldName": {
+ "type": "String",
+ "example": "Password"
+ }
+ }
+ },
+ "searchResultsCount": "{count, plural, =1{1 result} other{{count} results}} for \"{query}\"",
+ "@searchResultsCount": {
+ "description": "Search results count message",
+ "placeholders": {
+ "count": {
+ "type": "int",
+ "example": "5"
+ },
+ "query": {
+ "type": "String",
+ "example": "vacation"
+ }
+ }
+ },
+ "locker": "Locker",
+ "unnamed": "Unnamed",
+ "collectionLabel": "Collection"
}
diff --git a/mobile/apps/locker/lib/l10n/app_localizations.dart b/mobile/apps/locker/lib/l10n/app_localizations.dart
index ed042e2354..009ceb7e1d 100644
--- a/mobile/apps/locker/lib/l10n/app_localizations.dart
+++ b/mobile/apps/locker/lib/l10n/app_localizations.dart
@@ -2007,6 +2007,96 @@ abstract class AppLocalizations {
/// In en, this message translates to:
/// **'Save document'**
String get saveDocument;
+
+ /// No description provided for @uploadFiles.
+ ///
+ /// In en, this message translates to:
+ /// **'Upload Files'**
+ String get uploadFiles;
+
+ /// Number of files selected for upload
+ ///
+ /// In en, this message translates to:
+ /// **'{count, plural, =0{No files selected} =1{1 file selected} other{{count} files selected}}'**
+ String filesSelected(int count);
+
+ /// No description provided for @addToCollection.
+ ///
+ /// In en, this message translates to:
+ /// **'Add to collection'**
+ String get addToCollection;
+
+ /// No description provided for @newCollection.
+ ///
+ /// In en, this message translates to:
+ /// **'New collection'**
+ String get newCollection;
+
+ /// No description provided for @title.
+ ///
+ /// In en, this message translates to:
+ /// **'Title'**
+ String get title;
+
+ /// No description provided for @backToView.
+ ///
+ /// In en, this message translates to:
+ /// **'Back to view'**
+ String get backToView;
+
+ /// No description provided for @back.
+ ///
+ /// In en, this message translates to:
+ /// **'Back'**
+ String get back;
+
+ /// Error message when loading collections fails
+ ///
+ /// In en, this message translates to:
+ /// **'Failed to load collections: {error}'**
+ String failedToLoadCollections(String error);
+
+ /// No description provided for @informationCollectionName.
+ ///
+ /// In en, this message translates to:
+ /// **'Information'**
+ String get informationCollectionName;
+
+ /// Success message when record is saved to multiple collections
+ ///
+ /// In en, this message translates to:
+ /// **'Record saved to {count, plural, =1{1 collection} other{{count} collections}} successfully'**
+ String recordSavedToMultipleCollections(int count);
+
+ /// Message when a field is copied to clipboard
+ ///
+ /// In en, this message translates to:
+ /// **'{fieldName} copied to clipboard'**
+ String copiedToClipboard(String fieldName);
+
+ /// Search results count message
+ ///
+ /// In en, this message translates to:
+ /// **'{count, plural, =1{1 result} other{{count} results}} for \"{query}\"'**
+ String searchResultsCount(int count, String query);
+
+ /// No description provided for @locker.
+ ///
+ /// In en, this message translates to:
+ /// **'Locker'**
+ String get locker;
+
+ /// No description provided for @unnamed.
+ ///
+ /// In en, this message translates to:
+ /// **'Unnamed'**
+ String get unnamed;
+
+ /// No description provided for @collectionLabel.
+ ///
+ /// In en, this message translates to:
+ /// **'Collection'**
+ String get collectionLabel;
}
class _AppLocalizationsDelegate
diff --git a/mobile/apps/locker/lib/l10n/app_localizations_en.dart b/mobile/apps/locker/lib/l10n/app_localizations_en.dart
index 847b128061..bf195c4e0f 100644
--- a/mobile/apps/locker/lib/l10n/app_localizations_en.dart
+++ b/mobile/apps/locker/lib/l10n/app_localizations_en.dart
@@ -1131,4 +1131,78 @@ class AppLocalizationsEn extends AppLocalizations {
@override
String get saveDocument => 'Save document';
+
+ @override
+ String get uploadFiles => 'Upload Files';
+
+ @override
+ String filesSelected(int count) {
+ String _temp0 = intl.Intl.pluralLogic(
+ count,
+ locale: localeName,
+ other: '$count files selected',
+ one: '1 file selected',
+ zero: 'No files selected',
+ );
+ return '$_temp0';
+ }
+
+ @override
+ String get addToCollection => 'Add to collection';
+
+ @override
+ String get newCollection => 'New collection';
+
+ @override
+ String get title => 'Title';
+
+ @override
+ String get backToView => 'Back to view';
+
+ @override
+ String get back => 'Back';
+
+ @override
+ String failedToLoadCollections(String error) {
+ return 'Failed to load collections: $error';
+ }
+
+ @override
+ String get informationCollectionName => 'Information';
+
+ @override
+ String recordSavedToMultipleCollections(int count) {
+ String _temp0 = intl.Intl.pluralLogic(
+ count,
+ locale: localeName,
+ other: '$count collections',
+ one: '1 collection',
+ );
+ return 'Record saved to $_temp0 successfully';
+ }
+
+ @override
+ String copiedToClipboard(String fieldName) {
+ return '$fieldName copied to clipboard';
+ }
+
+ @override
+ String searchResultsCount(int count, String query) {
+ String _temp0 = intl.Intl.pluralLogic(
+ count,
+ locale: localeName,
+ other: '$count results',
+ one: '1 result',
+ );
+ return '$_temp0 for \"$query\"';
+ }
+
+ @override
+ String get locker => 'Locker';
+
+ @override
+ String get unnamed => 'Unnamed';
+
+ @override
+ String get collectionLabel => 'Collection';
}
diff --git a/mobile/apps/locker/lib/ui/components/collection_selection_widget.dart b/mobile/apps/locker/lib/ui/components/collection_selection_widget.dart
index b2299aa9aa..4fbfe44cff 100644
--- a/mobile/apps/locker/lib/ui/components/collection_selection_widget.dart
+++ b/mobile/apps/locker/lib/ui/components/collection_selection_widget.dart
@@ -1,5 +1,6 @@
import 'package:ente_ui/theme/ente_theme.dart';
import 'package:flutter/material.dart';
+import 'package:locker/l10n/l10n.dart';
import 'package:locker/services/collections/models/collection.dart';
import 'package:locker/utils/collection_actions.dart';
@@ -62,7 +63,7 @@ class _CollectionSelectionWidgetState extends State<CollectionSelectionWidget> {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
- 'Add to collection',
+ context.l10n.addToCollection,
style: textTheme.h3.copyWith(
color: colorScheme.textBase,
),
@@ -94,7 +95,7 @@ class _CollectionSelectionWidgetState extends State<CollectionSelectionWidget> {
),
const SizedBox(width: 4),
Text(
- 'New collection',
+ context.l10n.newCollection,
style: textTheme.small.copyWith(
color: colorScheme.textMuted,
fontWeight: FontWeight.w500,
@@ -136,7 +137,7 @@ class _CollectionSelectionWidgetState extends State<CollectionSelectionWidget> {
required colorScheme,
required textTheme,
}) {
- final collectionName = collection.name ?? 'Unnamed Collection';
+ final collectionName = collection.name ?? context.l10n.unnamedCollection;
return InkWell(
onTap: onTap,
@@ -196,7 +197,7 @@ class _CollectionSelectionWidgetState extends State<CollectionSelectionWidget> {
),
const SizedBox(width: 4),
Text(
- 'New collection',
+ context.l10n.newCollection,
style: textTheme.small.copyWith(
color: colorScheme.textMuted,
fontWeight: FontWeight.w500,
diff --git a/mobile/apps/locker/lib/ui/components/file_edit_dialog.dart b/mobile/apps/locker/lib/ui/components/file_edit_dialog.dart
index f552883ee2..e3230cea0f 100644
--- a/mobile/apps/locker/lib/ui/components/file_edit_dialog.dart
+++ b/mobile/apps/locker/lib/ui/components/file_edit_dialog.dart
@@ -154,7 +154,7 @@ class _FileEditDialogState extends State<FileEditDialog> {
),
const SizedBox(height: 20),
Text(
- 'Title',
+ context.l10n.title,
style: textTheme.small.copyWith(
color: colorScheme.textBase,
),
diff --git a/mobile/apps/locker/lib/ui/pages/all_collections_page.dart b/mobile/apps/locker/lib/ui/pages/all_collections_page.dart
index 3b0d3f4277..f5cfc4d675 100644
--- a/mobile/apps/locker/lib/ui/pages/all_collections_page.dart
+++ b/mobile/apps/locker/lib/ui/pages/all_collections_page.dart
@@ -159,7 +159,7 @@ class _AllCollectionsPageState extends State<AllCollectionsPage>
_logger.severe("Failed to load collections", e);
if (mounted) {
setState(() {
- _error = 'Failed to load collections: $e';
+ _error = context.l10n.failedToLoadCollections(e.toString());
_isLoading = false;
});
}
@@ -290,7 +290,8 @@ class _AllCollectionsPageState extends State<AllCollectionsPage>
padding: const EdgeInsets.only(bottom: 16.0),
alignment: Alignment.centerLeft,
child: Text(
- '${_sortedCollections.length} result${_sortedCollections.length == 1 ? '' : 's'} for "$searchQuery"',
+ context.l10n
+ .searchResultsCount(_sortedCollections.length, searchQuery),
style: getEnteTextTheme(context).small.copyWith(
color: Theme.of(context).textTheme.bodySmall?.color,
),
diff --git a/mobile/apps/locker/lib/ui/pages/base_info_page.dart b/mobile/apps/locker/lib/ui/pages/base_info_page.dart
index 1973830090..8320b9e110 100644
--- a/mobile/apps/locker/lib/ui/pages/base_info_page.dart
+++ b/mobile/apps/locker/lib/ui/pages/base_info_page.dart
@@ -90,7 +90,7 @@ abstract class BaseInfoPageState<T extends InfoData, W extends BaseInfoPage<T>>
// Pre-select a default collection if available
if (collections.isNotEmpty) {
final defaultCollection = collections.firstWhere(
- (c) => c.name == 'Information',
+ (c) => c.name == context.l10n.informationCollectionName,
orElse: () => collections.first,
);
_selectedCollectionIds = {defaultCollection.id};
@@ -215,8 +215,8 @@ abstract class BaseInfoPageState<T extends InfoData, W extends BaseInfoPage<T>>
Future<void> _createNewFile(InfoItem infoItem) async {
if (_selectedCollectionIds.isEmpty) {
ScaffoldMessenger.of(context).showSnackBar(
- const SnackBar(
- content: Text('Please select at least one collection'),
+ SnackBar(
+ content: Text(context.l10n.pleaseSelectAtLeastOneCollection),
backgroundColor: Colors.red,
),
);
@@ -243,7 +243,7 @@ abstract class BaseInfoPageState<T extends InfoData, W extends BaseInfoPage<T>>
final collectionCount = selectedCollections.length;
final message = collectionCount == 1
? context.l10n.recordSavedSuccessfully
- : 'Record saved to $collectionCount collections successfully';
+ : context.l10n.recordSavedToMultipleCollections(collectionCount);
// Navigate to home page and clear all previous routes
await Navigator.of(context).pushAndRemoveUntil(
@@ -276,7 +276,7 @@ abstract class BaseInfoPageState<T extends InfoData, W extends BaseInfoPage<T>>
Clipboard.setData(ClipboardData(text: text));
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
- content: Text('$fieldName copied to clipboard'),
+ content: Text(context.l10n.copiedToClipboard(fieldName)),
duration: const Duration(seconds: 2),
backgroundColor: Colors.green,
),
@@ -371,14 +371,14 @@ abstract class BaseInfoPageState<T extends InfoData, W extends BaseInfoPage<T>>
Icons.arrow_back_outlined,
),
onPressed: _toggleMode,
- tooltip: 'Back to view',
+ tooltip: context.l10n.backToView,
)
: IconButton(
icon: const Icon(
Icons.arrow_back_outlined,
),
onPressed: () => Navigator.of(context).pop(),
- tooltip: 'Back',
+ tooltip: context.l10n.back,
),
automaticallyImplyLeading: false,
actions: [
@@ -386,7 +386,7 @@ abstract class BaseInfoPageState<T extends InfoData, W extends BaseInfoPage<T>>
IconButton(
icon: const Icon(Icons.edit),
onPressed: _toggleMode,
- tooltip: 'Edit',
+ tooltip: context.l10n.edit,
),
],
),
diff --git a/mobile/apps/locker/lib/ui/pages/collection_page.dart b/mobile/apps/locker/lib/ui/pages/collection_page.dart
index 0330bd8437..b0fd693a7a 100644
--- a/mobile/apps/locker/lib/ui/pages/collection_page.dart
+++ b/mobile/apps/locker/lib/ui/pages/collection_page.dart
@@ -1,11 +1,13 @@
import "dart:async";
import 'package:ente_events/event_bus.dart';
+import "package:ente_ui/components/title_bar_title_widget.dart";
import 'package:ente_ui/theme/ente_theme.dart';
import "package:ente_ui/utils/dialog_util.dart";
import "package:ente_utils/navigation_util.dart";
import 'package:flutter/material.dart';
+import "package:hugeicons/hugeicons.dart";
import 'package:locker/events/collections_updated_event.dart';
import 'package:locker/l10n/l10n.dart';
import 'package:locker/models/selected_files.dart';
@@ -208,7 +210,21 @@ class _CollectionPageState extends UploaderPageState<CollectionPage>
focusNode: FocusNode(),
onKeyEvent: handleKeyEvent,
child: Scaffold(
- appBar: _buildAppBar(),
+ appBar: AppBar(
+ backgroundColor: getEnteColorScheme(context).backgroundBase,
+ surfaceTintColor: Colors.transparent,
+ toolbarHeight: 48,
+ leadingWidth: 48,
+ leading: GestureDetector(
+ onTap: () {
+ Navigator.pop(context);
+ },
+ child: const Icon(
+ Icons.arrow_back_outlined,
+ ),
+ ),
+ ),
+ backgroundColor: getEnteColorScheme(context).backgroundBase,
body: _buildBody(),
floatingActionButton:
isSearchActive ? const SizedBox.shrink() : _buildFAB(),
@@ -327,25 +343,70 @@ class _CollectionPageState extends UploaderPageState<CollectionPage>
);
}
- return SingleChildScrollView(
- padding: const EdgeInsets.only(left: 16, right: 16),
- child: _buildFilesList(),
+ return Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Padding(
+ padding: const EdgeInsets.symmetric(vertical: 4, horizontal: 16),
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ TitleBarTitleWidget(
+ title: _collection.name ?? context.l10n.untitled,
+ trailingWidgets: [
+ Container(
+ height: 48,
+ width: 48,
+ decoration: BoxDecoration(
+ borderRadius: BorderRadius.circular(12),
+ color: getEnteColorScheme(context).backdropBase,
+ ),
+ padding: const EdgeInsets.all(12),
+ child: HugeIcon(
+ icon: HugeIcons.strokeRoundedShare08,
+ color: getEnteColorScheme(context).iconColor,
+ ),
+ ),
+ const SizedBox(width: 8),
+ Container(
+ height: 48,
+ width: 48,
+ decoration: BoxDecoration(
+ borderRadius: BorderRadius.circular(12),
+ color: getEnteColorScheme(context).backdropBase,
+ ),
+ padding: const EdgeInsets.all(12),
+ child: HugeIcon(
+ icon: HugeIcons.strokeRoundedMoreVertical,
+ color: getEnteColorScheme(context).iconColor,
+ ),
+ ),
+ ],
+ ),
+ Text(
+ _displayedFiles.length.toString(),
+ style: getEnteTextTheme(context).smallMuted,
+ ),
+ ],
+ ),
+ ),
+ SingleChildScrollView(
+ padding: const EdgeInsets.symmetric(vertical: 20, horizontal: 16),
+ child: _displayedFiles.isEmpty
+ ? SizedBox(
+ height: 400,
+ child: _buildEmptyState(),
+ )
+ : ItemListView(
+ key: ValueKey(_displayedFiles.length),
+ files: _displayedFiles,
+ selectedFiles: _selectedFiles,
+ ),
+ ),
+ ],
);
}
- Widget _buildFilesList() {
- return _displayedFiles.isEmpty
- ? SizedBox(
- height: 400,
- child: _buildEmptyState(),
- )
- : ItemListView(
- key: ValueKey(_displayedFiles.length),
- files: _displayedFiles,
- selectedFiles: _selectedFiles,
- );
- }
-
Widget _buildEmptyState() {
return Padding(
padding: const EdgeInsets.all(32.0),
diff --git a/mobile/apps/locker/lib/ui/pages/home_page.dart b/mobile/apps/locker/lib/ui/pages/home_page.dart
index 84b70cc3ac..ed9a4a87d7 100644
--- a/mobile/apps/locker/lib/ui/pages/home_page.dart
+++ b/mobile/apps/locker/lib/ui/pages/home_page.dart
@@ -91,12 +91,12 @@ class CustomLockerAppBar extends StatelessWidget
sendLogs(
context,
- subject: 'Locker logs',
+ subject: context.l10n.lockerLogs,
body: 'Debug logs for Locker app.\n\n',
);
},
child: Text(
- 'Locker',
+ context.l10n.locker,
style: textTheme.h3Bold.copyWith(
color: colorScheme.backdropBase,
),