From 8b87b93a4044de09b9d558c4d66434e87d700ba0 Mon Sep 17 00:00:00 2001 From: kjxbyz Date: Tue, 22 Oct 2024 00:03:48 +0800 Subject: [PATCH] Update deps --- lib/gen/assets.gen.dart | 17 +- lib/i18n/strings.g.dart | 426 ++++++++----------------------------- lib/i18n/strings_en.g.dart | 173 +++++++++++++++ lib/i18n/strings_zh.g.dart | 169 +++++++++++++++ pubspec.lock | 20 +- pubspec.yaml | 8 +- 6 files changed, 455 insertions(+), 358 deletions(-) create mode 100644 lib/i18n/strings_en.g.dart create mode 100644 lib/i18n/strings_zh.g.dart diff --git a/lib/gen/assets.gen.dart b/lib/gen/assets.gen.dart index 5687c08..9926d14 100644 --- a/lib/gen/assets.gen.dart +++ b/lib/gen/assets.gen.dart @@ -12,6 +12,18 @@ import 'package:flutter/widgets.dart'; class $LogoGen { const $LogoGen(); + /// File path: logo/logo-128.png + AssetGenImage get logo128 => const AssetGenImage('logo/logo-128.png'); + + /// File path: logo/logo-256.png + AssetGenImage get logo256 => const AssetGenImage('logo/logo-256.png'); + + /// File path: logo/logo-32.png + AssetGenImage get logo32 => const AssetGenImage('logo/logo-32.png'); + + /// File path: logo/logo-512.png + AssetGenImage get logo512 => const AssetGenImage('logo/logo-512.png'); + /// File path: logo/logo.icns String get logoIcns => 'logo/logo.icns'; @@ -19,7 +31,8 @@ class $LogoGen { AssetGenImage get logoPng => const AssetGenImage('logo/logo.png'); /// List of all assets - List get values => [logoIcns, logoPng]; + List get values => + [logo128, logo256, logo32, logo512, logoIcns, logoPng]; } class Assets { @@ -58,7 +71,7 @@ class AssetGenImage { ImageRepeat repeat = ImageRepeat.noRepeat, Rect? centerSlice, bool matchTextDirection = false, - bool gaplessPlayback = false, + bool gaplessPlayback = true, bool isAntiAlias = false, String? package, FilterQuality filterQuality = FilterQuality.low, diff --git a/lib/i18n/strings.g.dart b/lib/i18n/strings.g.dart index 9799d18..9c0813d 100644 --- a/lib/i18n/strings.g.dart +++ b/lib/i18n/strings.g.dart @@ -1,42 +1,92 @@ /// Generated file. Do not edit. /// -/// Original: lib/i18n +/// Source: lib/i18n /// To regenerate, run: `dart run slang` /// /// Locales: 2 /// Strings: 66 (33 per locale) /// -/// Built on 2024-06-27 at 05:31 UTC +/// Built on 2024-10-21 at 16:03 UTC // coverage:ignore-file -// ignore_for_file: type=lint +// ignore_for_file: type=lint, unused_import import 'package:flutter/widgets.dart'; -import 'package:slang/builder/model/node.dart'; +import 'package:intl/intl.dart'; +import 'package:slang/generated.dart'; import 'package:slang_flutter/slang_flutter.dart'; export 'package:slang_flutter/slang_flutter.dart'; -const AppLocale _baseLocale = AppLocale.en; +import 'strings_zh.g.dart' deferred as l_zh; +part 'strings_en.g.dart'; -/// Supported locales, see extension methods below. +/// Supported locales. /// /// Usage: /// - LocaleSettings.setLocale(AppLocale.en) // set locale /// - Locale locale = AppLocale.en.flutterLocale // get flutter locale from enum /// - if (LocaleSettings.currentLocale == AppLocale.en) // locale check enum AppLocale with BaseAppLocale { - en(languageCode: 'en', build: Translations.build), - zh(languageCode: 'zh', build: _StringsZh.build); + en(languageCode: 'en'), + zh(languageCode: 'zh'); - const AppLocale({required this.languageCode, this.scriptCode, this.countryCode, required this.build}); // ignore: unused_element + const AppLocale({ + required this.languageCode, + this.scriptCode, // ignore: unused_element + this.countryCode, // ignore: unused_element + }); @override final String languageCode; @override final String? scriptCode; @override final String? countryCode; - @override final TranslationBuilder build; + + @override + Future build({ + Map? overrides, + PluralResolver? cardinalResolver, + PluralResolver? ordinalResolver, + }) async { + switch (this) { + case AppLocale.en: + return TranslationsEn( + overrides: overrides, + cardinalResolver: cardinalResolver, + ordinalResolver: ordinalResolver, + ); + case AppLocale.zh: + await l_zh.loadLibrary(); + return l_zh.TranslationsZh( + overrides: overrides, + cardinalResolver: cardinalResolver, + ordinalResolver: ordinalResolver, + ); + } + } + + @override + Translations buildSync({ + Map? overrides, + PluralResolver? cardinalResolver, + PluralResolver? ordinalResolver, + }) { + switch (this) { + case AppLocale.en: + return TranslationsEn( + overrides: overrides, + cardinalResolver: cardinalResolver, + ordinalResolver: ordinalResolver, + ); + case AppLocale.zh: + return l_zh.TranslationsZh( + overrides: overrides, + cardinalResolver: cardinalResolver, + ordinalResolver: ordinalResolver, + ); + } + } /// Gets current instance managed by [LocaleSettings]. - Translations get translations => LocaleSettings.instance.translationMap[this]!; + Translations get translations => LocaleSettings.instance.getTranslations(this); } /// Method A: Simple @@ -82,19 +132,31 @@ extension BuildContextTranslationsExtension on BuildContext { /// Manages all translation instances and the current locale class LocaleSettings extends BaseFlutterLocaleSettings { - LocaleSettings._() : super(utils: AppLocaleUtils.instance); + LocaleSettings._() : super( + utils: AppLocaleUtils.instance, + lazy: true, + ); static final instance = LocaleSettings._(); // static aliases (checkout base methods for documentation) static AppLocale get currentLocale => instance.currentLocale; static Stream getLocaleStream() => instance.getLocaleStream(); - static AppLocale setLocale(AppLocale locale, {bool? listenToDeviceLocale = false}) => instance.setLocale(locale, listenToDeviceLocale: listenToDeviceLocale); - static AppLocale setLocaleRaw(String rawLocale, {bool? listenToDeviceLocale = false}) => instance.setLocaleRaw(rawLocale, listenToDeviceLocale: listenToDeviceLocale); - static AppLocale useDeviceLocale() => instance.useDeviceLocale(); - @Deprecated('Use [AppLocaleUtils.supportedLocales]') static List get supportedLocales => instance.supportedLocales; - @Deprecated('Use [AppLocaleUtils.supportedLocalesRaw]') static List get supportedLocalesRaw => instance.supportedLocalesRaw; - static void setPluralResolver({String? language, AppLocale? locale, PluralResolver? cardinalResolver, PluralResolver? ordinalResolver}) => instance.setPluralResolver( + static Future setLocale(AppLocale locale, {bool? listenToDeviceLocale = false}) => instance.setLocale(locale, listenToDeviceLocale: listenToDeviceLocale); + static Future setLocaleRaw(String rawLocale, {bool? listenToDeviceLocale = false}) => instance.setLocaleRaw(rawLocale, listenToDeviceLocale: listenToDeviceLocale); + static Future useDeviceLocale() => instance.useDeviceLocale(); + static Future setPluralResolver({String? language, AppLocale? locale, PluralResolver? cardinalResolver, PluralResolver? ordinalResolver}) => instance.setPluralResolver( + language: language, + locale: locale, + cardinalResolver: cardinalResolver, + ordinalResolver: ordinalResolver, + ); + + // synchronous versions + static AppLocale setLocaleSync(AppLocale locale, {bool? listenToDeviceLocale = false}) => instance.setLocaleSync(locale, listenToDeviceLocale: listenToDeviceLocale); + static AppLocale setLocaleRawSync(String rawLocale, {bool? listenToDeviceLocale = false}) => instance.setLocaleRawSync(rawLocale, listenToDeviceLocale: listenToDeviceLocale); + static AppLocale useDeviceLocaleSync() => instance.useDeviceLocaleSync(); + static void setPluralResolverSync({String? language, AppLocale? locale, PluralResolver? cardinalResolver, PluralResolver? ordinalResolver}) => instance.setPluralResolverSync( language: language, locale: locale, cardinalResolver: cardinalResolver, @@ -104,7 +166,10 @@ class LocaleSettings extends BaseFlutterLocaleSettings /// Provides utility functions without any side effects. class AppLocaleUtils extends BaseAppLocaleUtils { - AppLocaleUtils._() : super(baseLocale: _baseLocale, locales: AppLocale.values); + AppLocaleUtils._() : super( + baseLocale: AppLocale.en, + locales: AppLocale.values, + ); static final instance = AppLocaleUtils._(); @@ -115,326 +180,3 @@ class AppLocaleUtils extends BaseAppLocaleUtils { static List get supportedLocales => instance.supportedLocales; static List get supportedLocalesRaw => instance.supportedLocalesRaw; } - -// translations - -// Path: -class Translations implements BaseTranslations { - /// Returns the current translations of the given [context]. - /// - /// Usage: - /// final t = Translations.of(context); - static Translations of(BuildContext context) => InheritedLocaleData.of(context).translations; - - /// You can call this constructor and build your own translation instance of this locale. - /// Constructing via the enum [AppLocale.build] is preferred. - Translations.build({Map? overrides, PluralResolver? cardinalResolver, PluralResolver? ordinalResolver}) - : assert(overrides == null, 'Set "translation_overrides: true" in order to enable this feature.'), - $meta = TranslationMetadata( - locale: AppLocale.en, - overrides: overrides ?? {}, - cardinalResolver: cardinalResolver, - ordinalResolver: ordinalResolver, - ) { - $meta.setFlatMapFunction(_flatMapFunction); - } - - /// Metadata for the translations of . - @override final TranslationMetadata $meta; - - /// Access flat map - dynamic operator[](String key) => $meta.getTranslation(key); - - late final Translations _root = this; // ignore: unused_field - - // Translations - late final _StringsHomePageEn homePage = _StringsHomePageEn._(_root); - late final _StringsButtonsEn buttons = _StringsButtonsEn._(_root); - late final _StringsDialogsEn dialogs = _StringsDialogsEn._(_root); - Map get locales => { - 'en': 'English', - 'zh': '中文', - }; -} - -// Path: homePage -class _StringsHomePageEn { - _StringsHomePageEn._(this._root); - - final Translations _root; // ignore: unused_field - - // Translations - String get title => 'FaForever'; - String get imageDescription => 'Please upload pictures.'; - String get description => 'This app will not upload any pictures to the server, all operations are completed locally'; - String get textLabel => 'Text'; - String get textLabelDescription => 'Text will be added to the image as a watermark'; - String get textValidator => 'Please enter text.'; - String get textInput => 'This certificate is only used for handling xx business, and is invalid for other purposes.'; - String get colorLabel => 'Color'; - String get colorValidator => 'Please select a color.'; - String get transparencyLabel => 'Transparency'; - String get preview => 'Preview'; - String get save => 'Save'; -} - -// Path: buttons -class _StringsButtonsEn { - _StringsButtonsEn._(this._root); - - final Translations _root; // ignore: unused_field - - // Translations - String get agree => 'Agree'; - String get cancel => 'Cancel'; -} - -// Path: dialogs -class _StringsDialogsEn { - _StringsDialogsEn._(this._root); - - final Translations _root; // ignore: unused_field - - // Translations - late final _StringsDialogsExitConfirmEn exitConfirm = _StringsDialogsExitConfirmEn._(_root); - late final _StringsDialogsLicenseDialogEn licenseDialog = _StringsDialogsLicenseDialogEn._(_root); -} - -// Path: dialogs.exitConfirm -class _StringsDialogsExitConfirmEn { - _StringsDialogsExitConfirmEn._(this._root); - - final Translations _root; // ignore: unused_field - - // Translations - String get exit => 'Exit'; - String get cancel => 'Cancel'; - String get title => 'Close confirmation'; - String get description => 'Are you sure you want to close this window?'; -} - -// Path: dialogs.licenseDialog -class _StringsDialogsLicenseDialogEn { - _StringsDialogsLicenseDialogEn._(this._root); - - final Translations _root; // ignore: unused_field - - // Translations - String get licenseDialogTitle => 'Terms and Conditions'; - String get licenseDialogContentContent => 'Protecting user\'s privacy and personal information is a fundamental principle of FaForever.'; - String get licenseDialogContentTip => 'Below is a list of permissions required by this APP:'; - String get licenseDialogContentPrefix => 'Before you use this APP\'s services, please carefully read and agree to the '; - String get licenseDialogContentUserAgreement => 'User Agreement'; - String get licenseDialogContentAnd => ' and '; - String get licenseDialogContentPrivacyAgreement => 'Privacy Agreement'; - String get licenseDialogContentSuffix => ', start using our services after you agree and accept all terms.'; - List get iosPermissions => [ - 'For you to upload pictures, FaForever needs access to your Photos. (NSPhotoLibraryUsageDescription)', - ]; - List get androidPermissions => [ - 'In order to use the Firebase Analytics Service, FaForever needs access to your Internet. (android.permission.INTERNET)', - 'For you to upload pictures, FaForever needs access to your Storage. (android.permission.READ_EXTERNAL_STORAGE)', - 'For you to save pictures, FaForever needs access to your Storage. (android.permission.WRITE_EXTERNAL_STORAGE)', - 'For you to upload pictures, FaForever needs access to your Photos. (android.permission.READ_MEDIA_IMAGES)', - ]; -} - -// Path: -class _StringsZh implements Translations { - /// You can call this constructor and build your own translation instance of this locale. - /// Constructing via the enum [AppLocale.build] is preferred. - _StringsZh.build({Map? overrides, PluralResolver? cardinalResolver, PluralResolver? ordinalResolver}) - : assert(overrides == null, 'Set "translation_overrides: true" in order to enable this feature.'), - $meta = TranslationMetadata( - locale: AppLocale.zh, - overrides: overrides ?? {}, - cardinalResolver: cardinalResolver, - ordinalResolver: ordinalResolver, - ) { - $meta.setFlatMapFunction(_flatMapFunction); - } - - /// Metadata for the translations of . - @override final TranslationMetadata $meta; - - /// Access flat map - @override dynamic operator[](String key) => $meta.getTranslation(key); - - @override late final _StringsZh _root = this; // ignore: unused_field - - // Translations - @override late final _StringsHomePageZh homePage = _StringsHomePageZh._(_root); - @override late final _StringsButtonsZh buttons = _StringsButtonsZh._(_root); - @override late final _StringsDialogsZh dialogs = _StringsDialogsZh._(_root); - @override Map get locales => { - 'en': 'English', - 'zh': '中文', - }; -} - -// Path: homePage -class _StringsHomePageZh implements _StringsHomePageEn { - _StringsHomePageZh._(this._root); - - @override final _StringsZh _root; // ignore: unused_field - - // Translations - @override String get title => 'FaForever'; - @override String get imageDescription => '请上传图片'; - @override String get description => '本app不会上传任何图片到服务器, 所有操作均在本地完成'; - @override String get textLabel => '文本'; - @override String get textLabelDescription => '文本会以水印添加到图片上'; - @override String get textValidator => '请输入文本.'; - @override String get textInput => '此证件仅用于办理xx业务, 其他用途无效'; - @override String get colorLabel => '颜色'; - @override String get colorValidator => '请选择颜色.'; - @override String get transparencyLabel => '透明度'; - @override String get preview => '预览'; - @override String get save => '保存'; -} - -// Path: buttons -class _StringsButtonsZh implements _StringsButtonsEn { - _StringsButtonsZh._(this._root); - - @override final _StringsZh _root; // ignore: unused_field - - // Translations - @override String get agree => '同意'; - @override String get cancel => '再想想'; -} - -// Path: dialogs -class _StringsDialogsZh implements _StringsDialogsEn { - _StringsDialogsZh._(this._root); - - @override final _StringsZh _root; // ignore: unused_field - - // Translations - @override late final _StringsDialogsExitConfirmZh exitConfirm = _StringsDialogsExitConfirmZh._(_root); - @override late final _StringsDialogsLicenseDialogZh licenseDialog = _StringsDialogsLicenseDialogZh._(_root); -} - -// Path: dialogs.exitConfirm -class _StringsDialogsExitConfirmZh implements _StringsDialogsExitConfirmEn { - _StringsDialogsExitConfirmZh._(this._root); - - @override final _StringsZh _root; // ignore: unused_field - - // Translations - @override String get exit => '退出'; - @override String get cancel => '取消'; - @override String get title => '关闭确认'; - @override String get description => '您确定要关闭此窗口吗?'; -} - -// Path: dialogs.licenseDialog -class _StringsDialogsLicenseDialogZh implements _StringsDialogsLicenseDialogEn { - _StringsDialogsLicenseDialogZh._(this._root); - - @override final _StringsZh _root; // ignore: unused_field - - // Translations - @override String get licenseDialogTitle => '隐私条款'; - @override String get licenseDialogContentContent => 'FaForever 非常重视你的隐私保护和个人信息保护.'; - @override String get licenseDialogContentTip => '以下是该APP所需的权限列表:'; - @override String get licenseDialogContentPrefix => '在使用APP服务前,请认真阅读 '; - @override String get licenseDialogContentUserAgreement => '《隐私政策》'; - @override String get licenseDialogContentAnd => '和'; - @override String get licenseDialogContentPrivacyAgreement => '《用户服务协议》'; - @override String get licenseDialogContentSuffix => ', 你同意并接受全部条款后开始使用我们的服务.'; - @override List get iosPermissions => [ - '为了让您上传图片, FaForever 需要访问您的照片. (NSPhotoLibraryUsageDescription)', - ]; - @override List get androidPermissions => [ - '为了使用 Firebase Analytics 服务, FaForever 需要访问您的互联网. (android.permission.INTERNET)', - '为了让您上传图片, FaForever 需要访问您的存储. (android.permission.READ_EXTERNAL_STORAGE)', - '为了让您保存图片, FaForever 需要访问您的存储. (android.permission.WRITE_EXTERNAL_STORAGE)', - '为了让您上传图片, FaForever 需要访问您的照片. (android.permission.READ_MEDIA_IMAGES)', - ]; -} - -/// Flat map(s) containing all translations. -/// Only for edge cases! For simple maps, use the map function of this library. - -extension on Translations { - dynamic _flatMapFunction(String path) { - switch (path) { - case 'homePage.title': return 'FaForever'; - case 'homePage.imageDescription': return 'Please upload pictures.'; - case 'homePage.description': return 'This app will not upload any pictures to the server, all operations are completed locally'; - case 'homePage.textLabel': return 'Text'; - case 'homePage.textLabelDescription': return 'Text will be added to the image as a watermark'; - case 'homePage.textValidator': return 'Please enter text.'; - case 'homePage.textInput': return 'This certificate is only used for handling xx business, and is invalid for other purposes.'; - case 'homePage.colorLabel': return 'Color'; - case 'homePage.colorValidator': return 'Please select a color.'; - case 'homePage.transparencyLabel': return 'Transparency'; - case 'homePage.preview': return 'Preview'; - case 'homePage.save': return 'Save'; - case 'buttons.agree': return 'Agree'; - case 'buttons.cancel': return 'Cancel'; - case 'dialogs.exitConfirm.exit': return 'Exit'; - case 'dialogs.exitConfirm.cancel': return 'Cancel'; - case 'dialogs.exitConfirm.title': return 'Close confirmation'; - case 'dialogs.exitConfirm.description': return 'Are you sure you want to close this window?'; - case 'dialogs.licenseDialog.licenseDialogTitle': return 'Terms and Conditions'; - case 'dialogs.licenseDialog.licenseDialogContentContent': return 'Protecting user\'s privacy and personal information is a fundamental principle of FaForever.'; - case 'dialogs.licenseDialog.licenseDialogContentTip': return 'Below is a list of permissions required by this APP:'; - case 'dialogs.licenseDialog.licenseDialogContentPrefix': return 'Before you use this APP\'s services, please carefully read and agree to the '; - case 'dialogs.licenseDialog.licenseDialogContentUserAgreement': return 'User Agreement'; - case 'dialogs.licenseDialog.licenseDialogContentAnd': return ' and '; - case 'dialogs.licenseDialog.licenseDialogContentPrivacyAgreement': return 'Privacy Agreement'; - case 'dialogs.licenseDialog.licenseDialogContentSuffix': return ', start using our services after you agree and accept all terms.'; - case 'dialogs.licenseDialog.iosPermissions.0': return 'For you to upload pictures, FaForever needs access to your Photos. (NSPhotoLibraryUsageDescription)'; - case 'dialogs.licenseDialog.androidPermissions.0': return 'In order to use the Firebase Analytics Service, FaForever needs access to your Internet. (android.permission.INTERNET)'; - case 'dialogs.licenseDialog.androidPermissions.1': return 'For you to upload pictures, FaForever needs access to your Storage. (android.permission.READ_EXTERNAL_STORAGE)'; - case 'dialogs.licenseDialog.androidPermissions.2': return 'For you to save pictures, FaForever needs access to your Storage. (android.permission.WRITE_EXTERNAL_STORAGE)'; - case 'dialogs.licenseDialog.androidPermissions.3': return 'For you to upload pictures, FaForever needs access to your Photos. (android.permission.READ_MEDIA_IMAGES)'; - case 'locales.en': return 'English'; - case 'locales.zh': return '中文'; - default: return null; - } - } -} - -extension on _StringsZh { - dynamic _flatMapFunction(String path) { - switch (path) { - case 'homePage.title': return 'FaForever'; - case 'homePage.imageDescription': return '请上传图片'; - case 'homePage.description': return '本app不会上传任何图片到服务器, 所有操作均在本地完成'; - case 'homePage.textLabel': return '文本'; - case 'homePage.textLabelDescription': return '文本会以水印添加到图片上'; - case 'homePage.textValidator': return '请输入文本.'; - case 'homePage.textInput': return '此证件仅用于办理xx业务, 其他用途无效'; - case 'homePage.colorLabel': return '颜色'; - case 'homePage.colorValidator': return '请选择颜色.'; - case 'homePage.transparencyLabel': return '透明度'; - case 'homePage.preview': return '预览'; - case 'homePage.save': return '保存'; - case 'buttons.agree': return '同意'; - case 'buttons.cancel': return '再想想'; - case 'dialogs.exitConfirm.exit': return '退出'; - case 'dialogs.exitConfirm.cancel': return '取消'; - case 'dialogs.exitConfirm.title': return '关闭确认'; - case 'dialogs.exitConfirm.description': return '您确定要关闭此窗口吗?'; - case 'dialogs.licenseDialog.licenseDialogTitle': return '隐私条款'; - case 'dialogs.licenseDialog.licenseDialogContentContent': return 'FaForever 非常重视你的隐私保护和个人信息保护.'; - case 'dialogs.licenseDialog.licenseDialogContentTip': return '以下是该APP所需的权限列表:'; - case 'dialogs.licenseDialog.licenseDialogContentPrefix': return '在使用APP服务前,请认真阅读 '; - case 'dialogs.licenseDialog.licenseDialogContentUserAgreement': return '《隐私政策》'; - case 'dialogs.licenseDialog.licenseDialogContentAnd': return '和'; - case 'dialogs.licenseDialog.licenseDialogContentPrivacyAgreement': return '《用户服务协议》'; - case 'dialogs.licenseDialog.licenseDialogContentSuffix': return ', 你同意并接受全部条款后开始使用我们的服务.'; - case 'dialogs.licenseDialog.iosPermissions.0': return '为了让您上传图片, FaForever 需要访问您的照片. (NSPhotoLibraryUsageDescription)'; - case 'dialogs.licenseDialog.androidPermissions.0': return '为了使用 Firebase Analytics 服务, FaForever 需要访问您的互联网. (android.permission.INTERNET)'; - case 'dialogs.licenseDialog.androidPermissions.1': return '为了让您上传图片, FaForever 需要访问您的存储. (android.permission.READ_EXTERNAL_STORAGE)'; - case 'dialogs.licenseDialog.androidPermissions.2': return '为了让您保存图片, FaForever 需要访问您的存储. (android.permission.WRITE_EXTERNAL_STORAGE)'; - case 'dialogs.licenseDialog.androidPermissions.3': return '为了让您上传图片, FaForever 需要访问您的照片. (android.permission.READ_MEDIA_IMAGES)'; - case 'locales.en': return 'English'; - case 'locales.zh': return '中文'; - default: return null; - } - } -} diff --git a/lib/i18n/strings_en.g.dart b/lib/i18n/strings_en.g.dart new file mode 100644 index 0000000..b26d07a --- /dev/null +++ b/lib/i18n/strings_en.g.dart @@ -0,0 +1,173 @@ +/// +/// Generated file. Do not edit. +/// +// coverage:ignore-file +// ignore_for_file: type=lint, unused_import + +part of 'strings.g.dart'; + +// Path: +typedef TranslationsEn = Translations; // ignore: unused_element +class Translations implements BaseTranslations { + /// Returns the current translations of the given [context]. + /// + /// Usage: + /// final t = Translations.of(context); + static Translations of(BuildContext context) => InheritedLocaleData.of(context).translations; + + /// You can call this constructor and build your own translation instance of this locale. + /// Constructing via the enum [AppLocale.build] is preferred. + Translations({Map? overrides, PluralResolver? cardinalResolver, PluralResolver? ordinalResolver}) + : assert(overrides == null, 'Set "translation_overrides: true" in order to enable this feature.'), + $meta = TranslationMetadata( + locale: AppLocale.en, + overrides: overrides ?? {}, + cardinalResolver: cardinalResolver, + ordinalResolver: ordinalResolver, + ) { + $meta.setFlatMapFunction(_flatMapFunction); + } + + /// Metadata for the translations of . + @override final TranslationMetadata $meta; + + /// Access flat map + dynamic operator[](String key) => $meta.getTranslation(key); + + late final Translations _root = this; // ignore: unused_field + + // Translations + late final TranslationsHomePageEn homePage = TranslationsHomePageEn._(_root); + late final TranslationsButtonsEn buttons = TranslationsButtonsEn._(_root); + late final TranslationsDialogsEn dialogs = TranslationsDialogsEn._(_root); + Map get locales => { + 'en': 'English', + 'zh': '中文', + }; +} + +// Path: homePage +class TranslationsHomePageEn { + TranslationsHomePageEn._(this._root); + + final Translations _root; // ignore: unused_field + + // Translations + String get title => 'FaForever'; + String get imageDescription => 'Please upload pictures.'; + String get description => 'This app will not upload any pictures to the server, all operations are completed locally'; + String get textLabel => 'Text'; + String get textLabelDescription => 'Text will be added to the image as a watermark'; + String get textValidator => 'Please enter text.'; + String get textInput => 'This certificate is only used for handling xx business, and is invalid for other purposes.'; + String get colorLabel => 'Color'; + String get colorValidator => 'Please select a color.'; + String get transparencyLabel => 'Transparency'; + String get preview => 'Preview'; + String get save => 'Save'; +} + +// Path: buttons +class TranslationsButtonsEn { + TranslationsButtonsEn._(this._root); + + final Translations _root; // ignore: unused_field + + // Translations + String get agree => 'Agree'; + String get cancel => 'Cancel'; +} + +// Path: dialogs +class TranslationsDialogsEn { + TranslationsDialogsEn._(this._root); + + final Translations _root; // ignore: unused_field + + // Translations + late final TranslationsDialogsExitConfirmEn exitConfirm = TranslationsDialogsExitConfirmEn._(_root); + late final TranslationsDialogsLicenseDialogEn licenseDialog = TranslationsDialogsLicenseDialogEn._(_root); +} + +// Path: dialogs.exitConfirm +class TranslationsDialogsExitConfirmEn { + TranslationsDialogsExitConfirmEn._(this._root); + + final Translations _root; // ignore: unused_field + + // Translations + String get exit => 'Exit'; + String get cancel => 'Cancel'; + String get title => 'Close confirmation'; + String get description => 'Are you sure you want to close this window?'; +} + +// Path: dialogs.licenseDialog +class TranslationsDialogsLicenseDialogEn { + TranslationsDialogsLicenseDialogEn._(this._root); + + final Translations _root; // ignore: unused_field + + // Translations + String get licenseDialogTitle => 'Terms and Conditions'; + String get licenseDialogContentContent => 'Protecting user\'s privacy and personal information is a fundamental principle of FaForever.'; + String get licenseDialogContentTip => 'Below is a list of permissions required by this APP:'; + String get licenseDialogContentPrefix => 'Before you use this APP\'s services, please carefully read and agree to the '; + String get licenseDialogContentUserAgreement => 'User Agreement'; + String get licenseDialogContentAnd => ' and '; + String get licenseDialogContentPrivacyAgreement => 'Privacy Agreement'; + String get licenseDialogContentSuffix => ', start using our services after you agree and accept all terms.'; + List get iosPermissions => [ + 'For you to upload pictures, FaForever needs access to your Photos. (NSPhotoLibraryUsageDescription)', + ]; + List get androidPermissions => [ + 'In order to use the Firebase Analytics Service, FaForever needs access to your Internet. (android.permission.INTERNET)', + 'For you to upload pictures, FaForever needs access to your Storage. (android.permission.READ_EXTERNAL_STORAGE)', + 'For you to save pictures, FaForever needs access to your Storage. (android.permission.WRITE_EXTERNAL_STORAGE)', + 'For you to upload pictures, FaForever needs access to your Photos. (android.permission.READ_MEDIA_IMAGES)', + ]; +} + +/// Flat map(s) containing all translations. +/// Only for edge cases! For simple maps, use the map function of this library. +extension on Translations { + dynamic _flatMapFunction(String path) { + switch (path) { + case 'homePage.title': return 'FaForever'; + case 'homePage.imageDescription': return 'Please upload pictures.'; + case 'homePage.description': return 'This app will not upload any pictures to the server, all operations are completed locally'; + case 'homePage.textLabel': return 'Text'; + case 'homePage.textLabelDescription': return 'Text will be added to the image as a watermark'; + case 'homePage.textValidator': return 'Please enter text.'; + case 'homePage.textInput': return 'This certificate is only used for handling xx business, and is invalid for other purposes.'; + case 'homePage.colorLabel': return 'Color'; + case 'homePage.colorValidator': return 'Please select a color.'; + case 'homePage.transparencyLabel': return 'Transparency'; + case 'homePage.preview': return 'Preview'; + case 'homePage.save': return 'Save'; + case 'buttons.agree': return 'Agree'; + case 'buttons.cancel': return 'Cancel'; + case 'dialogs.exitConfirm.exit': return 'Exit'; + case 'dialogs.exitConfirm.cancel': return 'Cancel'; + case 'dialogs.exitConfirm.title': return 'Close confirmation'; + case 'dialogs.exitConfirm.description': return 'Are you sure you want to close this window?'; + case 'dialogs.licenseDialog.licenseDialogTitle': return 'Terms and Conditions'; + case 'dialogs.licenseDialog.licenseDialogContentContent': return 'Protecting user\'s privacy and personal information is a fundamental principle of FaForever.'; + case 'dialogs.licenseDialog.licenseDialogContentTip': return 'Below is a list of permissions required by this APP:'; + case 'dialogs.licenseDialog.licenseDialogContentPrefix': return 'Before you use this APP\'s services, please carefully read and agree to the '; + case 'dialogs.licenseDialog.licenseDialogContentUserAgreement': return 'User Agreement'; + case 'dialogs.licenseDialog.licenseDialogContentAnd': return ' and '; + case 'dialogs.licenseDialog.licenseDialogContentPrivacyAgreement': return 'Privacy Agreement'; + case 'dialogs.licenseDialog.licenseDialogContentSuffix': return ', start using our services after you agree and accept all terms.'; + case 'dialogs.licenseDialog.iosPermissions.0': return 'For you to upload pictures, FaForever needs access to your Photos. (NSPhotoLibraryUsageDescription)'; + case 'dialogs.licenseDialog.androidPermissions.0': return 'In order to use the Firebase Analytics Service, FaForever needs access to your Internet. (android.permission.INTERNET)'; + case 'dialogs.licenseDialog.androidPermissions.1': return 'For you to upload pictures, FaForever needs access to your Storage. (android.permission.READ_EXTERNAL_STORAGE)'; + case 'dialogs.licenseDialog.androidPermissions.2': return 'For you to save pictures, FaForever needs access to your Storage. (android.permission.WRITE_EXTERNAL_STORAGE)'; + case 'dialogs.licenseDialog.androidPermissions.3': return 'For you to upload pictures, FaForever needs access to your Photos. (android.permission.READ_MEDIA_IMAGES)'; + case 'locales.en': return 'English'; + case 'locales.zh': return '中文'; + default: return null; + } + } +} + diff --git a/lib/i18n/strings_zh.g.dart b/lib/i18n/strings_zh.g.dart new file mode 100644 index 0000000..e32d39b --- /dev/null +++ b/lib/i18n/strings_zh.g.dart @@ -0,0 +1,169 @@ +/// +/// Generated file. Do not edit. +/// +// coverage:ignore-file +// ignore_for_file: type=lint, unused_import + +import 'package:flutter/widgets.dart'; +import 'package:intl/intl.dart'; +import 'package:slang/generated.dart'; +import 'strings.g.dart'; + +// Path: +class TranslationsZh implements Translations { + /// You can call this constructor and build your own translation instance of this locale. + /// Constructing via the enum [AppLocale.build] is preferred. + TranslationsZh({Map? overrides, PluralResolver? cardinalResolver, PluralResolver? ordinalResolver}) + : assert(overrides == null, 'Set "translation_overrides: true" in order to enable this feature.'), + $meta = TranslationMetadata( + locale: AppLocale.zh, + overrides: overrides ?? {}, + cardinalResolver: cardinalResolver, + ordinalResolver: ordinalResolver, + ) { + $meta.setFlatMapFunction(_flatMapFunction); + } + + /// Metadata for the translations of . + @override final TranslationMetadata $meta; + + /// Access flat map + @override dynamic operator[](String key) => $meta.getTranslation(key); + + late final TranslationsZh _root = this; // ignore: unused_field + + // Translations + @override late final _TranslationsHomePageZh homePage = _TranslationsHomePageZh._(_root); + @override late final _TranslationsButtonsZh buttons = _TranslationsButtonsZh._(_root); + @override late final _TranslationsDialogsZh dialogs = _TranslationsDialogsZh._(_root); + @override Map get locales => { + 'en': 'English', + 'zh': '中文', + }; +} + +// Path: homePage +class _TranslationsHomePageZh implements TranslationsHomePageEn { + _TranslationsHomePageZh._(this._root); + + final TranslationsZh _root; // ignore: unused_field + + // Translations + @override String get title => 'FaForever'; + @override String get imageDescription => '请上传图片'; + @override String get description => '本app不会上传任何图片到服务器, 所有操作均在本地完成'; + @override String get textLabel => '文本'; + @override String get textLabelDescription => '文本会以水印添加到图片上'; + @override String get textValidator => '请输入文本.'; + @override String get textInput => '此证件仅用于办理xx业务, 其他用途无效'; + @override String get colorLabel => '颜色'; + @override String get colorValidator => '请选择颜色.'; + @override String get transparencyLabel => '透明度'; + @override String get preview => '预览'; + @override String get save => '保存'; +} + +// Path: buttons +class _TranslationsButtonsZh implements TranslationsButtonsEn { + _TranslationsButtonsZh._(this._root); + + final TranslationsZh _root; // ignore: unused_field + + // Translations + @override String get agree => '同意'; + @override String get cancel => '再想想'; +} + +// Path: dialogs +class _TranslationsDialogsZh implements TranslationsDialogsEn { + _TranslationsDialogsZh._(this._root); + + final TranslationsZh _root; // ignore: unused_field + + // Translations + @override late final _TranslationsDialogsExitConfirmZh exitConfirm = _TranslationsDialogsExitConfirmZh._(_root); + @override late final _TranslationsDialogsLicenseDialogZh licenseDialog = _TranslationsDialogsLicenseDialogZh._(_root); +} + +// Path: dialogs.exitConfirm +class _TranslationsDialogsExitConfirmZh implements TranslationsDialogsExitConfirmEn { + _TranslationsDialogsExitConfirmZh._(this._root); + + final TranslationsZh _root; // ignore: unused_field + + // Translations + @override String get exit => '退出'; + @override String get cancel => '取消'; + @override String get title => '关闭确认'; + @override String get description => '您确定要关闭此窗口吗?'; +} + +// Path: dialogs.licenseDialog +class _TranslationsDialogsLicenseDialogZh implements TranslationsDialogsLicenseDialogEn { + _TranslationsDialogsLicenseDialogZh._(this._root); + + final TranslationsZh _root; // ignore: unused_field + + // Translations + @override String get licenseDialogTitle => '隐私条款'; + @override String get licenseDialogContentContent => 'FaForever 非常重视你的隐私保护和个人信息保护.'; + @override String get licenseDialogContentTip => '以下是该APP所需的权限列表:'; + @override String get licenseDialogContentPrefix => '在使用APP服务前,请认真阅读 '; + @override String get licenseDialogContentUserAgreement => '《隐私政策》'; + @override String get licenseDialogContentAnd => '和'; + @override String get licenseDialogContentPrivacyAgreement => '《用户服务协议》'; + @override String get licenseDialogContentSuffix => ', 你同意并接受全部条款后开始使用我们的服务.'; + @override List get iosPermissions => [ + '为了让您上传图片, FaForever 需要访问您的照片. (NSPhotoLibraryUsageDescription)', + ]; + @override List get androidPermissions => [ + '为了使用 Firebase Analytics 服务, FaForever 需要访问您的互联网. (android.permission.INTERNET)', + '为了让您上传图片, FaForever 需要访问您的存储. (android.permission.READ_EXTERNAL_STORAGE)', + '为了让您保存图片, FaForever 需要访问您的存储. (android.permission.WRITE_EXTERNAL_STORAGE)', + '为了让您上传图片, FaForever 需要访问您的照片. (android.permission.READ_MEDIA_IMAGES)', + ]; +} + +/// Flat map(s) containing all translations. +/// Only for edge cases! For simple maps, use the map function of this library. +extension on TranslationsZh { + dynamic _flatMapFunction(String path) { + switch (path) { + case 'homePage.title': return 'FaForever'; + case 'homePage.imageDescription': return '请上传图片'; + case 'homePage.description': return '本app不会上传任何图片到服务器, 所有操作均在本地完成'; + case 'homePage.textLabel': return '文本'; + case 'homePage.textLabelDescription': return '文本会以水印添加到图片上'; + case 'homePage.textValidator': return '请输入文本.'; + case 'homePage.textInput': return '此证件仅用于办理xx业务, 其他用途无效'; + case 'homePage.colorLabel': return '颜色'; + case 'homePage.colorValidator': return '请选择颜色.'; + case 'homePage.transparencyLabel': return '透明度'; + case 'homePage.preview': return '预览'; + case 'homePage.save': return '保存'; + case 'buttons.agree': return '同意'; + case 'buttons.cancel': return '再想想'; + case 'dialogs.exitConfirm.exit': return '退出'; + case 'dialogs.exitConfirm.cancel': return '取消'; + case 'dialogs.exitConfirm.title': return '关闭确认'; + case 'dialogs.exitConfirm.description': return '您确定要关闭此窗口吗?'; + case 'dialogs.licenseDialog.licenseDialogTitle': return '隐私条款'; + case 'dialogs.licenseDialog.licenseDialogContentContent': return 'FaForever 非常重视你的隐私保护和个人信息保护.'; + case 'dialogs.licenseDialog.licenseDialogContentTip': return '以下是该APP所需的权限列表:'; + case 'dialogs.licenseDialog.licenseDialogContentPrefix': return '在使用APP服务前,请认真阅读 '; + case 'dialogs.licenseDialog.licenseDialogContentUserAgreement': return '《隐私政策》'; + case 'dialogs.licenseDialog.licenseDialogContentAnd': return '和'; + case 'dialogs.licenseDialog.licenseDialogContentPrivacyAgreement': return '《用户服务协议》'; + case 'dialogs.licenseDialog.licenseDialogContentSuffix': return ', 你同意并接受全部条款后开始使用我们的服务.'; + case 'dialogs.licenseDialog.iosPermissions.0': return '为了让您上传图片, FaForever 需要访问您的照片. (NSPhotoLibraryUsageDescription)'; + case 'dialogs.licenseDialog.androidPermissions.0': return '为了使用 Firebase Analytics 服务, FaForever 需要访问您的互联网. (android.permission.INTERNET)'; + case 'dialogs.licenseDialog.androidPermissions.1': return '为了让您上传图片, FaForever 需要访问您的存储. (android.permission.READ_EXTERNAL_STORAGE)'; + case 'dialogs.licenseDialog.androidPermissions.2': return '为了让您保存图片, FaForever 需要访问您的存储. (android.permission.WRITE_EXTERNAL_STORAGE)'; + case 'dialogs.licenseDialog.androidPermissions.3': return '为了让您上传图片, FaForever 需要访问您的照片. (android.permission.READ_MEDIA_IMAGES)'; + case 'locales.en': return 'English'; + case 'locales.zh': return '中文'; + default: return null; + } + } +} + diff --git a/pubspec.lock b/pubspec.lock index 6e78c37..137c069 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -411,10 +411,10 @@ packages: dependency: "direct main" description: name: flutter_native_splash - sha256: aa06fec78de2190f3db4319dd60fdc8d12b2626e93ef9828633928c2dcaea840 + sha256: ee5c9bd2b74ea8676442fd4ab876b5d41681df49276488854d6c81a5377c0ef1 url: "https://pub.dev" source: hosted - version: "2.4.1" + version: "2.4.2" flutter_plugin_android_lifecycle: dependency: transitive description: @@ -1050,26 +1050,26 @@ packages: dependency: "direct main" description: name: slang - sha256: a466773de768eb95bdf681e0a92e7c8010d44bb247b62130426c83ece33aeaed + sha256: f1da602c879fe7f2ea399faff1003a540c6adb745b5f603a9ab0c7275cd0b428 url: "https://pub.dev" source: hosted - version: "3.32.0" + version: "4.0.0" slang_build_runner: dependency: "direct dev" description: name: slang_build_runner - sha256: b2e0c63f3c801a4aa70b4ca43173893d6eb7d5a421fc9d97ad983527397631b3 + sha256: "9120c69f934895ba3d743e2c01f05d33103e85a944fc453d45306d85f40f9f69" url: "https://pub.dev" source: hosted - version: "3.32.0" + version: "4.0.0" slang_flutter: dependency: "direct main" description: name: slang_flutter - sha256: "1a98e878673996902fa5ef0b61ce5c245e41e4d25640d18af061c6aab917b0c7" + sha256: cc5d079107365e04842419d24bda6e22d1576331a5ac877734efd3b9e926860d url: "https://pub.dev" source: hosted - version: "3.32.0" + version: "4.0.0" source_span: dependency: transitive description: @@ -1354,10 +1354,10 @@ packages: dependency: transitive description: name: win32 - sha256: "2294c64768987ea280b43a3d8357d42d5679f3e2b5b69b602be45b2abbd165b0" + sha256: "2735daae5150e8b1dfeb3eb0544b4d3af0061e9e82cef063adcd583bdae4306a" url: "https://pub.dev" source: hosted - version: "5.6.1" + version: "5.7.0" win32_registry: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index c3a166c..a7c0fe0 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -40,7 +40,7 @@ dependencies: flutter_gen: ^5.8.0 flutter_localizations: sdk: flutter - flutter_native_splash: ^2.4.1 + flutter_native_splash: ^2.4.2 fluttertoast: ^8.2.8 form_builder_validators: ^11.0.0 gap: ^3.0.1 @@ -54,8 +54,8 @@ dependencies: sentry_flutter: ^8.9.0 sentry_logging: ^8.9.0 shared_preferences: ^2.3.2 - slang: ^3.32.0 - slang_flutter: ^3.32.0 + slang: ^4.0.0 + slang_flutter: ^4.0.0 syncfusion_flutter_sliders: ^27.1.53 synchronized: ^3.3.0+3 url_launcher: ^6.3.1 @@ -70,7 +70,7 @@ dev_dependencies: import_sorter: ^4.6.0 lint_staged: ^0.5.1 msix: ^3.16.8 - slang_build_runner: ^3.32.0 + slang_build_runner: ^4.0.0 very_good_analysis: ^6.0.0 # For information on the generic Dart part of this file, see the