🐛 Fix the usage of new localization system

This commit is contained in:
2026-02-05 16:03:09 +08:00
parent 769b0e0e9c
commit 3c0f5b0e41
9 changed files with 24 additions and 24 deletions

View File

@@ -466,12 +466,12 @@ public class AccountService(
contact.Content,
localizer.Get("codeEmailTitle", account.Language),
"FactorCode",
account.Language,
new VerificationEmailModel
{
Name = account.Name,
Code = code
}
},
account.Language
);
await _SetFactorCode(factor, code, TimeSpan.FromMinutes(30));

View File

@@ -99,12 +99,12 @@ public class MagicSpellService(
contact.Content,
localizer.Get("regConfirmTitle", accountLanguage),
"Welcome",
accountLanguage,
new LandingEmailModel
{
Name = contact.Account.Name,
Link = link
}
},
accountLanguage
);
break;
case MagicSpellType.AccountRemoval:
@@ -113,12 +113,12 @@ public class MagicSpellService(
contact.Content,
localizer.Get("accountDeletionTitle", accountLanguage),
"AccountDeletion",
accountLanguage,
new AccountDeletionEmailModel
{
Name = contact.Account.Name,
Link = link
}
},
accountLanguage
);
break;
case MagicSpellType.AuthPasswordReset:
@@ -127,12 +127,12 @@ public class MagicSpellService(
contact.Content,
localizer.Get("passwordResetTitle", accountLanguage),
"PasswordReset",
accountLanguage,
new PasswordResetEmailModel
{
Name = contact.Account.Name,
Link = link
}
},
accountLanguage
);
break;
case MagicSpellType.ContactVerification:
@@ -143,12 +143,12 @@ public class MagicSpellService(
contactMethod!,
localizer.Get("contractMethodVerificationTitle", accountLanguage),
"ContactVerification",
accountLanguage,
new ContactVerificationEmailModel
{
Name = contact.Account.Name,
Link = link
}
},
accountLanguage
);
break;
case MagicSpellType.AccountDeactivation:

View File

@@ -117,7 +117,7 @@ public class RelationshipService(
Notification = new PushNotification
{
Topic = "relationships.friends.request",
Title = localizer.Get("friendRequestTitle", locale: sender.Language, args: new { sender.Nick }),
Title = localizer.Get("friendRequestTitle", locale: sender.Language, args: new { sender = sender.Nick }),
Body = localizer.Get("friendRequestBody", locale: sender.Language),
ActionUri = "/account/relationships",
IsSavable = true

View File

@@ -128,7 +128,7 @@ public class RealmServiceGrpc(
{
Topic = "invites.realms",
Title = localizer.Get("realmInviteTitle", account.Language),
Body = localizer.Get("realmInviteBody", locale: account.Language, args: new { realmName = member?.Name ?? "Unknown Realm" }),
Body = localizer.Get("realmInviteBody", locale: account.Language, args: new { realmName = member?.Realm?.Name ?? "Unknown Realm" }),
ActionUri = "/realms",
IsSavable = true
}

View File

@@ -230,7 +230,7 @@ public partial class PostService(
Notification = new PushNotification
{
Topic = "post.replies",
Title = localizer.Get("postReplyTitle", args: new { senderNick = sender!.Nick }),
Title = localizer.Get("postReplyTitle", args: new { user = sender!.Nick }),
Body = ChopPostForNotification(post).content,
IsSavable = true,
ActionUri = $"/posts/{post.Id}"
@@ -704,10 +704,10 @@ public partial class PostService(
Notification = new PushNotification
{
Topic = "posts.reactions.new",
Title = localizer.Get("postReactTitle", args: new { senderNick = sender.Nick }),
Title = localizer.Get("postReactTitle", args: new { user = sender.Nick }),
Body = string.IsNullOrWhiteSpace(post.Title)
? localizer.Get("postReactBody", args: new { senderNick = sender.Nick, reaction.Symbol })
: localizer.Get("postReactContentBody", args: new { senderNick = sender.Nick, reaction.Symbol, post.Title }),
? localizer.Get("postReactBody", args: new { user = sender.Nick, reaction = reaction.Symbol })
: localizer.Get("postReactContentBody", args: new { user = sender.Nick, reaction = reaction.Symbol, title = post.Title }),
IsSavable = true,
ActionUri = $"/posts/{post.Id}"
}
@@ -1157,10 +1157,10 @@ public partial class PostService(
Notification = new PushNotification
{
Topic = "posts.awards.new",
Title = localizer.Get("postAwardedTitle", args: new { senderNick = sender.Nick }),
Title = localizer.Get("postAwardedTitle", args: new { user = sender.Nick }),
Body = string.IsNullOrWhiteSpace(post.Title)
? localizer.Get("postAwardedBody", args: new { senderNick = sender.Nick, amount })
: localizer.Get("postAwardedContentBody", args: new { senderNick = sender.Nick, amount, post.Title }),
? localizer.Get("postAwardedBody", args: new { user = sender.Nick, amount })
: localizer.Get("postAwardedContentBody", args: new { user = sender.Nick, amount, title = post.Title }),
IsSavable = true,
ActionUri = $"/posts/{post.Id}"
}

View File

@@ -118,7 +118,7 @@ public class PublisherSubscriptionService(
var notification = new PushNotification
{
Topic = "posts.new",
Title = localizer.Get("postSubscriptionTitle", args: new { publisherNick = post.Publisher!.Nick, title }),
Title = localizer.Get("postSubscriptionTitle", args: new { publisher = post.Publisher!.Nick, title }),
Body = message,
Meta = GrpcTypeHelper.ConvertObjectToByteString(data),
IsSavable = true,

View File

@@ -20,5 +20,5 @@
"subscriptionAppliedTitle": "Subscription {plan} just activated for your account",
"subscriptionAppliedBody": "Thank for supporting the Solar Network! Your {days} days {plan} subscription just begun, feel free to explore the newly unlocked features!",
"orderPaidTitle": "Order {orderId} recipient",
"orderPaidBody": "{amount} {currency} was removed from your wallet to pay for {item}"
"orderPaidBody": "{amount} {currency} was removed from your wallet to pay for {remark}"
}

View File

@@ -20,5 +20,5 @@
"subscriptionAppliedTitle": "订阅 {plan} 刚刚为您的账户激活",
"subscriptionAppliedBody": "感谢您支持 Solar Network您的 {days} 天 {plan} 订阅刚刚开始,请尽情探索新解锁的功能!",
"orderPaidTitle": "订单 {orderId} 收件人",
"orderPaidBody": "{amount} {currency} 已从您的钱包中扣除以支付 {item}"
"orderPaidBody": "{amount} {currency} 已从您的钱包中扣除以支付 {remark}"
}

View File

@@ -425,7 +425,7 @@ public class SubscriptionService(
{
Topic = "subscriptions.begun",
Title = localizer.Get("subscriptionAppliedTitle", locale: locale, args: new { subscriptionName = humanReadableName }),
Body = localizer.Get("subscriptionAppliedBody", locale: locale, args: new { duration, subscriptionName = humanReadableName }),
Body = localizer.Get("subscriptionAppliedBody", locale: locale, args: new { duration, subscription = humanReadableName }),
Meta = GrpcTypeHelper.ConvertObjectToByteString(new Dictionary<string, object>
{
["subscription_id"] = subscription.Id.ToString()
@@ -923,7 +923,7 @@ public class SubscriptionService(
{
Topic = "gifts.claimed",
Title = localizer.Get("giftClaimedTitle", locale: locale),
Body = localizer.Get("giftClaimedBody", locale: locale, args: new { subscriptionName = humanReadableName, redeemerName = redeemer.Name }),
Body = localizer.Get("giftClaimedBody", locale: locale, args: new { subscription = humanReadableName, user = redeemer.Name }),
Meta = GrpcTypeHelper.ConvertObjectToByteString(new Dictionary<string, object>
{
["gift_id"] = gift.Id.ToString(),