mirror of
https://github.com/Xevion/paperless-mobile.git
synced 2025-12-15 02:12:25 -06:00
feat: Migrated strings, and translations to native flutter l10n plugin
This commit is contained in:
@@ -5,7 +5,8 @@ import 'package:flutter/material.dart';
|
||||
import 'package:flutter_form_builder/flutter_form_builder.dart';
|
||||
import 'package:paperless_mobile/extensions/flutter_extensions.dart';
|
||||
import 'package:paperless_mobile/features/login/model/client_certificate.dart';
|
||||
import 'package:paperless_mobile/generated/l10n.dart';
|
||||
import 'package:paperless_mobile/generated/l10n/app_localizations.dart';
|
||||
|
||||
import 'package:paperless_mobile/constants.dart';
|
||||
import 'package:permission_handler/permission_handler.dart';
|
||||
|
||||
@@ -40,7 +41,7 @@ class _ClientCertificateFormFieldState
|
||||
}
|
||||
assert(_selectedFile != null);
|
||||
if (_selectedFile?.path.split(".").last != 'pfx') {
|
||||
return S.of(context).invalidCertificateFormat;
|
||||
return S.of(context)!.invalidCertificateFormat;
|
||||
}
|
||||
return null;
|
||||
},
|
||||
@@ -50,8 +51,8 @@ class _ClientCertificateFormFieldState
|
||||
return Theme(
|
||||
data: theme,
|
||||
child: ExpansionTile(
|
||||
title: Text(S.of(context).clientcertificate),
|
||||
subtitle: Text(S.of(context).configureMutualTLSAuthentication),
|
||||
title: Text(S.of(context)!.clientcertificate),
|
||||
subtitle: Text(S.of(context)!.configureMutualTLSAuthentication),
|
||||
children: [
|
||||
InputDecorator(
|
||||
decoration: InputDecoration(
|
||||
@@ -67,7 +68,7 @@ class _ClientCertificateFormFieldState
|
||||
children: [
|
||||
ElevatedButton(
|
||||
onPressed: () => _onSelectFile(field),
|
||||
child: Text(S.of(context).select),
|
||||
child: Text(S.of(context)!.select),
|
||||
),
|
||||
_buildSelectedFileText(field).paddedOnly(left: 8),
|
||||
],
|
||||
@@ -85,7 +86,7 @@ class _ClientCertificateFormFieldState
|
||||
// ListTile(
|
||||
// leading: ElevatedButton(
|
||||
// onPressed: () => _onSelectFile(field),
|
||||
// child: Text(S.of(context).select),
|
||||
// child: Text(S.of(context)!.select),
|
||||
// ),
|
||||
// title: _buildSelectedFileText(field),
|
||||
// trailing: AbsorbPointer(
|
||||
@@ -108,7 +109,7 @@ class _ClientCertificateFormFieldState
|
||||
onChanged: (value) => field.didChange(
|
||||
field.value?.copyWith(passphrase: value),
|
||||
),
|
||||
label: S.of(context).passphrase,
|
||||
label: S.of(context)!.passphrase,
|
||||
).padded(),
|
||||
] else
|
||||
...[]
|
||||
@@ -143,7 +144,7 @@ class _ClientCertificateFormFieldState
|
||||
if (field.value == null) {
|
||||
assert(_selectedFile == null);
|
||||
return Text(
|
||||
S.of(context).selectFile,
|
||||
S.of(context)!.selectFile,
|
||||
style: Theme.of(context).textTheme.labelMedium?.apply(
|
||||
color: Theme.of(context).hintColor,
|
||||
),
|
||||
|
||||
@@ -3,7 +3,7 @@ import 'dart:developer';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_form_builder/flutter_form_builder.dart';
|
||||
import 'package:form_builder_validators/form_builder_validators.dart';
|
||||
import 'package:paperless_mobile/generated/l10n.dart';
|
||||
import 'package:paperless_mobile/generated/l10n/app_localizations.dart';
|
||||
|
||||
class ServerAddressFormField extends StatefulWidget {
|
||||
static const String fkServerAddress = "serverAddress";
|
||||
@@ -44,16 +44,16 @@ class _ServerAddressFormFieldState extends State<ServerAddressFormField> {
|
||||
autovalidateMode: AutovalidateMode.onUserInteraction,
|
||||
validator: FormBuilderValidators.compose([
|
||||
FormBuilderValidators.required(
|
||||
errorText: S.of(context).serverAddressMustNotBeEmpty,
|
||||
errorText: S.of(context)!.serverAddressMustNotBeEmpty,
|
||||
),
|
||||
FormBuilderValidators.match(
|
||||
r"https?://.*",
|
||||
errorText: S.of(context).serverAddressMustIncludeAScheme,
|
||||
errorText: S.of(context)!.serverAddressMustIncludeAScheme,
|
||||
)
|
||||
]),
|
||||
decoration: InputDecoration(
|
||||
hintText: "http://192.168.1.50:8000",
|
||||
labelText: S.of(context).serverAddress,
|
||||
labelText: S.of(context)!.serverAddress,
|
||||
suffixIcon: _canClear
|
||||
? IconButton(
|
||||
icon: const Icon(Icons.clear),
|
||||
|
||||
@@ -4,7 +4,7 @@ import 'package:form_builder_validators/form_builder_validators.dart';
|
||||
import 'package:paperless_mobile/extensions/flutter_extensions.dart';
|
||||
import 'package:paperless_mobile/features/login/model/user_credentials.model.dart';
|
||||
import 'package:paperless_mobile/features/login/view/widgets/form_fields/obscured_input_text_form_field.dart';
|
||||
import 'package:paperless_mobile/generated/l10n.dart';
|
||||
import 'package:paperless_mobile/generated/l10n/app_localizations.dart';
|
||||
|
||||
class UserCredentialsFormField extends StatefulWidget {
|
||||
static const fkCredentials = 'credentials';
|
||||
@@ -37,22 +37,22 @@ class _UserCredentialsFormFieldState extends State<UserCredentialsFormField> {
|
||||
UserCredentials(username: username),
|
||||
),
|
||||
validator: FormBuilderValidators.required(
|
||||
errorText: S.of(context).usernameMustNotBeEmpty,
|
||||
errorText: S.of(context)!.usernameMustNotBeEmpty,
|
||||
),
|
||||
autofillHints: const [AutofillHints.username],
|
||||
decoration: InputDecoration(
|
||||
label: Text(S.of(context).username),
|
||||
label: Text(S.of(context)!.username),
|
||||
),
|
||||
),
|
||||
ObscuredInputTextFormField(
|
||||
key: const ValueKey('login-password'),
|
||||
label: S.of(context).password,
|
||||
label: S.of(context)!.password,
|
||||
onChanged: (password) => field.didChange(
|
||||
field.value?.copyWith(password: password) ??
|
||||
UserCredentials(password: password),
|
||||
),
|
||||
validator: FormBuilderValidators.required(
|
||||
errorText: S.of(context).passwordMustNotBeEmpty,
|
||||
errorText: S.of(context)!.passwordMustNotBeEmpty,
|
||||
),
|
||||
),
|
||||
].map((child) => child.padded()).toList(),
|
||||
@@ -73,11 +73,11 @@ class _UserCredentialsFormFieldState extends State<UserCredentialsFormField> {
|
||||
FocusScope.of(context).requestFocus(_focusNodes[fkPassword]);
|
||||
},
|
||||
validator: FormBuilderValidators.required(
|
||||
errorText: S.of(context).usernameMustNotBeEmpty,
|
||||
errorText: S.of(context)!.usernameMustNotBeEmpty,
|
||||
),
|
||||
autofillHints: const [AutofillHints.username],
|
||||
decoration: InputDecoration(
|
||||
labelText: S.of(context).username,
|
||||
labelText: S.of(context)!.username,
|
||||
),
|
||||
).padded(),
|
||||
FormBuilderTextField(
|
||||
@@ -88,11 +88,11 @@ class _UserCredentialsFormFieldState extends State<UserCredentialsFormField> {
|
||||
},
|
||||
autofillHints: const [AutofillHints.password],
|
||||
validator: FormBuilderValidators.required(
|
||||
errorText: S.of(context).passwordMustNotBeEmpty,
|
||||
errorText: S.of(context)!.passwordMustNotBeEmpty,
|
||||
),
|
||||
obscureText: true,
|
||||
decoration: InputDecoration(
|
||||
labelText: S.of(context).password,
|
||||
labelText: S.of(context)!.password,
|
||||
),
|
||||
).padded(),
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user