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

@@ -16,7 +16,8 @@ import 'package:paperless_mobile/features/edit_label/view/impl/add_document_type
import 'package:paperless_mobile/features/edit_label/view/impl/add_storage_path_page.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 'package:paperless_mobile/helpers/message_helpers.dart';
class DocumentEditPage extends StatefulWidget {
@@ -59,10 +60,10 @@ class _DocumentEditPageState extends State<DocumentEditPage> {
floatingActionButton: FloatingActionButton.extended(
onPressed: () => _onSubmit(state.document),
icon: const Icon(Icons.save),
label: Text(S.of(context).saveChanges),
label: Text(S.of(context)!.saveChanges),
),
appBar: AppBar(
title: Text(S.of(context).editDocument),
title: Text(S.of(context)!.editDocument),
bottom: _isSubmitLoading
? const PreferredSize(
preferredSize: Size.fromHeight(4),
@@ -159,7 +160,7 @@ class _DocumentEditPageState extends State<DocumentEditPage> {
create: (context) => context.read<LabelRepository<StoragePath>>(),
child: AddStoragePathPage(initalValue: initialValue),
),
textFieldLabel: S.of(context).storagePath,
textFieldLabel: S.of(context)!.storagePath,
labelOptions: options,
initialValue: IdQueryParameter.fromId(initialId),
name: fkStoragePath,
@@ -180,7 +181,7 @@ class _DocumentEditPageState extends State<DocumentEditPage> {
create: (context) => context.read<LabelRepository<Correspondent>>(),
child: AddCorrespondentPage(initialName: initialValue),
),
textFieldLabel: S.of(context).correspondent,
textFieldLabel: S.of(context)!.correspondent,
labelOptions: options,
initialValue: IdQueryParameter.fromId(initialId),
name: fkCorrespondent,
@@ -214,7 +215,7 @@ class _DocumentEditPageState extends State<DocumentEditPage> {
initialName: currentInput,
),
),
textFieldLabel: S.of(context).documentType,
textFieldLabel: S.of(context)!.documentType,
initialValue: IdQueryParameter.fromId(initialId),
labelOptions: options,
name: fkDocumentType,
@@ -249,7 +250,7 @@ class _DocumentEditPageState extends State<DocumentEditPage> {
});
try {
await context.read<DocumentEditCubit>().updateDocument(mergedDocument);
showSnackBar(context, S.of(context).documentSuccessfullyUpdated);
showSnackBar(context, S.of(context)!.documentSuccessfullyUpdated);
} on PaperlessServerException catch (error, stackTrace) {
showErrorMessage(context, error, stackTrace);
} finally {
@@ -266,7 +267,7 @@ class _DocumentEditPageState extends State<DocumentEditPage> {
name: fkTitle,
validator: FormBuilderValidators.required(),
decoration: InputDecoration(
label: Text(S.of(context).title),
label: Text(S.of(context)!.title),
),
initialValue: initialTitle,
);
@@ -281,7 +282,7 @@ class _DocumentEditPageState extends State<DocumentEditPage> {
name: fkCreatedDate,
decoration: InputDecoration(
prefixIcon: const Icon(Icons.calendar_month_outlined),
label: Text(S.of(context).createdAt),
label: Text(S.of(context)!.createdAt),
),
initialValue: initialCreatedAtDate,
format: DateFormat.yMMMMd(),
@@ -311,7 +312,7 @@ class _DocumentEditPageState extends State<DocumentEditPage> {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
S.of(context).suggestions,
S.of(context)!.suggestions,
style: Theme.of(context).textTheme.bodySmall,
),
SizedBox(