Fixed translations when rename cultures
This commit is contained in:
parent
6e8eb493e0
commit
9023a6d7b7
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user