mirror of
https://github.com/Xevion/paperless-mobile.git
synced 2025-12-09 10:08:00 -06:00
feat: Migrated strings, and translations to native flutter l10n plugin
This commit is contained in:
@@ -14,7 +14,8 @@ import 'package:paperless_mobile/features/inbox/view/widgets/inbox_empty_widget.
|
||||
import 'package:paperless_mobile/features/inbox/view/widgets/inbox_item.dart';
|
||||
import 'package:paperless_mobile/features/paged_document_view/view/document_paging_view_mixin.dart';
|
||||
import 'package:paperless_mobile/features/search_app_bar/view/search_app_bar.dart';
|
||||
import 'package:paperless_mobile/generated/l10n.dart';
|
||||
import 'package:paperless_mobile/generated/l10n/app_localizations.dart';
|
||||
|
||||
import 'package:paperless_mobile/helpers/message_helpers.dart';
|
||||
|
||||
class InboxPage extends StatefulWidget {
|
||||
@@ -52,7 +53,7 @@ class _InboxPageState extends State<InboxPage>
|
||||
return const SizedBox.shrink();
|
||||
}
|
||||
return FloatingActionButton.extended(
|
||||
label: Text(S.of(context).allSeen),
|
||||
label: Text(S.of(context)!.allSeen),
|
||||
icon: const Icon(Icons.done_all),
|
||||
onPressed: state.hasLoaded && state.documents.isNotEmpty
|
||||
? () => _onMarkAllAsSeen(
|
||||
@@ -128,7 +129,7 @@ class _InboxPageState extends State<InboxPage>
|
||||
controller: pagingScrollController,
|
||||
slivers: [
|
||||
SearchAppBar(
|
||||
hintText: S.of(context).searchDocuments,
|
||||
hintText: S.of(context)!.searchDocuments,
|
||||
onOpenSearch: showDocumentSearchPage,
|
||||
),
|
||||
if (state.documents.isEmpty)
|
||||
@@ -150,7 +151,7 @@ class _InboxPageState extends State<InboxPage>
|
||||
child: HintCard(
|
||||
show: !state.isHintAcknowledged,
|
||||
hintText:
|
||||
S.of(context).swipeLeftToMarkADocumentAsSeen,
|
||||
S.of(context)!.swipeLeftToMarkADocumentAsSeen,
|
||||
onHintAcknowledged: () =>
|
||||
context.read<InboxCubit>().acknowledgeHint(),
|
||||
),
|
||||
@@ -178,7 +179,7 @@ class _InboxPageState extends State<InboxPage>
|
||||
color: Theme.of(context).colorScheme.primary,
|
||||
).padded(),
|
||||
Text(
|
||||
S.of(context).markAsSeen,
|
||||
S.of(context)!.markAsSeen,
|
||||
style: TextStyle(
|
||||
color: Theme.of(context).colorScheme.primary,
|
||||
),
|
||||
@@ -198,19 +199,19 @@ class _InboxPageState extends State<InboxPage>
|
||||
final isActionConfirmed = await showDialog(
|
||||
context: context,
|
||||
builder: (context) => AlertDialog(
|
||||
title: Text(S.of(context).markAllAsSeen),
|
||||
title: Text(S.of(context)!.markAllAsSeen),
|
||||
content: Text(
|
||||
S.of(context).areYouSureYouWantToMarkAllDocumentsAsSeen,
|
||||
S.of(context)!.areYouSureYouWantToMarkAllDocumentsAsSeen,
|
||||
),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () => Navigator.of(context).pop(false),
|
||||
child: Text(S.of(context).cancel),
|
||||
child: Text(S.of(context)!.cancel),
|
||||
),
|
||||
TextButton(
|
||||
onPressed: () => Navigator.of(context).pop(true),
|
||||
child: Text(
|
||||
S.of(context).ok,
|
||||
S.of(context)!.ok,
|
||||
style: TextStyle(color: Theme.of(context).colorScheme.error),
|
||||
),
|
||||
),
|
||||
@@ -228,9 +229,9 @@ class _InboxPageState extends State<InboxPage>
|
||||
final removedTags = await context.read<InboxCubit>().removeFromInbox(doc);
|
||||
showSnackBar(
|
||||
context,
|
||||
S.of(context).removeDocumentFromInbox,
|
||||
S.of(context)!.removeDocumentFromInbox,
|
||||
action: SnackBarActionConfig(
|
||||
label: S.of(context).undo,
|
||||
label: S.of(context)!.undo,
|
||||
onPressed: () => _onUndoMarkAsSeen(doc, removedTags),
|
||||
),
|
||||
);
|
||||
@@ -267,10 +268,10 @@ class _InboxPageState extends State<InboxPage>
|
||||
documents,
|
||||
(doc) {
|
||||
if (doc.added.isToday) {
|
||||
return S.of(context).today;
|
||||
return S.of(context)!.today;
|
||||
}
|
||||
if (doc.added.isYesterday) {
|
||||
return S.of(context).yesterday;
|
||||
return S.of(context)!.yesterday;
|
||||
}
|
||||
return DateFormat.yMMMMd().format(doc.added);
|
||||
},
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:paperless_mobile/features/inbox/cubit/inbox_cubit.dart';
|
||||
import 'package:paperless_mobile/generated/l10n.dart';
|
||||
import 'package:paperless_mobile/generated/l10n/app_localizations.dart';
|
||||
|
||||
class InboxEmptyWidget extends StatelessWidget {
|
||||
const InboxEmptyWidget({
|
||||
@@ -23,11 +23,11 @@ class InboxEmptyWidget extends StatelessWidget {
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Text(S.of(context).youDoNotHaveUnseenDocuments),
|
||||
Text(S.of(context)!.youDoNotHaveUnseenDocuments),
|
||||
TextButton(
|
||||
onPressed: () =>
|
||||
_emptyStateRefreshIndicatorKey.currentState?.show(),
|
||||
child: Text(S.of(context).refresh),
|
||||
child: Text(S.of(context)!.refresh),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
@@ -8,7 +8,8 @@ import 'package:paperless_mobile/features/documents/view/widgets/document_previe
|
||||
import 'package:paperless_mobile/features/inbox/cubit/inbox_cubit.dart';
|
||||
import 'package:paperless_mobile/features/labels/tags/view/widgets/tags_widget.dart';
|
||||
import 'package:paperless_mobile/features/labels/view/widgets/label_text.dart';
|
||||
import 'package:paperless_mobile/generated/l10n.dart';
|
||||
import 'package:paperless_mobile/generated/l10n/app_localizations.dart';
|
||||
|
||||
import 'package:paperless_mobile/routes/document_details_route.dart';
|
||||
|
||||
class InboxItem extends StatefulWidget {
|
||||
@@ -99,7 +100,7 @@ class _InboxItemState extends State<InboxItem> {
|
||||
child: ActionChip(
|
||||
avatar: const Icon(Icons.delete_outline),
|
||||
shape: chipShape,
|
||||
label: Text(S.of(context).deleteDocument),
|
||||
label: Text(S.of(context)!.deleteDocument),
|
||||
onPressed: () async {
|
||||
final shouldDelete = await showDialog<bool>(
|
||||
context: context,
|
||||
@@ -147,7 +148,7 @@ class _InboxItemState extends State<InboxItem> {
|
||||
maxWidth: 50,
|
||||
),
|
||||
child: Text(
|
||||
S.of(context).quickAction,
|
||||
S.of(context)!.quickAction,
|
||||
textAlign: TextAlign.center,
|
||||
maxLines: 3,
|
||||
style: Theme.of(context).textTheme.labelSmall,
|
||||
@@ -190,9 +191,9 @@ class _InboxItemState extends State<InboxItem> {
|
||||
shape: chipShape,
|
||||
label: hasAsn
|
||||
? Text(
|
||||
'${S.of(context).asn} #${widget.document.archiveSerialNumber}',
|
||||
'${S.of(context)!.asn} #${widget.document.archiveSerialNumber}',
|
||||
)
|
||||
: Text(S.of(context).assignASN),
|
||||
: Text(S.of(context)!.assignAsn),
|
||||
onPressed: !hasAsn
|
||||
? () {
|
||||
setState(() {
|
||||
@@ -352,7 +353,7 @@ class _InboxItemState extends State<InboxItem> {
|
||||
// avatar: const Icon(Icons.calendar_today_outlined),
|
||||
// shape: chipShape,
|
||||
// label: Text(
|
||||
// "${S.of(context).createdAt}: ${DateFormat.yMd().format(e)}",
|
||||
// "${S.of(context)!.createdAt}: ${DateFormat.yMd().format(e)}",
|
||||
// ),
|
||||
// onPressed: () => context
|
||||
// .read<InboxCubit>()
|
||||
|
||||
Reference in New Issue
Block a user