/// <summary> /// Try to get the transalation based on <paramref name="locale"/>. If it the <paramref name="key"/> is missing we are returning <paramref name="fallbackValue"/>. /// </summary> /// <remarks> /// Depending on the implementation of <see cref name="ILocalization"/> we might return a translation based on a default locale if we can. /// </remarks> /// <param name="key">The translation key that will be used to get the translation.</param> /// <param name="locale">The local that will be used to get the translation.</param> /// <param name="fallbackValue">The fallback value that we are going to return if we do not find the specified <paramref name="key"/> and there is no default locale.</param> /// <returns>The resulting translation.</returns> public static async Task <string> GetValueAsync(this ILocalization localization, string key, string locale, string fallbackValue) { string result = fallbackValue; var translation = await localization.GetAsync(key, locale).ConfigureAwait(false); if (translation.Found == true) { result = translation.Result().Value; } return(result); }