🐛 Bug fixes within the new localization engine

This commit is contained in:
2026-02-05 15:53:25 +08:00
parent 541956d0e9
commit 769b0e0e9c
14 changed files with 283 additions and 46 deletions

View File

@@ -118,15 +118,16 @@ public partial class PostService(
public (string title, string content) ChopPostForNotification(SnPost post)
{
var locale = System.Globalization.CultureInfo.CurrentUICulture.Name;
var content = !string.IsNullOrEmpty(post.Description)
? post.Description?.Length >= 40 ? post.Description[..37] + "..." : post.Description
: post.Content?.Length >= 100
? string.Concat(post.Content.AsSpan(0, 97), "...")
: post.Content;
var title = post.Title ?? (post.Content?.Length >= 10 ? post.Content[..10] + "..." : post.Content);
title ??= localizer.Get("postOnlyMedia");
title ??= localizer.Get("postOnlyMedia", locale: locale);
if (string.IsNullOrWhiteSpace(content))
content = localizer.Get("postOnlyMedia");
content = localizer.Get("postOnlyMedia", locale: locale);
return (title, content);
}

View File

@@ -9,5 +9,16 @@
"postAwardedContentBody": "{user} awarded {amount} points to \"{title}\"",
"postSubscriptionTitle": "{publisher}: {title}",
"realmInviteTitle": "Realm Invitation",
"realmInviteBody": "You have been invited to join {realm}"
"realmInviteBody": "You have been invited to join {realm}",
"chatInviteTitle": "New Chat Invitation",
"chatInviteBody": "You just got invited to join {channel}",
"chatInviteDirectBody": "{user} sent an direct message invitation to you",
"postReplyBody": "{user} replied: {content}",
"postReplyContentBody": "{user} replied post \"{title}\": {content}",
"authCodeTitle": "Disposable Verification Code",
"authCodeBody": "{code} is your disposable code, it will expires in 5 minutes",
"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}"
}

View File

@@ -9,5 +9,16 @@
"postAwardedContentBody": "{user} 打赏了 {amount} 积分给 \"{title}\"",
"postSubscriptionTitle": "{publisher}: {title}",
"realmInviteTitle": "领域邀请",
"realmInviteBody": "您被邀请加入 {realm}"
"realmInviteBody": "您被邀请加入 {realm}",
"chatInviteTitle": "新聊天邀请",
"chatInviteBody": "您刚刚被邀请加入 {channel}",
"chatInviteDirectBody": "{user} 向您发送了私信邀请",
"postReplyBody": "{user} 回复:{content}",
"postReplyContentBody": "{user} 回复了帖子 \"{title}\"{content}",
"authCodeTitle": "一次性验证码",
"authCodeBody": "{code} 是您的一次性验证码将在5分钟后过期",
"subscriptionAppliedTitle": "订阅 {plan} 刚刚为您的账户激活",
"subscriptionAppliedBody": "感谢您支持 Solar Network您的 {days} 天 {plan} 订阅刚刚开始,请尽情探索新解锁的功能!",
"orderPaidTitle": "订单 {orderId} 收件人",
"orderPaidBody": "{amount} {currency} 已从您的钱包中扣除以支付 {item}"
}