🐛 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

@@ -330,11 +330,11 @@ public class AccountEventService(
.Where(x => x.AccountId == user.Id)
.Select(x => new { x.Birthday, x.TimeZone })
.FirstOrDefaultAsync();
var accountBirthday = accountProfile?.Birthday;
var now = SystemClock.Instance.GetCurrentInstant();
var userTimeZone = DateTimeZone.Utc;
if (!string.IsNullOrEmpty(accountProfile?.TimeZone))
{
@@ -343,9 +343,9 @@ public class AccountEventService(
var todayInUserTz = now.InZone(userTimeZone).Date;
var birthdayDate = accountBirthday?.InZone(userTimeZone).Date;
var isBirthday = birthdayDate.HasValue &&
birthdayDate.Value.Month == todayInUserTz.Month &&
var isBirthday = birthdayDate.HasValue &&
birthdayDate.Value.Month == todayInUserTz.Month &&
birthdayDate.Value.Day == todayInUserTz.Day;
List<CheckInFortuneTip> tips;
@@ -561,7 +561,7 @@ public class AccountEventService(
{
var userActivities = activitiesByUser.GetValueOrDefault(userId, new List<SnPresenceActivity>());
results[userId] = userActivities;
// Update cache for this user
var cacheKey = $"{ActivityCacheKey}{userId}";
await cache.SetWithGroupsAsync(cacheKey, userActivities, [$"{AccountService.AccountCachePrefix}{userId}"],

View File

@@ -432,8 +432,8 @@ public class AccountService(
Notification = new PushNotification
{
Topic = "auth.verification",
Title = localizer.Get("authCodeTitle"),
Body = localizer.Get("authCodeBody", args: new { code }),
Title = localizer.Get("authCodeTitle", account.Language),
Body = localizer.Get("authCodeBody", locale: account.Language, args: new { code }),
IsSavable = false
}
}
@@ -464,8 +464,9 @@ public class AccountService(
.SendRazorTemplateEmailAsync<VerificationEmailModel>(
account.Nick,
contact.Content,
localizer.Get("codeEmailTitle"),
localizer.Get("codeEmailTitle", account.Language),
"FactorCode",
account.Language,
new VerificationEmailModel
{
Name = account.Name,

View File

@@ -97,8 +97,9 @@ public class MagicSpellService(
await email.SendRazorTemplateEmailAsync<LandingEmailModel>(
contact.Account.Nick,
contact.Content,
localizer.Get("regConfirmTitle"),
localizer.Get("regConfirmTitle", accountLanguage),
"Welcome",
accountLanguage,
new LandingEmailModel
{
Name = contact.Account.Name,
@@ -110,8 +111,9 @@ public class MagicSpellService(
await email.SendRazorTemplateEmailAsync<AccountDeletionEmailModel>(
contact.Account.Nick,
contact.Content,
localizer.Get("accountDeletionTitle"),
localizer.Get("accountDeletionTitle", accountLanguage),
"AccountDeletion",
accountLanguage,
new AccountDeletionEmailModel
{
Name = contact.Account.Name,
@@ -123,8 +125,9 @@ public class MagicSpellService(
await email.SendRazorTemplateEmailAsync<PasswordResetEmailModel>(
contact.Account.Nick,
contact.Content,
localizer.Get("passwordResetTitle"),
localizer.Get("passwordResetTitle", accountLanguage),
"PasswordReset",
accountLanguage,
new PasswordResetEmailModel
{
Name = contact.Account.Name,
@@ -138,8 +141,9 @@ public class MagicSpellService(
await email.SendRazorTemplateEmailAsync<ContactVerificationEmailModel>(
contact.Account.Nick,
contactMethod!,
localizer.Get("contractMethodVerificationTitle"),
localizer.Get("contractMethodVerificationTitle", accountLanguage),
"ContactVerification",
accountLanguage,
new ContactVerificationEmailModel
{
Name = contact.Account.Name,

View File

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