mirror of
https://github.com/Xevion/paperless-mobile.git
synced 2025-12-09 16:07:57 -06:00
feat: Migrated strings, and translations to native flutter l10n plugin
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:paperless_mobile/generated/l10n.dart';
|
||||
import 'package:paperless_mobile/generated/l10n/app_localizations.dart';
|
||||
|
||||
import 'package:pdfx/pdfx.dart';
|
||||
|
||||
class DocumentView extends StatefulWidget {
|
||||
@@ -32,7 +33,7 @@ class _DocumentViewState extends State<DocumentView> {
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: Text(S.of(context).preview),
|
||||
title: Text(S.of(context)!.preview),
|
||||
),
|
||||
body: PdfView(
|
||||
builders: PdfViewBuilders<DefaultBuilderOptions>(
|
||||
|
||||
@@ -20,7 +20,8 @@ import 'package:paperless_mobile/features/saved_view/view/add_saved_view_page.da
|
||||
import 'package:paperless_mobile/features/saved_view/view/saved_view_list.dart';
|
||||
import 'package:paperless_mobile/features/search_app_bar/view/search_app_bar.dart';
|
||||
import 'package:paperless_mobile/features/tasks/cubit/task_status_cubit.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';
|
||||
import 'package:paperless_mobile/routes/document_details_route.dart';
|
||||
|
||||
@@ -112,9 +113,9 @@ class _DocumentsPageState extends State<DocumentsPage>
|
||||
listener: (context, state) {
|
||||
showSnackBar(
|
||||
context,
|
||||
S.of(context).newDocumentAvailable,
|
||||
S.of(context)!.newDocumentAvailable,
|
||||
action: SnackBarActionConfig(
|
||||
label: S.of(context).reload,
|
||||
label: S.of(context)!.reload,
|
||||
onPressed: () {
|
||||
context.read<TaskStatusCubit>().acknowledgeCurrentTask();
|
||||
context.read<DocumentsCubit>().reload();
|
||||
@@ -200,7 +201,7 @@ class _DocumentsPageState extends State<DocumentsPage>
|
||||
.resetSelection(),
|
||||
),
|
||||
title: Text(
|
||||
"${state.selection.length} ${S.of(context).countSelected}",
|
||||
"${state.selection.length} ${S.of(context)!.countSelected}",
|
||||
),
|
||||
actions: [
|
||||
IconButton(
|
||||
@@ -211,13 +212,13 @@ class _DocumentsPageState extends State<DocumentsPage>
|
||||
);
|
||||
}
|
||||
return SearchAppBar(
|
||||
hintText: S.of(context).searchDocuments,
|
||||
hintText: S.of(context)!.searchDocuments,
|
||||
onOpenSearch: showDocumentSearchPage,
|
||||
bottom: TabBar(
|
||||
controller: _tabController,
|
||||
tabs: [
|
||||
Tab(text: S.of(context).documents),
|
||||
Tab(text: S.of(context).views),
|
||||
Tab(text: S.of(context)!.documents),
|
||||
Tab(text: S.of(context)!.views),
|
||||
],
|
||||
),
|
||||
);
|
||||
@@ -293,7 +294,7 @@ class _DocumentsPageState extends State<DocumentsPage>
|
||||
_nestedScrollViewKey.currentState?.outerController.jumpTo(0);
|
||||
},
|
||||
label: Text(
|
||||
S.of(context).scrollToTop,
|
||||
S.of(context)!.scrollToTop,
|
||||
style: DefaultTextStyle.of(context).style.apply(
|
||||
color: Theme.of(context).colorScheme.onPrimary,
|
||||
),
|
||||
@@ -408,7 +409,7 @@ class _DocumentsPageState extends State<DocumentsPage>
|
||||
.bulkDelete(documentsState.selection);
|
||||
showSnackBar(
|
||||
context,
|
||||
S.of(context).documentsSuccessfullyDeleted,
|
||||
S.of(context)!.documentsSuccessfullyDeleted,
|
||||
);
|
||||
context.read<DocumentsCubit>().resetSelection();
|
||||
} on PaperlessServerException catch (error, stackTrace) {
|
||||
|
||||
@@ -220,7 +220,7 @@ class DefaultAdaptiveDocumentsView extends AdaptiveDocumentsView {
|
||||
|
||||
Widget _buildListView() {
|
||||
if (showLoadingPlaceholder) {
|
||||
return DocumentsListLoadingWidget();
|
||||
return const DocumentsListLoadingWidget();
|
||||
}
|
||||
|
||||
return ListView.builder(
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:paperless_api/paperless_api.dart';
|
||||
import 'package:paperless_mobile/generated/l10n.dart';
|
||||
import 'package:paperless_mobile/generated/l10n/app_localizations.dart';
|
||||
|
||||
class DeleteDocumentConfirmationDialog extends StatelessWidget {
|
||||
final DocumentModel document;
|
||||
@@ -9,12 +9,12 @@ class DeleteDocumentConfirmationDialog extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return AlertDialog(
|
||||
title: Text(S.of(context).confirmDeletion),
|
||||
title: Text(S.of(context)!.confirmDeletion),
|
||||
content: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Text(
|
||||
S.of(context).areYouSureYouWantToDeleteTheFollowingDocuments(1),
|
||||
S.of(context)!.areYouSureYouWantToDeleteTheFollowingDocuments(1),
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
Text(
|
||||
@@ -26,13 +26,13 @@ class DeleteDocumentConfirmationDialog extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
Text(S.of(context).thisActionIsIrreversibleDoYouWishToProceedAnyway),
|
||||
Text(S.of(context)!.thisActionIsIrreversibleDoYouWishToProceedAnyway),
|
||||
],
|
||||
),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () => Navigator.pop(context, false),
|
||||
child: Text(S.of(context).cancel),
|
||||
child: Text(S.of(context)!.cancel),
|
||||
),
|
||||
TextButton(
|
||||
style: ButtonStyle(
|
||||
@@ -42,7 +42,7 @@ class DeleteDocumentConfirmationDialog extends StatelessWidget {
|
||||
onPressed: () {
|
||||
Navigator.pop(context, true);
|
||||
},
|
||||
child: Text(S.of(context).delete),
|
||||
child: Text(S.of(context)!.delete),
|
||||
),
|
||||
],
|
||||
);
|
||||
|
||||
@@ -3,7 +3,7 @@ import 'package:paperless_api/paperless_api.dart';
|
||||
import 'package:paperless_mobile/core/widgets/empty_state.dart';
|
||||
import 'package:paperless_mobile/extensions/flutter_extensions.dart';
|
||||
import 'package:paperless_mobile/features/paged_document_view/cubit/paged_documents_state.dart';
|
||||
import 'package:paperless_mobile/generated/l10n.dart';
|
||||
import 'package:paperless_mobile/generated/l10n/app_localizations.dart';
|
||||
|
||||
class DocumentsEmptyState extends StatelessWidget {
|
||||
final DocumentPagingState state;
|
||||
@@ -18,13 +18,13 @@ class DocumentsEmptyState extends StatelessWidget {
|
||||
Widget build(BuildContext context) {
|
||||
return Center(
|
||||
child: EmptyState(
|
||||
title: S.of(context).oops,
|
||||
subtitle: S.of(context).thereSeemsToBeNothingHere,
|
||||
title: S.of(context)!.oops,
|
||||
subtitle: S.of(context)!.thereSeemsToBeNothingHere,
|
||||
bottomChild: state.filter != DocumentFilter.initial && onReset != null
|
||||
? TextButton(
|
||||
onPressed: onReset,
|
||||
child: Text(
|
||||
S.of(context).resetFilter,
|
||||
S.of(context)!.resetFilter,
|
||||
),
|
||||
).padded()
|
||||
: null,
|
||||
|
||||
@@ -19,6 +19,7 @@ class DocumentsListLoadingWidget extends StatelessWidget {
|
||||
);
|
||||
} else {
|
||||
return ListView.builder(
|
||||
padding: EdgeInsets.zero,
|
||||
physics: const NeverScrollableScrollPhysics(),
|
||||
itemBuilder: (context, index) => _buildFakeListItem(context),
|
||||
);
|
||||
|
||||
@@ -6,7 +6,7 @@ import 'package:paperless_mobile/core/widgets/form_builder_fields/extended_date_
|
||||
import 'package:paperless_mobile/features/labels/cubit/label_cubit.dart';
|
||||
import 'package:paperless_mobile/features/labels/tags/view/widgets/tags_form_field.dart';
|
||||
import 'package:paperless_mobile/features/labels/view/widgets/label_form_field.dart';
|
||||
import 'package:paperless_mobile/generated/l10n.dart';
|
||||
import 'package:paperless_mobile/generated/l10n/app_localizations.dart';
|
||||
|
||||
import 'text_query_form_field.dart';
|
||||
|
||||
@@ -96,14 +96,14 @@ class _DocumentFilterFormState extends State<DocumentFilterForm> {
|
||||
Align(
|
||||
alignment: Alignment.centerLeft,
|
||||
child: Text(
|
||||
S.of(context).advanced,
|
||||
S.of(context)!.advanced,
|
||||
style: Theme.of(context).textTheme.bodySmall,
|
||||
),
|
||||
),
|
||||
FormBuilderExtendedDateRangePicker(
|
||||
name: DocumentFilterForm.fkCreatedAt,
|
||||
initialValue: widget.initialFilter.created,
|
||||
labelText: S.of(context).createdAt,
|
||||
labelText: S.of(context)!.createdAt,
|
||||
onChanged: (_) {
|
||||
_checkQueryConstraints();
|
||||
},
|
||||
@@ -111,7 +111,7 @@ class _DocumentFilterFormState extends State<DocumentFilterForm> {
|
||||
FormBuilderExtendedDateRangePicker(
|
||||
name: DocumentFilterForm.fkAddedAt,
|
||||
initialValue: widget.initialFilter.added,
|
||||
labelText: S.of(context).addedAt,
|
||||
labelText: S.of(context)!.addedAt,
|
||||
onChanged: (_) {
|
||||
_checkQueryConstraints();
|
||||
},
|
||||
@@ -151,7 +151,7 @@ class _DocumentFilterFormState extends State<DocumentFilterForm> {
|
||||
formBuilderState: widget.formKey.currentState,
|
||||
name: DocumentFilterForm.fkDocumentType,
|
||||
labelOptions: state.labels,
|
||||
textFieldLabel: S.of(context).documentType,
|
||||
textFieldLabel: S.of(context)!.documentType,
|
||||
initialValue: widget.initialFilter.documentType,
|
||||
prefixIcon: const Icon(Icons.description_outlined),
|
||||
);
|
||||
@@ -166,7 +166,7 @@ class _DocumentFilterFormState extends State<DocumentFilterForm> {
|
||||
formBuilderState: widget.formKey.currentState,
|
||||
name: DocumentFilterForm.fkCorrespondent,
|
||||
labelOptions: state.labels,
|
||||
textFieldLabel: S.of(context).correspondent,
|
||||
textFieldLabel: S.of(context)!.correspondent,
|
||||
initialValue: widget.initialFilter.correspondent,
|
||||
prefixIcon: const Icon(Icons.person_outline),
|
||||
);
|
||||
@@ -181,7 +181,7 @@ class _DocumentFilterFormState extends State<DocumentFilterForm> {
|
||||
formBuilderState: widget.formKey.currentState,
|
||||
name: DocumentFilterForm.fkStoragePath,
|
||||
labelOptions: state.labels,
|
||||
textFieldLabel: S.of(context).storagePath,
|
||||
textFieldLabel: S.of(context)!.storagePath,
|
||||
initialValue: widget.initialFilter.storagePath,
|
||||
prefixIcon: const Icon(Icons.folder_outlined),
|
||||
);
|
||||
|
||||
@@ -5,7 +5,7 @@ import 'package:flutter_form_builder/flutter_form_builder.dart';
|
||||
import 'package:paperless_api/paperless_api.dart';
|
||||
import 'package:paperless_mobile/features/documents/view/pages/documents_page.dart';
|
||||
import 'package:paperless_mobile/features/documents/view/widgets/search/document_filter_form.dart';
|
||||
import 'package:paperless_mobile/generated/l10n.dart';
|
||||
import 'package:paperless_mobile/generated/l10n/app_localizations.dart';
|
||||
|
||||
enum DateRangeSelection { before, after }
|
||||
|
||||
@@ -74,7 +74,7 @@ class _DocumentFilterPanelState extends State<DocumentFilterPanel> {
|
||||
visible: MediaQuery.of(context).viewInsets.bottom == 0,
|
||||
child: FloatingActionButton.extended(
|
||||
icon: const Icon(Icons.done),
|
||||
label: Text(S.of(context).apply),
|
||||
label: Text(S.of(context)!.apply),
|
||||
onPressed: _onApplyFilter,
|
||||
),
|
||||
),
|
||||
@@ -85,7 +85,7 @@ class _DocumentFilterPanelState extends State<DocumentFilterPanel> {
|
||||
TextButton.icon(
|
||||
onPressed: _resetFilter,
|
||||
icon: const Icon(Icons.refresh),
|
||||
label: Text(S.of(context).reset),
|
||||
label: Text(S.of(context)!.reset),
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -133,7 +133,7 @@ class _DocumentFilterPanelState extends State<DocumentFilterPanel> {
|
||||
),
|
||||
Padding(
|
||||
padding: EdgeInsets.only(left: _heightAnimationValue * 48),
|
||||
child: Text(S.of(context).filterDocuments),
|
||||
child: Text(S.of(context)!.filterDocuments),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
@@ -5,7 +5,7 @@ import 'package:paperless_api/paperless_api.dart';
|
||||
import 'package:paperless_mobile/core/translation/sort_field_localization_mapper.dart';
|
||||
import 'package:paperless_mobile/extensions/flutter_extensions.dart';
|
||||
import 'package:paperless_mobile/features/labels/cubit/label_cubit.dart';
|
||||
import 'package:paperless_mobile/generated/l10n.dart';
|
||||
import 'package:paperless_mobile/generated/l10n/app_localizations.dart';
|
||||
|
||||
class SortFieldSelectionBottomSheet extends StatefulWidget {
|
||||
final SortOrder initialSortOrder;
|
||||
@@ -48,12 +48,12 @@ class _SortFieldSelectionBottomSheetState
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
S.of(context).orderBy,
|
||||
S.of(context)!.orderBy,
|
||||
style: Theme.of(context).textTheme.bodySmall,
|
||||
textAlign: TextAlign.start,
|
||||
),
|
||||
TextButton(
|
||||
child: Text(S.of(context).apply),
|
||||
child: Text(S.of(context)!.apply),
|
||||
onPressed: () {
|
||||
widget.onSubmit(
|
||||
_currentSortField,
|
||||
@@ -105,12 +105,12 @@ class _SortFieldSelectionBottomSheetState
|
||||
ButtonSegment(
|
||||
icon: const FaIcon(FontAwesomeIcons.arrowDownAZ),
|
||||
value: SortOrder.descending,
|
||||
label: Text(S.of(context).descending),
|
||||
label: Text(S.of(context)!.descending),
|
||||
),
|
||||
ButtonSegment(
|
||||
icon: const FaIcon(FontAwesomeIcons.arrowUpZA),
|
||||
value: SortOrder.ascending,
|
||||
label: Text(S.of(context).ascending),
|
||||
label: Text(S.of(context)!.ascending),
|
||||
),
|
||||
],
|
||||
emptySelectionAllowed: false,
|
||||
|
||||
@@ -3,7 +3,8 @@ import 'package:flutter_form_builder/flutter_form_builder.dart';
|
||||
import 'package:paperless_api/paperless_api.dart';
|
||||
import 'package:paperless_mobile/core/widgets/form_builder_fields/form_builder_type_ahead.dart';
|
||||
import 'package:paperless_mobile/features/documents/cubit/documents_cubit.dart';
|
||||
import 'package:paperless_mobile/generated/l10n.dart';
|
||||
import 'package:paperless_mobile/generated/l10n/app_localizations.dart';
|
||||
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
class TextQueryFormField extends StatelessWidget {
|
||||
@@ -63,19 +64,19 @@ class TextQueryFormField extends StatelessWidget {
|
||||
itemBuilder: (context) => [
|
||||
PopupMenuItem(
|
||||
child: ListTile(
|
||||
title: Text(S.of(context).titleAndContent),
|
||||
title: Text(S.of(context)!.titleAndContent),
|
||||
),
|
||||
value: QueryType.titleAndContent,
|
||||
),
|
||||
PopupMenuItem(
|
||||
child: ListTile(
|
||||
title: Text(S.of(context).title),
|
||||
title: Text(S.of(context)!.title),
|
||||
),
|
||||
value: QueryType.title,
|
||||
),
|
||||
PopupMenuItem(
|
||||
child: ListTile(
|
||||
title: Text(S.of(context).extended),
|
||||
title: Text(S.of(context)!.extended),
|
||||
),
|
||||
value: QueryType.extended,
|
||||
),
|
||||
@@ -89,11 +90,11 @@ class TextQueryFormField extends StatelessWidget {
|
||||
String _buildLabelText(BuildContext context, QueryType queryType) {
|
||||
switch (queryType) {
|
||||
case QueryType.title:
|
||||
return S.of(context).title;
|
||||
return S.of(context)!.title;
|
||||
case QueryType.titleAndContent:
|
||||
return S.of(context).titleAndContent;
|
||||
return S.of(context)!.titleAndContent;
|
||||
case QueryType.extended:
|
||||
return S.of(context).extended;
|
||||
return S.of(context)!.extended;
|
||||
default:
|
||||
return '';
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:paperless_api/paperless_api.dart';
|
||||
import 'package:paperless_mobile/features/documents/cubit/documents_cubit.dart';
|
||||
import 'package:paperless_mobile/generated/l10n.dart';
|
||||
import 'package:paperless_mobile/generated/l10n/app_localizations.dart';
|
||||
|
||||
class BulkDeleteConfirmationDialog extends StatelessWidget {
|
||||
final DocumentsState state;
|
||||
@@ -14,24 +14,24 @@ class BulkDeleteConfirmationDialog extends StatelessWidget {
|
||||
Widget build(BuildContext context) {
|
||||
assert(state.selection.isNotEmpty);
|
||||
return AlertDialog(
|
||||
title: Text(S.of(context).confirmDeletion),
|
||||
title: Text(S.of(context)!.confirmDeletion),
|
||||
content: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Text(
|
||||
S.of(context).areYouSureYouWantToDeleteTheFollowingDocuments(
|
||||
S.of(context)!.areYouSureYouWantToDeleteTheFollowingDocuments(
|
||||
state.selection.length),
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
...state.selection.map(_buildBulletPoint).toList(),
|
||||
const SizedBox(height: 16),
|
||||
Text(S.of(context).thisActionIsIrreversibleDoYouWishToProceedAnyway),
|
||||
Text(S.of(context)!.thisActionIsIrreversibleDoYouWishToProceedAnyway),
|
||||
],
|
||||
),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () => Navigator.pop(context, false),
|
||||
child: Text(S.of(context).cancel),
|
||||
child: Text(S.of(context)!.cancel),
|
||||
),
|
||||
TextButton(
|
||||
style: ButtonStyle(
|
||||
@@ -41,7 +41,7 @@ class BulkDeleteConfirmationDialog extends StatelessWidget {
|
||||
onPressed: () {
|
||||
Navigator.pop(context, true);
|
||||
},
|
||||
child: Text(S.of(context).delete),
|
||||
child: Text(S.of(context)!.delete),
|
||||
),
|
||||
],
|
||||
);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:paperless_api/paperless_api.dart';
|
||||
import 'package:paperless_mobile/generated/l10n.dart';
|
||||
import 'package:paperless_mobile/generated/l10n/app_localizations.dart';
|
||||
|
||||
class ConfirmDeleteSavedViewDialog extends StatelessWidget {
|
||||
const ConfirmDeleteSavedViewDialog({
|
||||
@@ -14,18 +14,18 @@ class ConfirmDeleteSavedViewDialog extends StatelessWidget {
|
||||
Widget build(BuildContext context) {
|
||||
return AlertDialog(
|
||||
title: Text(
|
||||
S.of(context).deleteView + view.name + "?",
|
||||
S.of(context)!.deleteView + view.name + "?",
|
||||
softWrap: true,
|
||||
),
|
||||
content: Text(S.of(context).doYouReallyWantToDeleteThisView),
|
||||
content: Text(S.of(context)!.doYouReallyWantToDeleteThisView),
|
||||
actions: [
|
||||
TextButton(
|
||||
child: Text(S.of(context).cancel),
|
||||
child: Text(S.of(context)!.cancel),
|
||||
onPressed: () => Navigator.pop(context, false),
|
||||
),
|
||||
TextButton(
|
||||
child: Text(
|
||||
S.of(context).delete,
|
||||
S.of(context)!.delete,
|
||||
style: TextStyle(color: Theme.of(context).colorScheme.error),
|
||||
),
|
||||
onPressed: () => Navigator.pop(context, true),
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:paperless_mobile/features/settings/model/view_type.dart';
|
||||
import 'package:paperless_mobile/generated/l10n.dart';
|
||||
import 'package:paperless_mobile/generated/l10n/app_localizations.dart';
|
||||
|
||||
/// Meant to be used with blocbuilder.
|
||||
class ViewTypeSelectionWidget extends StatelessWidget {
|
||||
@@ -34,19 +34,19 @@ class ViewTypeSelectionWidget extends StatelessWidget {
|
||||
_buildViewTypeOption(
|
||||
context,
|
||||
type: ViewType.list,
|
||||
label: S.of(context).list,
|
||||
label: S.of(context)!.list,
|
||||
icon: Icons.list,
|
||||
),
|
||||
_buildViewTypeOption(
|
||||
context,
|
||||
type: ViewType.grid,
|
||||
label: S.of(context).grid,
|
||||
label: S.of(context)!.grid,
|
||||
icon: Icons.grid_view_rounded,
|
||||
),
|
||||
_buildViewTypeOption(
|
||||
context,
|
||||
type: ViewType.detailed,
|
||||
label: S.of(context).detailed,
|
||||
label: S.of(context)!.detailed,
|
||||
icon: Icons.article_outlined,
|
||||
),
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user