From 212c50bda664fb28a8b70c29f0c1c028d37335bd Mon Sep 17 00:00:00 2001 From: jld3103 Date: Thu, 20 Apr 2023 12:02:42 +0200 Subject: [PATCH] app,tool,neon: Fix generating localizations --- packages/app/l10n.yaml | 6 ++++++ .../neon/neon/lib/l10n/localizations.dart | 21 ++++++++++++------- .../neon/neon/lib/l10n/localizations_en.dart | 16 ++++++-------- tool/generate-app.sh | 3 +++ 4 files changed, 28 insertions(+), 18 deletions(-) create mode 100644 packages/app/l10n.yaml diff --git a/packages/app/l10n.yaml b/packages/app/l10n.yaml new file mode 100644 index 00000000..eaa12a48 --- /dev/null +++ b/packages/app/l10n.yaml @@ -0,0 +1,6 @@ +arb-dir: ../neon/neon/lib/l10n +template-arb-file: en.arb +output-localization-file: localizations.dart +synthetic-package: false +output-dir: ../neon/neon/lib/l10n +nullable-getter: false diff --git a/packages/neon/neon/lib/l10n/localizations.dart b/packages/neon/neon/lib/l10n/localizations.dart index 687138a2..24f665fa 100644 --- a/packages/neon/neon/lib/l10n/localizations.dart +++ b/packages/neon/neon/lib/l10n/localizations.dart @@ -87,12 +87,14 @@ abstract class AppLocalizations { ]; /// A list of this localizations delegate's supported locales. - static const List supportedLocales = [Locale('en')]; + static const List supportedLocales = [ + Locale('en') + ]; /// No description provided for @appImplementationName. /// /// In en, this message translates to: - /// **'{app, select, core{Server} files{Files} news{News} notes{Notes} notifications{Notifications} other{}}'** + /// **'{app, select, nextcloud{Nextcloud} core{Server} files{Files} news{News} notes{Notes} notifications{Notifications} other{}}'** String appImplementationName(String app); /// No description provided for @loginAgain. @@ -1198,14 +1200,17 @@ class _AppLocalizationsDelegate extends LocalizationsDelegate } AppLocalizations lookupAppLocalizations(Locale locale) { + + // Lookup logic when only language code is specified. switch (locale.languageCode) { - case 'en': - return AppLocalizationsEn(); + case 'en': return AppLocalizationsEn(); } - throw FlutterError('AppLocalizations.delegate failed to load unsupported locale "$locale". This is likely ' - 'an issue with the localizations generation tool. Please file an issue ' - 'on GitHub with a reproducible sample app and the gen-l10n configuration ' - 'that was used.'); + throw FlutterError( + 'AppLocalizations.delegate failed to load unsupported locale "$locale". This is likely ' + 'an issue with the localizations generation tool. Please file an issue ' + 'on GitHub with a reproducible sample app and the gen-l10n configuration ' + 'that was used.' + ); } diff --git a/packages/neon/neon/lib/l10n/localizations_en.dart b/packages/neon/neon/lib/l10n/localizations_en.dart index 7d88dcc1..58506ceb 100644 --- a/packages/neon/neon/lib/l10n/localizations_en.dart +++ b/packages/neon/neon/lib/l10n/localizations_en.dart @@ -11,6 +11,7 @@ class AppLocalizationsEn extends AppLocalizations { String _temp0 = intl.Intl.selectLogic( app, { + 'nextcloud': 'Nextcloud', 'core': 'Server', 'files': 'Files', 'news': 'News', @@ -41,8 +42,7 @@ class AppLocalizationsEn extends AppLocalizations { String get errorCredentialsForAccountNoLongerMatch => 'The credentials for this account no longer match'; @override - String get errorServerHadAProblemProcessingYourRequest => - 'The server had a problem while processing your request. You might want to try again'; + String get errorServerHadAProblemProcessingYourRequest => 'The server had a problem while processing your request. You might want to try again'; @override String get errorSomethingWentWrongTryAgainLater => 'Something went wrong. Please try again later'; @@ -59,12 +59,10 @@ class AppLocalizationsEn extends AppLocalizations { String get errorConnectionTimedOut => 'Connection has timed out'; @override - String get errorNoCompatibleNextcloudAppsFound => - 'No compatible Nextcloud apps could be found.\nWe are working hard to implement more and more apps!'; + String get errorNoCompatibleNextcloudAppsFound => 'No compatible Nextcloud apps could be found.\nWe are working hard to implement more and more apps!'; @override - String get errorServerInMaintenanceMode => - 'The server is in maintenance mode. Please try again later or contact the server admin.'; + String get errorServerInMaintenanceMode => 'The server is in maintenance mode. Please try again later or contact the server admin.'; @override String errorMissingPermission(String name) { @@ -125,8 +123,7 @@ class AppLocalizationsEn extends AppLocalizations { String get nextPushSupported => 'NextPush is supported!'; @override - String get nextPushSupportedText => - 'NextPush is a FOSS way of receiving push notifications using the UnifiedPush protocol via a Nextcloud instance.\nYou can install NextPush from the F-Droid app store.'; + String get nextPushSupportedText => 'NextPush is a FOSS way of receiving push notifications using the UnifiedPush protocol via a Nextcloud instance.\nYou can install NextPush from the F-Droid app store.'; @override String get nextPushSupportedInstall => 'Install NextPush'; @@ -206,8 +203,7 @@ class AppLocalizationsEn extends AppLocalizations { String get globalOptionsPushNotificationsEnabled => 'Enabled'; @override - String get globalOptionsPushNotificationsEnabledDisabledNotice => - 'No UnifiedPush distributor could be found or you denied the permission for showing notifications. Please go to the app settings and allow notifications and go to https://unifiedpush.org/users/distributors and setup any of the listed distributors. Then re-open this app and you should be able to enable notifications'; + String get globalOptionsPushNotificationsEnabledDisabledNotice => 'No UnifiedPush distributor could be found or you denied the permission for showing notifications. Please go to the app settings and allow notifications and go to https://unifiedpush.org/users/distributors and setup any of the listed distributors. Then re-open this app and you should be able to enable notifications'; @override String get globalOptionsPushNotificationsDistributor => 'UnifiedPush Distributor'; diff --git a/tool/generate-app.sh b/tool/generate-app.sh index 3ddb81dd..27f1e3ce 100755 --- a/tool/generate-app.sh +++ b/tool/generate-app.sh @@ -24,4 +24,7 @@ color="#f37736" wait fvm dart run flutter_native_splash:create + fvm flutter gen-l10n ) + +./tool/format.sh