🐛 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);
}