diff --git a/I18N Commander/Processor/AppSettings.cs b/I18N Commander/Processor/AppSettings.cs index fc3e43f..5c177ae 100644 --- a/I18N Commander/Processor/AppSettings.cs +++ b/I18N Commander/Processor/AppSettings.cs @@ -268,6 +268,9 @@ public static class AppSettings public static async Task SetCultureCode(int index, string code) { + // Keep a copy of the previous name: + var previousCode = await AppSettings.GetCultureCode(index); + // Update the cache: CACHE_CULTURES[index] = code; @@ -297,6 +300,13 @@ public static class AppSettings // Update the list of cultures indices: CACHE_CULTURES_INDICES.Add(index); } + + // Next, we need to rename the culture inside all translations as well: + var translations = await db.Translations.Where(n => n.Culture == previousCode).ToListAsync(); + foreach (var translation in translations) + translation.Culture = code; + + await db.SaveChangesAsync(); } #endregion