fix(i18n): replace resx files atomically on import
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012iLMBNwBE2GnphAsu4cjaC
This commit is contained in:
1 file changed
+4
-1
@@ -209,7 +209,10 @@ internal sealed partial class I18nCommand : ICommand
|
||||
foreach (var (key, value) in values)
|
||||
sb.Append($" <data name=\"{Escape(key)}\" xml:space=\"preserve\"><value>{Escape(value)}</value></data>\n");
|
||||
sb.Append("</root>\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)
|
||||
|
||||
Reference in new issue
Block a user