public static void RegisterDictionary(CultureInfo cultureInfo, BaseLanguagePack dictionary) { if (!LocalizationService.RegisteredPacks.ContainsKey(cultureInfo)) { LocalizationService.RegisteredPacks.Add(cultureInfo, dictionary); } }
static BaseLanguagePack ResolveDictionary() { var dictionary = BaseLanguagePack.GetResources(LocalizationService.Current.Culture); if (dictionary == null) { throw new InvalidOperationException( $"Pack for language {LocalizationService.Current.Culture} was not found"); } return(dictionary); }
public static BaseLanguagePack GetResources(CultureInfo cultureInfo) { if (cultureInfo == null) { throw new ArgumentNullException(nameof(cultureInfo)); } if (!LocalizationService.RegisteredPacks.ContainsKey(cultureInfo)) { return(Null); } BaseLanguagePack dictionary = LocalizationService.RegisteredPacks[cultureInfo]; return(dictionary); }