Browse Source

neon: Fix localization error message key names

pull/38/head
jld3103 2 years ago
parent
commit
a80aab94c1
No known key found for this signature in database
GPG Key ID: 9062417B9E8EB7B3
  1. 6
      packages/neon/lib/l10n/en.arb
  2. 20
      packages/neon/lib/l10n/localizations.dart
  3. 10
      packages/neon/lib/l10n/localizations_en.dart
  4. 2
      packages/neon/lib/src/pages/login/login.dart
  5. 8
      packages/neon/lib/src/utils/validators.dart

6
packages/neon/lib/l10n/en.arb

@ -1,11 +1,11 @@
{ {
"@@locale": "en", "@@locale": "en",
"appName": "Nextcloud Neon", "appName": "Nextcloud Neon",
"loginAccountAlreadyExists": "The account you are trying to add already exists",
"loginAgain": "Login again", "loginAgain": "Login again",
"loginOpenAgain": "Open again", "loginOpenAgain": "Open again",
"loginSwitchToBrowserWindow": "Please switch to the browser window that just opened and proceed there", "loginSwitchToBrowserWindow": "Please switch to the browser window that just opened and proceed there",
"loginWorksWith": "works with", "loginWorksWith": "works with",
"errorAccountAlreadyExists": "The account you are trying to add already exists",
"errorCredentialsForAccountNoLongerMatch": "The credentials for this account no longer match", "errorCredentialsForAccountNoLongerMatch": "The credentials for this account no longer match",
"errorServerHadAProblemProcessingYourRequest": "The server had a problem while processing your request. You might want to try again", "errorServerHadAProblemProcessingYourRequest": "The server had a problem while processing your request. You might want to try again",
"errorSomethingWentWrongTryAgainLater": "Something went wrong. Please try again later", "errorSomethingWentWrongTryAgainLater": "Something went wrong. Please try again later",
@ -37,8 +37,8 @@
} }
} }
}, },
"validatorEmptyField": "This field can not be empty", "errorEmptyField": "This field can not be empty",
"validatorInvalidURL": "Invalid URL provided", "errorInvalidURL": "Invalid URL provided",
"delete": "Delete", "delete": "Delete",
"remove": "Remove", "remove": "Remove",
"rename": "Rename", "rename": "Rename",

20
packages/neon/lib/l10n/localizations.dart

@ -95,12 +95,6 @@ abstract class AppLocalizations {
/// **'Nextcloud Neon'** /// **'Nextcloud Neon'**
String get appName; String get appName;
/// No description provided for @loginAccountAlreadyExists.
///
/// In en, this message translates to:
/// **'The account you are trying to add already exists'**
String get loginAccountAlreadyExists;
/// No description provided for @loginAgain. /// No description provided for @loginAgain.
/// ///
/// In en, this message translates to: /// In en, this message translates to:
@ -125,6 +119,12 @@ abstract class AppLocalizations {
/// **'works with'** /// **'works with'**
String get loginWorksWith; String get loginWorksWith;
/// No description provided for @errorAccountAlreadyExists.
///
/// In en, this message translates to:
/// **'The account you are trying to add already exists'**
String get errorAccountAlreadyExists;
/// No description provided for @errorCredentialsForAccountNoLongerMatch. /// No description provided for @errorCredentialsForAccountNoLongerMatch.
/// ///
/// In en, this message translates to: /// In en, this message translates to:
@ -185,17 +185,17 @@ abstract class AppLocalizations {
/// **'Sorry this Nextcloud instance version is not supported. You need at least version {version} of Nextcloud.'** /// **'Sorry this Nextcloud instance version is not supported. You need at least version {version} of Nextcloud.'**
String errorUnsupportedNextcloudVersion(int version); String errorUnsupportedNextcloudVersion(int version);
/// No description provided for @validatorEmptyField. /// No description provided for @errorEmptyField.
/// ///
/// In en, this message translates to: /// In en, this message translates to:
/// **'This field can not be empty'** /// **'This field can not be empty'**
String get validatorEmptyField; String get errorEmptyField;
/// No description provided for @validatorInvalidURL. /// No description provided for @errorInvalidURL.
/// ///
/// In en, this message translates to: /// In en, this message translates to:
/// **'Invalid URL provided'** /// **'Invalid URL provided'**
String get validatorInvalidURL; String get errorInvalidURL;
/// No description provided for @delete. /// No description provided for @delete.
/// ///

10
packages/neon/lib/l10n/localizations_en.dart

@ -7,9 +7,6 @@ class AppLocalizationsEn extends AppLocalizations {
@override @override
String get appName => 'Nextcloud Neon'; String get appName => 'Nextcloud Neon';
@override
String get loginAccountAlreadyExists => 'The account you are trying to add already exists';
@override @override
String get loginAgain => 'Login again'; String get loginAgain => 'Login again';
@ -22,6 +19,9 @@ class AppLocalizationsEn extends AppLocalizations {
@override @override
String get loginWorksWith => 'works with'; String get loginWorksWith => 'works with';
@override
String get errorAccountAlreadyExists => 'The account you are trying to add already exists';
@override @override
String get errorCredentialsForAccountNoLongerMatch => 'The credentials for this account no longer match'; String get errorCredentialsForAccountNoLongerMatch => 'The credentials for this account no longer match';
@ -62,10 +62,10 @@ class AppLocalizationsEn extends AppLocalizations {
} }
@override @override
String get validatorEmptyField => 'This field can not be empty'; String get errorEmptyField => 'This field can not be empty';
@override @override
String get validatorInvalidURL => 'Invalid URL provided'; String get errorInvalidURL => 'Invalid URL provided';
@override @override
String get delete => 'Delete'; String get delete => 'Delete';

2
packages/neon/lib/src/pages/login/login.dart

@ -55,7 +55,7 @@ class _LoginPageState extends State<LoginPage> {
} else { } else {
for (final a in accountsBloc.accounts.value) { for (final a in accountsBloc.accounts.value) {
if (a.id == account.id) { if (a.id == account.id) {
ExceptionWidget.showSnackbar(context, AppLocalizations.of(context).loginAccountAlreadyExists); ExceptionWidget.showSnackbar(context, AppLocalizations.of(context).errorAccountAlreadyExists);
_loginBloc.setServerURL(result.server!); _loginBloc.setServerURL(result.server!);
return; return;
} }

8
packages/neon/lib/src/utils/validators.dart

@ -6,23 +6,23 @@ String? validateHttpUrl(
final bool httpsOnly = false, final bool httpsOnly = false,
}) { }) {
if (input == null || input == '') { if (input == null || input == '') {
return AppLocalizations.of(context).validatorInvalidURL; return AppLocalizations.of(context).errorInvalidURL;
} }
try { try {
final uri = Uri.parse(input); final uri = Uri.parse(input);
// TODO: Maybe make a better error message for http URLs if only https is allowed // TODO: Maybe make a better error message for http URLs if only https is allowed
if (!(!httpsOnly && (uri.isScheme('http')) || uri.isScheme('https'))) { if (!(!httpsOnly && (uri.isScheme('http')) || uri.isScheme('https'))) {
return AppLocalizations.of(context).validatorInvalidURL; return AppLocalizations.of(context).errorInvalidURL;
} }
} catch (e) { } catch (e) {
return AppLocalizations.of(context).validatorInvalidURL; return AppLocalizations.of(context).errorInvalidURL;
} }
return null; return null;
} }
String? validateNotEmpty(final BuildContext context, final String? input) { String? validateNotEmpty(final BuildContext context, final String? input) {
if (input == null || input == '') { if (input == null || input == '') {
return AppLocalizations.of(context).validatorEmptyField; return AppLocalizations.of(context).errorEmptyField;
} }
return null; return null;

Loading…
Cancel
Save