Skip to content

Commit

Permalink
chore: update translations
Browse files Browse the repository at this point in the history
  • Loading branch information
LucasXu0 committed Feb 6, 2025
1 parent e6b6bdf commit a52b7b2
Show file tree
Hide file tree
Showing 5 changed files with 102 additions and 47 deletions.
14 changes: 10 additions & 4 deletions frontend/appflowy_flutter/lib/startup/tasks/auto_update_task.dart
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import 'package:appflowy/generated/locale_keys.g.dart';
import 'package:appflowy/startup/tasks/app_widget.dart';
import 'package:appflowy/startup/tasks/device_info_task.dart';
import 'package:appflowy/workspace/presentation/widgets/dialogs.dart';
import 'package:appflowy_backend/log.dart';
import 'package:auto_updater/auto_updater.dart';
import 'package:collection/collection.dart';
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
import 'package:universal_platform/universal_platform.dart';

Expand Down Expand Up @@ -54,16 +56,20 @@ class AutoUpdateTask extends LaunchTask {
void _showCriticalUpdateDialog() {
showCustomConfirmDialog(
context: AppGlobals.rootNavKey.currentContext!,
title: 'Critical update',
description:
'A critical update is available. Please update to the latest version.',
title: LocaleKeys.autoUpdate_criticalUpdateTitle.tr(),
description: LocaleKeys.autoUpdate_criticalUpdateDescription.tr(
namedArgs: {
'currentVersion': ApplicationInfo.applicationVersion,
'newVersion': ApplicationInfo.latestVersion,
},
),
builder: (context) => const SizedBox.shrink(),
// if the update is critical, dont allow the user to dismiss the dialog
barrierDismissible: false,
showCloseButton: false,
enableKeyboardListener: false,
closeOnConfirm: false,
confirmLabel: 'Update now',
confirmLabel: LocaleKeys.autoUpdate_criticalUpdateButton.tr(),
onConfirm: () async {
await autoUpdater.checkForUpdates();
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import 'package:appflowy/generated/flowy_svgs.g.dart';
import 'package:appflowy/generated/locale_keys.g.dart';
import 'package:appflowy/util/theme_extension.dart';
import 'package:easy_localization/easy_localization.dart';
import 'package:flowy_infra_ui/flowy_infra_ui.dart';
import 'package:flutter/material.dart';

Expand Down Expand Up @@ -28,15 +30,7 @@ class SidebarUpgradeApplicationButton extends StatelessWidget {
_buildTitle(),
const VSpace(2),
// description
const Opacity(
opacity: 0.7,
child: FlowyText(
'Get the latest features and bug fixes. Click "Update" to install now.',
fontSize: 13,
figmaLineHeight: 16,
maxLines: null,
),
),
_buildDescription(),
const VSpace(10),
// update button
_buildUpdateButton(),
Expand All @@ -53,8 +47,8 @@ class SidebarUpgradeApplicationButton extends StatelessWidget {
blendMode: null,
),
const HSpace(6),
const FlowyText.medium(
'New Version Available!',
FlowyText.medium(
LocaleKeys.autoUpdate_bannerUpdateTitle.tr(),
fontSize: 14,
figmaLineHeight: 18,
),
Expand All @@ -68,6 +62,18 @@ class SidebarUpgradeApplicationButton extends StatelessWidget {
);
}

Widget _buildDescription() {
return Opacity(
opacity: 0.7,
child: FlowyText(
LocaleKeys.autoUpdate_bannerUpdateDescription.tr(),
fontSize: 13,
figmaLineHeight: 16,
maxLines: null,
),
);
}

Widget _buildUpdateButton() {
return MouseRegion(
cursor: SystemMouseCursors.click,
Expand All @@ -85,8 +91,8 @@ class SidebarUpgradeApplicationButton extends StatelessWidget {
borderRadius: BorderRadius.circular(9),
),
),
child: const FlowyText.medium(
'Update',
child: FlowyText.medium(
LocaleKeys.autoUpdate_settingsUpdateButton.tr(),
color: Colors.white,
fontSize: 12.0,
figmaLineHeight: 15.0,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,20 @@
import 'package:appflowy/generated/locale_keys.g.dart';
import 'package:appflowy/startup/tasks/device_info_task.dart';
import 'package:appflowy_backend/log.dart';
import 'package:auto_updater/auto_updater.dart';
import 'package:easy_localization/easy_localization.dart';
import 'package:flowy_infra_ui/flowy_infra_ui.dart';
import 'package:flutter/material.dart';

class SettingsAppVersion extends StatelessWidget {
const SettingsAppVersion({super.key});
const SettingsAppVersion({
super.key,
});

@override
Widget build(BuildContext context) {
return ApplicationInfo.isUpdateAvailable
? _buildUpdateButton()
? const _UpdateAppSection()
: _buildIsUpToDate();
}

Expand All @@ -24,43 +29,68 @@ class SettingsAppVersion extends StatelessWidget {
],
);
}
}

Widget _buildUpdateButton() {
class _UpdateAppSection extends StatelessWidget {
const _UpdateAppSection();

@override
Widget build(BuildContext context) {
return Row(
children: [
Column(
crossAxisAlignment: CrossAxisAlignment.start,
Expanded(child: _buildDescription()),
_buildUpdateButton(),
],
);
}

Widget _buildUpdateButton() {
return PrimaryRoundedButton(
text: LocaleKeys.autoUpdate_settingsUpdateButton.tr(),
margin: const EdgeInsets.symmetric(horizontal: 24, vertical: 8),
fontWeight: FontWeight.w500,
radius: 8.0,
onTap: () {
Log.info('[AutoUpdater] Checking for updates');
autoUpdater.checkForUpdates();
},
);
}

Widget _buildDescription() {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
children: [
Row(
children: [
_buildRedDot(),
const HSpace(6),
FlowyText.medium(
'New Version (${ApplicationInfo.latestVersion}) Available!',
figmaLineHeight: 17,
_buildRedDot(),
const HSpace(6),
Flexible(
child: FlowyText.medium(
LocaleKeys.autoUpdate_settingsUpdateTitle.tr(
namedArgs: {
'newVersion': ApplicationInfo.latestVersion,
},
),
],
),
const VSpace(4),
Opacity(
opacity: 0.7,
child: FlowyText.regular(
'Current Version: ${ApplicationInfo.applicationVersion} (Official build) → ${ApplicationInfo.latestVersion}',
fontSize: 12,
figmaLineHeight: 13,
figmaLineHeight: 17,
overflow: TextOverflow.ellipsis,
),
),
],
),
const Spacer(),
PrimaryRoundedButton(
text: 'Update now',
margin: const EdgeInsets.symmetric(horizontal: 24, vertical: 8),
fontWeight: FontWeight.w500,
radius: 8.0,
onTap: () {
autoUpdater.checkForUpdates();
},
const VSpace(4),
Opacity(
opacity: 0.7,
child: FlowyText.regular(
LocaleKeys.autoUpdate_settingsUpdateDescription.tr(
namedArgs: {
'currentVersion': ApplicationInfo.applicationVersion,
'newVersion': ApplicationInfo.latestVersion,
},
),
fontSize: 12,
figmaLineHeight: 13,
),
),
],
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ class PrimaryRoundedButton extends StatelessWidget {
figmaLineHeight: figmaLineHeight,
color: textColor ?? Theme.of(context).colorScheme.onPrimary,
textAlign: TextAlign.center,
overflow: TextOverflow.ellipsis,
),
margin: margin ?? const EdgeInsets.symmetric(horizontal: 14.0),
backgroundColor: backgroundColor ?? Theme.of(context).colorScheme.primary,
Expand Down
12 changes: 12 additions & 0 deletions frontend/resources/translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -2511,6 +2511,7 @@
"accountLogin": "Account Login",
"updateNameError": "Failed to update name",
"updateIconError": "Failed to update icon",
"aboutAppFlowy": "About @:appName",
"deleteAccount": {
"title": "Delete Account",
"subtitle": "Permanently delete your account and all of your data.",
Expand Down Expand Up @@ -3081,5 +3082,16 @@
},
"ai": {
"contentPolicyViolation": "Image generation failed due to sensitive content. Please rephrase your input and try again"
},
"autoUpdate": {
"criticalUpdateTitle": "Update required to continue",
"criticalUpdateDescription": "We've made improvements to enhance your experience! Please update from {currentVersion} to {newVersion} to keep using the app.",
"criticalUpdateButton": "Update now",
"bannerUpdateTitle": "New Version Available!",
"bannerUpdateDescription": "Get the latest features and bug fixes. Click \"Update\" to install now",
"bannerUpdateButton": "Update",
"settingsUpdateTitle": "New Version ({newVersion}) Available!",
"settingsUpdateDescription": "Current version: {currentVersion} (Official build) → {newVersion}",
"settingsUpdateButton": "Update now"
}
}

0 comments on commit a52b7b2

Please sign in to comment.