mirror of
https://github.com/Xevion/paperless-mobile.git
synced 2025-12-09 02:07:58 -06:00
feat: Migrated strings, and translations to native flutter l10n plugin
This commit is contained in:
@@ -21,7 +21,8 @@ import 'package:paperless_mobile/features/documents/view/widgets/delete_document
|
||||
import 'package:paperless_mobile/features/documents/view/widgets/document_preview.dart';
|
||||
import 'package:paperless_mobile/features/similar_documents/cubit/similar_documents_cubit.dart';
|
||||
import 'package:paperless_mobile/features/similar_documents/view/similar_documents_view.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:path_provider/path_provider.dart';
|
||||
import 'package:share_plus/share_plus.dart';
|
||||
@@ -102,7 +103,7 @@ class _DocumentDetailsPageState extends State<DocumentDetailsPage> {
|
||||
tabs: [
|
||||
Tab(
|
||||
child: Text(
|
||||
S.of(context).overview,
|
||||
S.of(context)!.overview,
|
||||
style: TextStyle(
|
||||
color: Theme.of(context)
|
||||
.colorScheme
|
||||
@@ -112,7 +113,7 @@ class _DocumentDetailsPageState extends State<DocumentDetailsPage> {
|
||||
),
|
||||
Tab(
|
||||
child: Text(
|
||||
S.of(context).content,
|
||||
S.of(context)!.content,
|
||||
style: TextStyle(
|
||||
color: Theme.of(context)
|
||||
.colorScheme
|
||||
@@ -122,7 +123,7 @@ class _DocumentDetailsPageState extends State<DocumentDetailsPage> {
|
||||
),
|
||||
Tab(
|
||||
child: Text(
|
||||
S.of(context).metaData,
|
||||
S.of(context)!.metaData,
|
||||
style: TextStyle(
|
||||
color: Theme.of(context)
|
||||
.colorScheme
|
||||
@@ -132,7 +133,7 @@ class _DocumentDetailsPageState extends State<DocumentDetailsPage> {
|
||||
),
|
||||
Tab(
|
||||
child: Text(
|
||||
S.of(context).similarDocuments,
|
||||
S.of(context)!.similarDocuments,
|
||||
style: TextStyle(
|
||||
color: Theme.of(context)
|
||||
.colorScheme
|
||||
@@ -198,7 +199,7 @@ class _DocumentDetailsPageState extends State<DocumentDetailsPage> {
|
||||
position: b.BadgePosition.topEnd(top: -12, end: -6),
|
||||
showBadge: _filteredSuggestions.hasSuggestions,
|
||||
child: Tooltip(
|
||||
message: S.of(context).editDocumentTooltip,
|
||||
message: S.of(context)!.editDocumentTooltip,
|
||||
preferBelow: false,
|
||||
verticalOffset: 40,
|
||||
child: FloatingActionButton(
|
||||
@@ -231,14 +232,14 @@ class _DocumentDetailsPageState extends State<DocumentDetailsPage> {
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
IconButton(
|
||||
tooltip: S.of(context).deleteDocumentTooltip,
|
||||
tooltip: S.of(context)!.deleteDocumentTooltip,
|
||||
icon: const Icon(Icons.delete),
|
||||
onPressed: widget.allowEdit && isConnected
|
||||
? () => _onDelete(state.document)
|
||||
: null,
|
||||
).paddedSymmetrically(horizontal: 4),
|
||||
Tooltip(
|
||||
message: S.of(context).downloadDocumentTooltip,
|
||||
message: S.of(context)!.downloadDocumentTooltip,
|
||||
child: DocumentDownloadButton(
|
||||
document: state.document,
|
||||
enabled: isConnected,
|
||||
@@ -246,18 +247,18 @@ class _DocumentDetailsPageState extends State<DocumentDetailsPage> {
|
||||
),
|
||||
),
|
||||
IconButton(
|
||||
tooltip: S.of(context).previewTooltip,
|
||||
tooltip: S.of(context)!.previewTooltip,
|
||||
icon: const Icon(Icons.visibility),
|
||||
onPressed:
|
||||
isConnected ? () => _onOpen(state.document) : null,
|
||||
).paddedOnly(right: 4.0),
|
||||
IconButton(
|
||||
tooltip: S.of(context).openInSystemViewer,
|
||||
tooltip: S.of(context)!.openInSystemViewer,
|
||||
icon: const Icon(Icons.open_in_new),
|
||||
onPressed: isConnected ? _onOpenFileInSystemViewer : null,
|
||||
).paddedOnly(right: 4.0),
|
||||
IconButton(
|
||||
tooltip: S.of(context).shareTooltip,
|
||||
tooltip: S.of(context)!.shareTooltip,
|
||||
icon: const Icon(Icons.share),
|
||||
onPressed: isConnected
|
||||
? () =>
|
||||
@@ -322,13 +323,14 @@ class _DocumentDetailsPageState extends State<DocumentDetailsPage> {
|
||||
await context.read<DocumentDetailsCubit>().openDocumentInSystemViewer();
|
||||
if (status == ResultType.done) return;
|
||||
if (status == ResultType.noAppToOpen) {
|
||||
showGenericError(context, S.of(context).noAppToDisplayPDFFilesFound);
|
||||
showGenericError(context, S.of(context)!.noAppToDisplayPDFFilesFound);
|
||||
}
|
||||
if (status == ResultType.fileNotFound) {
|
||||
showGenericError(context, translateError(context, ErrorCode.unknown));
|
||||
}
|
||||
if (status == ResultType.permissionDenied) {
|
||||
showGenericError(context, S.of(context).couldNotOpenFilePermissionDenied);
|
||||
showGenericError(
|
||||
context, S.of(context)!.couldNotOpenFilePermissionDenied);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -342,7 +344,7 @@ class _DocumentDetailsPageState extends State<DocumentDetailsPage> {
|
||||
if (delete) {
|
||||
try {
|
||||
await context.read<DocumentDetailsCubit>().delete(document);
|
||||
showSnackBar(context, S.of(context).documentSuccessfullyDeleted);
|
||||
showSnackBar(context, S.of(context)!.documentSuccessfullyDeleted);
|
||||
} on PaperlessServerException catch (error, stackTrace) {
|
||||
showErrorMessage(context, error, stackTrace);
|
||||
} finally {
|
||||
|
||||
@@ -3,7 +3,7 @@ import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:paperless_api/paperless_api.dart';
|
||||
import 'package:paperless_mobile/core/widgets/highlighted_text.dart';
|
||||
import 'package:paperless_mobile/features/document_details/cubit/document_details_cubit.dart';
|
||||
import 'package:paperless_mobile/generated/l10n.dart';
|
||||
import 'package:paperless_mobile/generated/l10n/app_localizations.dart';
|
||||
|
||||
class DocumentContentWidget extends StatelessWidget {
|
||||
final bool isFullContentLoaded;
|
||||
@@ -38,7 +38,7 @@ class DocumentContentWidget extends StatelessWidget {
|
||||
Align(
|
||||
alignment: Alignment.bottomCenter,
|
||||
child: TextButton(
|
||||
child: Text(S.of(context).loadFullContent),
|
||||
child: Text(S.of(context)!.loadFullContent),
|
||||
onPressed: () {
|
||||
context.read<DocumentDetailsCubit>().loadFullContent();
|
||||
},
|
||||
|
||||
@@ -5,7 +5,8 @@ import 'package:paperless_api/paperless_api.dart';
|
||||
import 'package:paperless_mobile/core/service/file_service.dart';
|
||||
import 'package:paperless_mobile/extensions/flutter_extensions.dart';
|
||||
import 'package:paperless_mobile/features/settings/view/widgets/radio_settings_dialog.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/helpers/permission_helpers.dart';
|
||||
import 'package:paperless_mobile/constants.dart';
|
||||
@@ -53,15 +54,15 @@ class _DocumentDownloadButtonState extends State<DocumentDownloadButton> {
|
||||
final downloadOriginal = await showDialog<bool>(
|
||||
context: context,
|
||||
builder: (context) => RadioSettingsDialog(
|
||||
titleText: S.of(context).chooseFiletype,
|
||||
titleText: S.of(context)!.chooseFiletype,
|
||||
options: [
|
||||
RadioOption(
|
||||
value: true,
|
||||
label: S.of(context).original +
|
||||
label: S.of(context)!.original +
|
||||
" (${meta.originalMimeType.split("/").last})"),
|
||||
RadioOption(
|
||||
value: false,
|
||||
label: S.of(context).archivedPdf,
|
||||
label: S.of(context)!.archivedPdf,
|
||||
),
|
||||
],
|
||||
initialValue: false,
|
||||
@@ -91,7 +92,7 @@ class _DocumentDownloadButtonState extends State<DocumentDownloadButton> {
|
||||
createdFile.createSync(recursive: true);
|
||||
createdFile.writeAsBytesSync(bytes);
|
||||
debugPrint("Downloaded file to $filePath");
|
||||
showSnackBar(context, S.of(context).documentSuccessfullyDownloaded);
|
||||
showSnackBar(context, S.of(context)!.documentSuccessfullyDownloaded);
|
||||
} on PaperlessServerException catch (error, stackTrace) {
|
||||
showErrorMessage(context, error, stackTrace);
|
||||
} catch (error) {
|
||||
|
||||
@@ -7,7 +7,8 @@ import 'package:paperless_mobile/core/widgets/offline_widget.dart';
|
||||
import 'package:paperless_mobile/extensions/flutter_extensions.dart';
|
||||
import 'package:paperless_mobile/features/document_details/cubit/document_details_cubit.dart';
|
||||
import 'package:paperless_mobile/features/document_details/view/widgets/details_item.dart';
|
||||
import 'package:paperless_mobile/generated/l10n.dart';
|
||||
import 'package:paperless_mobile/generated/l10n/app_localizations.dart';
|
||||
|
||||
import 'package:paperless_mobile/helpers/format_helpers.dart';
|
||||
import 'package:paperless_mobile/helpers/message_helpers.dart';
|
||||
|
||||
@@ -44,39 +45,40 @@ class DocumentMetaDataWidget extends StatelessWidget {
|
||||
),
|
||||
children: [
|
||||
DetailsItem(
|
||||
label: S.of(context).archiveSerialNumber,
|
||||
label: S.of(context)!.archiveSerialNumber,
|
||||
content: document.archiveSerialNumber != null
|
||||
? Text(document.archiveSerialNumber.toString())
|
||||
: TextButton.icon(
|
||||
icon: const Icon(Icons.archive_outlined),
|
||||
label: Text(S.of(context).AssignAsn),
|
||||
label: Text(S.of(context)!.assignAsn),
|
||||
onPressed: connectivity.isConnected
|
||||
? () => _assignAsn(context)
|
||||
: null,
|
||||
),
|
||||
).paddedOnly(bottom: itemSpacing),
|
||||
DetailsItem.text(DateFormat().format(document.modified),
|
||||
label: S.of(context).modifiedAt, context: context)
|
||||
label: S.of(context)!.modifiedAt, context: context)
|
||||
.paddedOnly(bottom: itemSpacing),
|
||||
DetailsItem.text(DateFormat().format(document.added),
|
||||
label: S.of(context).addedAt, context: context)
|
||||
label: S.of(context)!.addedAt, context: context)
|
||||
.paddedOnly(bottom: itemSpacing),
|
||||
DetailsItem.text(
|
||||
meta.mediaFilename,
|
||||
context: context,
|
||||
label: S.of(context).mediaFilename,
|
||||
label: S.of(context)!.mediaFilename,
|
||||
).paddedOnly(bottom: itemSpacing),
|
||||
DetailsItem.text(
|
||||
meta.originalChecksum,
|
||||
context: context,
|
||||
label: S.of(context).originalMD5Checksum,
|
||||
label: S.of(context)!.originalMD5Checksum,
|
||||
).paddedOnly(bottom: itemSpacing),
|
||||
DetailsItem.text(formatBytes(meta.originalSize, 2),
|
||||
label: S.of(context).originalFileSize, context: context)
|
||||
label: S.of(context)!.originalFileSize,
|
||||
context: context)
|
||||
.paddedOnly(bottom: itemSpacing),
|
||||
DetailsItem.text(
|
||||
meta.originalMimeType,
|
||||
label: S.of(context).originalMIMEType,
|
||||
label: S.of(context)!.originalMIMEType,
|
||||
context: context,
|
||||
).paddedOnly(bottom: itemSpacing),
|
||||
],
|
||||
|
||||
@@ -7,7 +7,7 @@ import 'package:paperless_mobile/features/document_details/view/widgets/details_
|
||||
import 'package:paperless_mobile/features/labels/storage_path/view/widgets/storage_path_widget.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';
|
||||
|
||||
class DocumentOverviewWidget extends StatelessWidget {
|
||||
final DocumentModel document;
|
||||
@@ -29,7 +29,7 @@ class DocumentOverviewWidget extends StatelessWidget {
|
||||
),
|
||||
children: [
|
||||
DetailsItem(
|
||||
label: S.of(context).title,
|
||||
label: S.of(context)!.title,
|
||||
content: HighlightedText(
|
||||
text: document.title,
|
||||
highlights: queryString?.split(" ") ?? [],
|
||||
@@ -39,12 +39,12 @@ class DocumentOverviewWidget extends StatelessWidget {
|
||||
DetailsItem.text(
|
||||
DateFormat.yMMMMd().format(document.created),
|
||||
context: context,
|
||||
label: S.of(context).createdAt,
|
||||
label: S.of(context)!.createdAt,
|
||||
).paddedOnly(bottom: itemSpacing),
|
||||
Visibility(
|
||||
visible: document.documentType != null,
|
||||
child: DetailsItem(
|
||||
label: S.of(context).documentType,
|
||||
label: S.of(context)!.documentType,
|
||||
content: LabelText<DocumentType>(
|
||||
style: Theme.of(context).textTheme.bodyLarge,
|
||||
id: document.documentType,
|
||||
@@ -54,7 +54,7 @@ class DocumentOverviewWidget extends StatelessWidget {
|
||||
Visibility(
|
||||
visible: document.correspondent != null,
|
||||
child: DetailsItem(
|
||||
label: S.of(context).correspondent,
|
||||
label: S.of(context)!.correspondent,
|
||||
content: LabelText<Correspondent>(
|
||||
style: Theme.of(context).textTheme.bodyLarge,
|
||||
id: document.correspondent,
|
||||
@@ -64,7 +64,7 @@ class DocumentOverviewWidget extends StatelessWidget {
|
||||
Visibility(
|
||||
visible: document.storagePath != null,
|
||||
child: DetailsItem(
|
||||
label: S.of(context).storagePath,
|
||||
label: S.of(context)!.storagePath,
|
||||
content: StoragePathWidget(
|
||||
pathId: document.storagePath,
|
||||
),
|
||||
@@ -73,7 +73,7 @@ class DocumentOverviewWidget extends StatelessWidget {
|
||||
Visibility(
|
||||
visible: document.tags.isNotEmpty,
|
||||
child: DetailsItem(
|
||||
label: S.of(context).tags,
|
||||
label: S.of(context)!.tags,
|
||||
content: Padding(
|
||||
padding: const EdgeInsets.only(top: 8.0),
|
||||
child: TagsWidget(
|
||||
|
||||
Reference in New Issue
Block a user