From a80aab94c19128f1a68c4d9b83fc5b4468bc1d56 Mon Sep 17 00:00:00 2001 From: jld3103 Date: Sun, 24 Jul 2022 13:52:36 +0200 Subject: [PATCH] neon: Fix localization error message key names --- packages/neon/lib/l10n/en.arb | 6 +++--- packages/neon/lib/l10n/localizations.dart | 20 ++++++++++---------- packages/neon/lib/l10n/localizations_en.dart | 10 +++++----- packages/neon/lib/src/pages/login/login.dart | 2 +- packages/neon/lib/src/utils/validators.dart | 8 ++++---- 5 files changed, 23 insertions(+), 23 deletions(-) diff --git a/packages/neon/lib/l10n/en.arb b/packages/neon/lib/l10n/en.arb index 4688d2a5..03fa3c0a 100644 --- a/packages/neon/lib/l10n/en.arb +++ b/packages/neon/lib/l10n/en.arb @@ -1,11 +1,11 @@ { "@@locale": "en", "appName": "Nextcloud Neon", - "loginAccountAlreadyExists": "The account you are trying to add already exists", "loginAgain": "Login again", "loginOpenAgain": "Open again", "loginSwitchToBrowserWindow": "Please switch to the browser window that just opened and proceed there", "loginWorksWith": "works with", + "errorAccountAlreadyExists": "The account you are trying to add already exists", "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", "errorSomethingWentWrongTryAgainLater": "Something went wrong. Please try again later", @@ -37,8 +37,8 @@ } } }, - "validatorEmptyField": "This field can not be empty", - "validatorInvalidURL": "Invalid URL provided", + "errorEmptyField": "This field can not be empty", + "errorInvalidURL": "Invalid URL provided", "delete": "Delete", "remove": "Remove", "rename": "Rename", diff --git a/packages/neon/lib/l10n/localizations.dart b/packages/neon/lib/l10n/localizations.dart index d517c72b..e286aae6 100644 --- a/packages/neon/lib/l10n/localizations.dart +++ b/packages/neon/lib/l10n/localizations.dart @@ -95,12 +95,6 @@ abstract class AppLocalizations { /// **'Nextcloud Neon'** 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. /// /// In en, this message translates to: @@ -125,6 +119,12 @@ abstract class AppLocalizations { /// **'works with'** 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. /// /// 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.'** String errorUnsupportedNextcloudVersion(int version); - /// No description provided for @validatorEmptyField. + /// No description provided for @errorEmptyField. /// /// In en, this message translates to: /// **'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: /// **'Invalid URL provided'** - String get validatorInvalidURL; + String get errorInvalidURL; /// No description provided for @delete. /// diff --git a/packages/neon/lib/l10n/localizations_en.dart b/packages/neon/lib/l10n/localizations_en.dart index b1885ce4..d225ea64 100644 --- a/packages/neon/lib/l10n/localizations_en.dart +++ b/packages/neon/lib/l10n/localizations_en.dart @@ -7,9 +7,6 @@ class AppLocalizationsEn extends AppLocalizations { @override String get appName => 'Nextcloud Neon'; - @override - String get loginAccountAlreadyExists => 'The account you are trying to add already exists'; - @override String get loginAgain => 'Login again'; @@ -22,6 +19,9 @@ class AppLocalizationsEn extends AppLocalizations { @override String get loginWorksWith => 'works with'; + @override + String get errorAccountAlreadyExists => 'The account you are trying to add already exists'; + @override String get errorCredentialsForAccountNoLongerMatch => 'The credentials for this account no longer match'; @@ -62,10 +62,10 @@ class AppLocalizationsEn extends AppLocalizations { } @override - String get validatorEmptyField => 'This field can not be empty'; + String get errorEmptyField => 'This field can not be empty'; @override - String get validatorInvalidURL => 'Invalid URL provided'; + String get errorInvalidURL => 'Invalid URL provided'; @override String get delete => 'Delete'; diff --git a/packages/neon/lib/src/pages/login/login.dart b/packages/neon/lib/src/pages/login/login.dart index 3601592e..f7a182dd 100644 --- a/packages/neon/lib/src/pages/login/login.dart +++ b/packages/neon/lib/src/pages/login/login.dart @@ -55,7 +55,7 @@ class _LoginPageState extends State { } else { for (final a in accountsBloc.accounts.value) { if (a.id == account.id) { - ExceptionWidget.showSnackbar(context, AppLocalizations.of(context).loginAccountAlreadyExists); + ExceptionWidget.showSnackbar(context, AppLocalizations.of(context).errorAccountAlreadyExists); _loginBloc.setServerURL(result.server!); return; } diff --git a/packages/neon/lib/src/utils/validators.dart b/packages/neon/lib/src/utils/validators.dart index c33d71db..9d615c8b 100644 --- a/packages/neon/lib/src/utils/validators.dart +++ b/packages/neon/lib/src/utils/validators.dart @@ -6,23 +6,23 @@ String? validateHttpUrl( final bool httpsOnly = false, }) { if (input == null || input == '') { - return AppLocalizations.of(context).validatorInvalidURL; + return AppLocalizations.of(context).errorInvalidURL; } try { final uri = Uri.parse(input); // TODO: Maybe make a better error message for http URLs if only https is allowed if (!(!httpsOnly && (uri.isScheme('http')) || uri.isScheme('https'))) { - return AppLocalizations.of(context).validatorInvalidURL; + return AppLocalizations.of(context).errorInvalidURL; } } catch (e) { - return AppLocalizations.of(context).validatorInvalidURL; + return AppLocalizations.of(context).errorInvalidURL; } return null; } String? validateNotEmpty(final BuildContext context, final String? input) { if (input == null || input == '') { - return AppLocalizations.of(context).validatorEmptyField; + return AppLocalizations.of(context).errorEmptyField; } return null;