From 445b45a9532b61420c29a0d2758aaf1a726849b5 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 2 Oct 2026 16:48:49 +0000 Subject: [PATCH] fix(i18n): replace resx files atomically on import Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_012iLMBNwBE2GnphAsu4cjaC --- src/Titano.Tools/Commands/I18nCommand.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Titano.Tools/Commands/I18nCommand.cs b/src/Titano.Tools/Commands/I18nCommand.cs index 36759988..6c677eea 100644 --- a/src/Titano.Tools/Commands/I18nCommand.cs +++ b/src/Titano.Tools/Commands/I18nCommand.cs @@ -209,7 +209,10 @@ internal sealed partial class I18nCommand : ICommand foreach (var (key, value) in values) sb.Append($" {Escape(value)}\n"); sb.Append("\n"); - File.WriteAllText(path, sb.ToString(), new UTF8Encoding(false)); + // Atomic replace: other translators may be running `i18n check` over the same tree. + var temp = path + ".tmp"; + File.WriteAllText(temp, sb.ToString(), new UTF8Encoding(false)); + File.Move(temp, path, overwrite: true); } private static string Escape(string s) => s.Replace("&", "&", StringComparison.Ordinal).Replace("<", "<", StringComparison.Ordinal)