/// <summary> /// Try to get the transalations based on <paramref name="header"/>. /// </summary> /// <remarks> /// Depending on the implementation of <see cref name="ILocalization"/> we might return translations based on a default locale if we can. /// </remarks> /// <param name="header">The Accept-Language header that will be used to get the translations.</param> /// <returns>The resulting translations for this <paramref name="header"/>. If no translations are not found for this <paramref name="header"/> the collection will be empty.</returns> public static async Task <Dictionary <string, string> > GetAllValuesAsync(this ILocalization localization, AcceptLanguageHeader header) { var translations = await localization.GetAllAsync(header).ConfigureAwait(false); if (translations is null == false && translations.Any() == true) { return(translations.ToDictionary(key => key.Result().Key, value => value.Result().Value)); } return(new Dictionary <string, string>()); }