知了 Cicada · 任何会议和直播的实时字幕、同声传译、AI 会议纪要,Mac、Windows、Linux、Android 免费开源。Live subtitles, interpreting and meeting notes for any call or stream, on Mac, Windows, Linux and Android.
Swift androidlinuxlive-captionsmacosmeeting-notesmenubar-appsimultaneous-interpretationspeech-recognitionsubtitlesswiftswiftuitranslationwindows
chore(windows): load the Windows-only translations and date records in the app's language
wquguru18ffe814fabc
diff --git a/windows/src/Cicada.Core/SessionStore.cs b/windows/src/Cicada.Core/SessionStore.csindex d7cc2b8..eccb907 100644--- a/windows/src/Cicada.Core/SessionStore.cs+++ b/windows/src/Cicada.Core/SessionStore.cs@@ -65,7 +65,7 @@ public sealed class SessionStore{if (s.Renamed ?? !s.Title.StartsWith("会议 ")) return s.Title;var local = s.StartedAt.ToLocalTime();- var ui = CultureInfo.CurrentUICulture;+ var ui = Strings.Culture;if (string.IsNullOrEmpty(s.Notes?.Title))return Strings.L("会议") + " " + local.ToString(Strings.L("M月d日 HH:mm"), ui);var date = local.Year == DateTimeOffset.Now.Year ? local.ToString(Strings.L("M月d日"), ui) : local.ToString(Strings.L("yyyy年M月d日"), ui);@@ -154,7 +154,7 @@ public sealed class SessionStorepublic static string Markdown(Session s){var b = new StringBuilder();- b.AppendLine($"# {s.Notes?.Title ?? s.Title}").AppendLine();+ b.AppendLine($"# {DisplayTitle(s)}").AppendLine();b.AppendLine(s.StartedAt.ToLocalTime().ToString("yyyy-MM-dd HH:mm", CultureInfo.InvariantCulture)).AppendLine();if (s.Notes is { IsEmpty: false } n){diff --git a/windows/src/Cicada.Core/Strings.cs b/windows/src/Cicada.Core/Strings.csindex 3fa07d9..6f2f4e2 100644--- a/windows/src/Cicada.Core/Strings.cs+++ b/windows/src/Cicada.Core/Strings.cs@@ -11,6 +11,8 @@ public static class Strings{static Dictionary<string, string> table = [];public static string Language { get; private set; } = "zh-Hans";+ /// Dates in the app's language, not Windows': English Cicada on Chinese Windows writes "Nov 4".+ public static CultureInfo Culture { get; private set; } = CultureInfo.GetCultureInfo("zh-CN");/// Loads the table for `language` ("en", "ja", "ko"; anything else is Chinese) from/// `folder`/<lang>.lproj/Localizable.strings.@@ -19,6 +21,7 @@ public static class Stringsvar ui = language ?? CultureInfo.CurrentUICulture.Name;var head = ui.Split('-')[0];Language = head is "en" or "ja" or "ko" ? head : "zh-Hans";+ Culture = CultureInfo.GetCultureInfo(Language switch { "en" => "en-US", "ja" => "ja-JP", "ko" => "ko-KR", _ => "zh-CN" });// The Mac's table, then the Windows-only strings over it (Windows.strings, same format).table = [];foreach (var name in new[] { "Localizable.strings", "Windows.strings" })diff --git a/windows/src/Cicada/Cicada.csproj b/windows/src/Cicada/Cicada.csprojindex 20823b8..da81736 100644--- a/windows/src/Cicada/Cicada.csproj+++ b/windows/src/Cicada/Cicada.csproj@@ -26,7 +26,8 @@<Using Remove="System.Drawing" /><Using Include="System.IO" /><None Include="../../../Resources/**/Localizable.strings" LinkBase="Resources" CopyToOutputDirectory="PreserveNewest" />- <None Include="Strings/**/Windows.strings" LinkBase="Resources" CopyToOutputDirectory="PreserveNewest" />+ <!-- LinkBase only moves files from outside the project, so these name their place explicitly. -->+ <None Include="Strings/**/Windows.strings" Link="Resources/%(RecursiveDir)%(Filename)%(Extension)" CopyToOutputDirectory="PreserveNewest" /><!-- Both made by scripts/build.sh from docs/icon.png and Resources/sample/sample.m4a; committed so CI on Windows needs no Mac tools. --><Resource Include="Assets/cicada.ico" Link="cicada.ico" /><None Include="Assets/sample.wav" Link="Resources/sample.wav" CopyToOutputDirectory="PreserveNewest" />diff --git a/windows/tests/Cicada.Tests/Cicada.Tests.csproj b/windows/tests/Cicada.Tests/Cicada.Tests.csprojindex bbab86d..57cbf78 100644--- a/windows/tests/Cicada.Tests/Cicada.Tests.csproj+++ b/windows/tests/Cicada.Tests/Cicada.Tests.csproj@@ -7,6 +7,7 @@</PropertyGroup><ItemGroup><None Include="../../../Resources/**/Localizable.strings" LinkBase="Resources" CopyToOutputDirectory="PreserveNewest" />+ <None Include="../../src/Cicada/Strings/**/Windows.strings" LinkBase="Resources" CopyToOutputDirectory="PreserveNewest" /><ProjectReference Include="../../src/Cicada.Core/Cicada.Core.csproj" /></ItemGroup></Project>diff --git a/windows/tests/Cicada.Tests/Program.cs b/windows/tests/Cicada.Tests/Program.csindex 16eb38d..d56cd85 100644--- a/windows/tests/Cicada.Tests/Program.cs+++ b/windows/tests/Cicada.Tests/Program.cs@@ -119,6 +119,7 @@ static class TestsCheck(SessionStore.DisplayTitle(s).EndsWith(" 路线评审"), "notes' name after the date");s.Renamed = true; s.Title = "我的会";Equal("我的会", SessionStore.DisplayTitle(s), "the user's title wins");+ Check(SessionStore.Markdown(s).Split('\n')[0].TrimEnd() == "# 我的会", "the export is headed by the shown title");}// MARK: Hearing@@ -284,6 +285,10 @@ static class TestsEqual("没有这条", Strings.L("没有这条"), "missing keys show the Chinese");Strings.Load(Path.Combine(AppContext.BaseDirectory, "Resources"), "zh-Hans");Equal("实时纪要", Strings.L("实时纪要"), "Chinese is the key");+ Strings.Load(Path.Combine(AppContext.BaseDirectory, "Resources"), "en");+ var s = new Session { Title = "会议 11月4日 10:27", StartedAt = new DateTimeOffset(2026, 11, 4, 10, 27, 0, TimeSpan.Zero) };+ Check(!SessionStore.DisplayTitle(s).Contains('月'), "English dates whatever Windows' language: " + SessionStore.DisplayTitle(s));+ Strings.Load(Path.Combine(AppContext.BaseDirectory, "Resources"), "zh-Hans");var t = Strings.Parse("/* c */\n\"a \\\"b\\\"\" = \"x\\ny\";\n// line\n\"%@ 分钟\" = \"%@ min\";");Equal("x\ny", t["a \"b\""], "escapes");Equal("%@ min", t["%@ 分钟"], "placeholders kept");