diff --git a/src/PillsBot/PillsBot.Server/TextGeneration/AzureOpenAIMessageProvider.cs b/src/PillsBot/PillsBot.Server/TextGeneration/AzureOpenAIMessageProvider.cs index a3051c5..1ab6618 100644 --- a/src/PillsBot/PillsBot.Server/TextGeneration/AzureOpenAIMessageProvider.cs +++ b/src/PillsBot/PillsBot.Server/TextGeneration/AzureOpenAIMessageProvider.cs @@ -72,7 +72,7 @@ public AzureOpenAIMessageProvider(IOptions options, _languages = options.Value.AI.Languages .Split(',', StringSplitOptions.TrimEntries | StringSplitOptions.RemoveEmptyEntries) - .Select(input => (code: input, name: GetISOLanguageName(input))) + .Select(input => (code: input, name: GetLanguageName(input))) .Where(pair => pair.name is not null) .ToDictionary(pair => pair.code, pair => pair.name!) .AsReadOnly(); @@ -151,12 +151,12 @@ private string GetPrompt(string language) return message; } - private string? GetISOLanguageName(string input) + private string? GetLanguageName(string input) { try { var culture = CultureInfo.GetCultureInfo(input, true); - return culture.TwoLetterISOLanguageName; + return culture.DisplayName; } catch (CultureNotFoundException exception) {