chore: update translations on iOS (#6186)

* chore: update mobile translations

* fix: folder context not found assertion

* fix: attempted to change a read-only map field

* feat: only replace the translation on iOS
This commit is contained in:
Lucas.Xu 2024-09-04 16:03:54 +08:00 committed by GitHub
parent 71bb182803
commit d1127a9bfa
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 33 additions and 18 deletions

View file

@ -200,9 +200,6 @@ class _MobileSpaceTabState extends State<MobileSpaceTab>
viewSection: FolderSpaceType.public.toViewSectionPB,
),
);
context.read<FolderBloc>().add(
const FolderEvent.expandOrUnExpand(isExpanded: true),
);
}
}

View file

@ -44,11 +44,15 @@ Future<(String? path, String? errorMessage)> saveFileToCloudStorage(
localFilePath: localFilePath,
documentId: documentId,
);
return result.fold(
(s) => (s.url, null),
(err) {
final message = Platform.isIOS
? LocaleKeys.sideBar_storageLimitDialogTitleIOS.tr()
: LocaleKeys.sideBar_storageLimitDialogTitle.tr();
if (err.isStorageLimitExceeded) {
return (null, LocaleKeys.sideBar_storageLimitDialogTitle.tr());
return (null, message);
}
return (null, err.msg);
},

View file

@ -1,7 +1,5 @@
import 'dart:io';
import 'package:flutter/widgets.dart';
import 'package:appflowy/generated/locale_keys.g.dart';
import 'package:appflowy/plugins/document/application/prelude.dart';
import 'package:appflowy/plugins/document/presentation/editor_plugins/image/common.dart';
@ -13,6 +11,7 @@ import 'package:appflowy_backend/dispatch/error.dart';
import 'package:appflowy_backend/log.dart';
import 'package:easy_localization/easy_localization.dart';
import 'package:flowy_infra/uuid.dart';
import 'package:flutter/widgets.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:path/path.dart' as p;
@ -61,8 +60,11 @@ Future<(String? path, String? errorMessage)> saveImageToCloudStorage(
return (s.url, null);
},
(err) {
final message = Platform.isIOS
? LocaleKeys.sideBar_storageLimitDialogTitleIOS.tr()
: LocaleKeys.sideBar_storageLimitDialogTitle.tr();
if (err.isStorageLimitExceeded) {
return (null, LocaleKeys.sideBar_storageLimitDialogTitle.tr());
return (null, message);
} else {
return (null, err.msg);
}

View file

@ -463,7 +463,7 @@ class ReminderUpdate {
? scheduledAt!.isBefore(DateTime.now())
: a.isAck;
final meta = a.meta;
final meta = {...a.meta};
if (includeTime != a.includeTime) {
meta[ReminderMetaKeys.includeTime] = includeTime.toString();
}

View file

@ -1,4 +1,4 @@
import 'package:flutter/material.dart';
import 'dart:io';
import 'package:appflowy/generated/flowy_svgs.g.dart';
import 'package:appflowy/generated/locale_keys.g.dart';
@ -15,6 +15,7 @@ import 'package:appflowy_popover/appflowy_popover.dart';
import 'package:easy_localization/easy_localization.dart';
import 'package:flowy_infra/theme_extension.dart';
import 'package:flowy_infra_ui/flowy_infra_ui.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
class SidebarToast extends StatelessWidget {
@ -39,13 +40,13 @@ class SidebarToast extends StatelessWidget {
storageLimitHit: () => PlanIndicator(
planName: SubscriptionPlanPB.Free.label,
text: LocaleKeys.sideBar_upgradeToPro.tr(),
onTap: () => _hanldeOnTap(context, SubscriptionPlanPB.Pro),
onTap: () => _handleOnTap(context, SubscriptionPlanPB.Pro),
reason: LocaleKeys.sideBar_storageLimitDialogTitle.tr(),
),
aiMaxiLimitHit: () => PlanIndicator(
planName: SubscriptionPlanPB.AiMax.label,
text: LocaleKeys.sideBar_upgradeToAIMax.tr(),
onTap: () => _hanldeOnTap(context, SubscriptionPlanPB.AiMax),
onTap: () => _handleOnTap(context, SubscriptionPlanPB.AiMax),
reason: LocaleKeys.sideBar_aiResponseLimitTitle.tr(),
),
);
@ -61,12 +62,12 @@ class SidebarToast extends StatelessWidget {
LocaleKeys.settings_comparePlanDialog_actions_upgrade.tr(),
onConfirm: () {
WidgetsBinding.instance.addPostFrameCallback(
(_) => _hanldeOnTap(context, SubscriptionPlanPB.Pro),
(_) => _handleOnTap(context, SubscriptionPlanPB.Pro),
);
},
);
void _hanldeOnTap(BuildContext context, SubscriptionPlanPB plan) {
void _handleOnTap(BuildContext context, SubscriptionPlanPB plan) {
final userProfile = context.read<SidebarPlanBloc>().state.userProfile;
if (userProfile == null) {
return Log.error(
@ -91,9 +92,16 @@ class SidebarToast extends StatelessWidget {
SettingsPage.plan,
);
} else {
final message = plan == SubscriptionPlanPB.AiMax
? LocaleKeys.sideBar_askOwnerToUpgradeToAIMax.tr()
: LocaleKeys.sideBar_askOwnerToUpgradeToPro.tr();
final String message;
if (plan == SubscriptionPlanPB.AiMax) {
message = Platform.isIOS
? LocaleKeys.sideBar_askOwnerToUpgradeToAIMaxIOS.tr()
: LocaleKeys.sideBar_askOwnerToUpgradeToAIMax.tr();
} else {
message = Platform.isIOS
? LocaleKeys.sideBar_askOwnerToUpgradeToProIOS.tr()
: LocaleKeys.sideBar_askOwnerToUpgradeToPro.tr();
}
showDialog(
context: context,

View file

@ -393,7 +393,7 @@ class _MToast extends StatelessWidget {
),
const HSpace(8.0),
],
hintText,
Expanded(child: hintText),
],
)
: hintText,

View file

@ -300,11 +300,15 @@
"upgradeToPro": "Upgrade to Pro",
"upgradeToAIMax": "Unlock unlimited AI",
"storageLimitDialogTitle": "You have run out of free storage. Upgrade to unlock unlimited storage",
"storageLimitDialogTitleIOS": "You have run out of free storage.",
"aiResponseLimitTitle": "You have run out of free AI responses. Upgrade to the Pro Plan or purchase an AI add-on to unlock unlimited responses",
"aiResponseLimitTitleIOS": "You have run out of free AI responses.",
"aiResponseLimitDialogTitle": "AI Responses limit reached",
"aiResponseLimit": "You have run out of free AI responses.\n\nGo to Settings -> Plan -> Click AI Max or Pro Plan to get more AI responses",
"askOwnerToUpgradeToPro": "Your workspace is running out of free storage. Please ask your workspace owner to upgrade to the Pro Plan",
"askOwnerToUpgradeToProIOS": "Your workspace is running out of free storage.",
"askOwnerToUpgradeToAIMax": "Your workspace is running out of free AI responses. Please ask your workspace owner to upgrade the plan or purchase AI add-ons",
"askOwnerToUpgradeToAIMaxIOS": "Your workspace is running out of free AI responses.",
"purchaseStorageSpace": "Purchase Storage Space",
"purchaseAIResponse": "Purchase ",
"askOwnerToUpgradeToLocalAI": "Ask workspace owner to enable AI On-device",
@ -1116,7 +1120,7 @@
},
"inviteFailedDialogTitle": "Failed to send invite",
"inviteFailedMemberLimit": "Member limit has been reached, please upgrade to invite more members.",
"inviteFailedMemberLimitMobile": "Your workspace has reached the member limit. Upgrade on Desktop to unlock more features.",
"inviteFailedMemberLimitMobile": "Your workspace has reached the member limit.",
"memberLimitExceeded": "Member limit reached, to invite more members, please ",
"memberLimitExceededUpgrade": "upgrade",
"memberLimitExceededPro": "Member limit reached, if you require more members contact ",