diff --git a/assets/translations/en.json b/assets/translations/en.json index 9d4e2fd..77af562 100644 --- a/assets/translations/en.json +++ b/assets/translations/en.json @@ -171,6 +171,15 @@ "trackOnly": "Track-Only", "errorWithHttpStatusCode": "Error {}", "versionCorrectionDisabled": "Version correction disabled (plugin doesn't seem to work)", + "unknown": "Unknown", + "none": "None", + "never": "Never", + "latestVersionX": "Latest Version: {}", + "installedVersionX": "Installed Version: {}", + "lastUpdateCheckX": "Last Update Check: {}", + "remove": "Remove", + "removeAppQuestion": "Remove App?", + "yesMarkUpdated": "'Yes, Mark as Updated", "tooManyRequestsTryAgainInMinutes": { "one": "Too many requests (rate limited) - try again in {} minute", "other": "Too many requests (rate limited) - try again in {} minutes" diff --git a/assets/translations/zh.json b/assets/translations/zh.json index f5117ec..1603ded 100644 --- a/assets/translations/zh.json +++ b/assets/translations/zh.json @@ -42,6 +42,7 @@ "trackOnlyAppDescription": "The App will be tracked for updates, but Obtainium will not be able to download or install it.", "cancelled": "已取消", "appAlreadyAdded": "此应用程序已被添加", + "alreadyUpToDateQuestion": "App Already up to Date?", "addApp": "添加应用", "appSourceURL": "应用来源 URL", "error": "错误", @@ -169,6 +170,16 @@ "pleaseAllowInstallPerm": "请允许 Obtainium 安装应用程序", "trackOnly": "仅追踪", "errorWithHttpStatusCode": "错误 {}", + "versionCorrectionDisabled": "Version correction disabled (plugin doesn't seem to work)", + "unknown": "Unknown", + "none": "None", + "never": "Never", + "latestVersionX": "Latest Version: {}", + "installedVersionX": "Installed Version: {}", + "lastUpdateCheckX": "Last Update Check: {}", + "remove": "Remove", + "removeAppQuestion": "Remove App?", + "yesMarkUpdated": "'Yes, Mark as Updated", "tooManyRequestsTryAgainInMinutes": { "one": "请求过多 (API 限制) - 在 {} 分钟后重试", "other": "请求过多 (API 限制) - 在 {} 分钟后重试" diff --git a/lib/main.dart b/lib/main.dart index 31a4ba1..e997854 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -21,13 +21,13 @@ import 'package:easy_localization/src/easy_localization_controller.dart'; // ignore: implementation_imports import 'package:easy_localization/src/localization.dart'; -const String currentVersion = '0.8.10'; +const String currentVersion = '0.8.11'; const String currentReleaseTag = 'v$currentVersion-beta'; // KEEP THIS IN SYNC WITH GITHUB RELEASES const int bgUpdateCheckAlarmId = 666; -const supportedLocales = [Locale('en')]; +const supportedLocales = [Locale('en'), Locale('zh')]; const fallbackLocale = Locale('en'); const localeDir = 'assets/translations'; diff --git a/lib/pages/app.dart b/lib/pages/app.dart index 351c624..73bd34b 100644 --- a/lib/pages/app.dart +++ b/lib/pages/app.dart @@ -76,7 +76,7 @@ class _AppPageState extends State { style: Theme.of(context).textTheme.displayLarge, ), Text( - 'By ${app?.app.author ?? 'Unknown'}', + tr('byX', args: [app?.app.author ?? tr('unknown')]), textAlign: TextAlign.center, style: Theme.of(context).textTheme.headlineMedium, ), @@ -102,12 +102,17 @@ class _AppPageState extends State { height: 32, ), Text( - 'Latest Version: ${app?.app.latestVersion ?? 'Unknown'}', + tr('latestVersionX', + args: [app?.app.latestVersion ?? tr('unknown')]), textAlign: TextAlign.center, style: Theme.of(context).textTheme.bodyLarge, ), Text( - 'Installed Version: ${app?.app.installedVersion ?? 'None'}${app?.app.trackOnly == true ? ' (Estimate)\n\nApp is Track-Only' : ''}', + '${tr('installedVersionX', args: [ + app?.app.installedVersion ?? tr('none') + ])}${app?.app.trackOnly == true ? ' ${tr('estimateInBrackets')}\n\n${tr('xIsTrackOnly', args: [ + tr('app') + ])}' : ''}', textAlign: TextAlign.center, style: Theme.of(context).textTheme.bodyLarge, ), @@ -115,7 +120,11 @@ class _AppPageState extends State { height: 32, ), Text( - 'Last Update Check: ${app?.app.lastUpdateCheck == null ? 'Never' : '\n${app?.app.lastUpdateCheck?.toLocal()}'}', + tr('lastUpdateCheckX', args: [ + app?.app.lastUpdateCheck == null + ? tr('never') + : '\n${app?.app.lastUpdateCheck?.toLocal()}' + ]), textAlign: TextAlign.center, style: const TextStyle( fontStyle: FontStyle.italic, fontSize: 12), @@ -166,7 +175,7 @@ class _AppPageState extends State { Navigator.of(context) .pop(); }, - child: const Text('No')), + child: Text(tr('no'))), TextButton( onPressed: () { HapticFeedback @@ -183,8 +192,8 @@ class _AppPageState extends State { Navigator.of(context) .pop(); }, - child: const Text( - 'Yes, Mark as Updated')) + child: Text( + tr('yesMarkUpdated'))) ], ); }); @@ -267,9 +276,14 @@ class _AppPageState extends State { context: context, builder: (BuildContext ctx) { return AlertDialog( - title: const Text('Remove App?'), - content: Text( - 'This will remove \'${app?.installedInfo?.name ?? app?.app.name}\' from Obtainium.${app?.app.installedVersion != null ? '\n\nNote that while Obtainium will no longer track its updates, the App will remain installed.' : ''}'), + title: Text(tr('removeAppQuestion')), + content: Text(tr( + 'xWillBeRemovedButRemainInstalled', + args: [ + app?.installedInfo?.name ?? + app?.app.name ?? + tr('app') + ])), actions: [ TextButton( onPressed: () { @@ -283,12 +297,12 @@ class _AppPageState extends State { count++ >= 2); }); }, - child: const Text('Remove')), + child: Text(tr('remove'))), TextButton( onPressed: () { Navigator.of(context).pop(); }, - child: const Text('Cancel')) + child: Text(tr('cancel'))) ], ); }); @@ -298,7 +312,7 @@ class _AppPageState extends State { Theme.of(context).colorScheme.error, surfaceTintColor: Theme.of(context).colorScheme.error), - child: const Text('Remove'), + child: Text(tr('remove')), ), ])), if (app?.downloadProgress != null) diff --git a/pubspec.yaml b/pubspec.yaml index 1d95940..971ae09 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -17,7 +17,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html # In Windows, build-name is used as the major, minor, and patch parts # of the product and file versions while build-number is used as the build suffix. -version: 0.8.10+74 # When changing this, update the tag in main() accordingly +version: 0.8.11+75 # When changing this, update the tag in main() accordingly environment: sdk: '>=2.18.2 <3.0.0'