diff --git a/I18N Commander/Processor/AppSettings.cs b/I18N Commander/Processor/AppSettings.cs index 5d07220..8951fd2 100644 --- a/I18N Commander/Processor/AppSettings.cs +++ b/I18N Commander/Processor/AppSettings.cs @@ -233,7 +233,7 @@ public static class AppSettings await using var db = ProcessorMeta.ServiceProvider.GetRequiredService(); // Count the number of cultures: - var count = await db.Settings.CountAsync(n => n.Code == SettingNames.CULTURE); + var count = await db.Settings.CountAsync(n => n.Code.StartsWith(SettingNames.CULTURE)); // We have at least one default culture: if(count == 0) @@ -263,7 +263,7 @@ public static class AppSettings await using var db = ProcessorMeta.ServiceProvider.GetRequiredService(); // Get the culture code: - var code = await db.Settings.FirstOrDefaultAsync(n => n.Code == SettingNames.CULTURE && n.IntegerValue == index); + var code = await db.Settings.FirstOrDefaultAsync(n => n.Code.StartsWith(SettingNames.CULTURE) && n.IntegerValue == index); // When the culture code is not set & index = 1, use the default culture en-US: if(code is null && index == 1) @@ -291,7 +291,7 @@ public static class AppSettings await using var db = ProcessorMeta.ServiceProvider.GetRequiredService(); // Check, if the setting is already set: - if (await db.Settings.FirstOrDefaultAsync(n => n.Code == SettingNames.CULTURE && n.IntegerValue == index) is {} existingSetting) + if (await db.Settings.FirstOrDefaultAsync(n => n.Code.StartsWith(SettingNames.CULTURE) && n.IntegerValue == index) is {} existingSetting) { existingSetting.TextValue = code; await db.SaveChangesAsync(); @@ -302,7 +302,7 @@ public static class AppSettings { var setting = new Setting { - Code = SettingNames.CULTURE, + Code = $"{SettingNames.CULTURE} {index}", IntegerValue = index, TextValue = code, };