diff --git a/BibleTalkAI.LanguageOptions/BibleTalkAI.LanguageOptions.csproj b/BibleTalkAI.LanguageOptions/BibleTalkAI.LanguageOptions.csproj index 16c2851..7a203d6 100644 --- a/BibleTalkAI.LanguageOptions/BibleTalkAI.LanguageOptions.csproj +++ b/BibleTalkAI.LanguageOptions/BibleTalkAI.LanguageOptions.csproj @@ -1,7 +1,7 @@  - 1.1.0 + 1.2.0 Types for language preference options for BibleTalkAI.com net8.0 enable diff --git a/BibleTalkAI.LanguageOptions/ILanguagePreferencesService.cs b/BibleTalkAI.LanguageOptions/ILanguagePreferencesService.cs new file mode 100644 index 0000000..bc1ca9d --- /dev/null +++ b/BibleTalkAI.LanguageOptions/ILanguagePreferencesService.cs @@ -0,0 +1,6 @@ +namespace BibleTalkAI.LanguageOptions; + +public interface ILanguagePreferencesService +{ + LanguagePreference? GetLanguagePreference(int languagePreferenceOption); +} diff --git a/BibleTalkAI.LanguageOptions/LanguagePreferencesService.cs b/BibleTalkAI.LanguageOptions/LanguagePreferencesService.cs new file mode 100644 index 0000000..0a746f1 --- /dev/null +++ b/BibleTalkAI.LanguageOptions/LanguagePreferencesService.cs @@ -0,0 +1,13 @@ +namespace BibleTalkAI.LanguageOptions; + +public class LanguagePreferencesService : ILanguagePreferencesService +{ + public LanguagePreference? GetLanguagePreference(int languagePreferenceOption) + { + if (LanguagePreferences.Languages.TryGetValue(languagePreferenceOption, out LanguagePreference? languagePreference)) + { + return languagePreference; + } + return null; + } +} diff --git a/BibleTalkAI.LanguageOptions/ServiceCollectionExtensions.cs b/BibleTalkAI.LanguageOptions/ServiceCollectionExtensions.cs new file mode 100644 index 0000000..229de0d --- /dev/null +++ b/BibleTalkAI.LanguageOptions/ServiceCollectionExtensions.cs @@ -0,0 +1,12 @@ +using Microsoft.Extensions.DependencyInjection; + +namespace BibleTalkAI.LanguageOptions; + +public static class ServiceCollectionExtensions +{ + public static IServiceCollection AddLanguagePreferencesService(this IServiceCollection services) + { + services.AddSingleton(); + return services; + } +}