feat: Migrated strings, and translations to native flutter l10n plugin

This commit is contained in:
Anton Stubenbord
2023-02-17 00:00:13 +01:00
parent 7b55a96164
commit 14ab604118
90 changed files with 1661 additions and 683 deletions

View File

@@ -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),
);

View File

@@ -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),
),
],
),

View File

@@ -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,

View File

@@ -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 '';
}