using System; using System.Globalization; namespace Abp.Localization.Sources { /// /// Extension methods for . /// public static class LocalizationSourceExtensions { /// /// Get a localized string by formatting string. /// /// Localization source /// Key name /// Format arguments /// Formatted and localized string public static string GetString(this ILocalizationSource source, string name, params object[] args) { if (source == null) { throw new ArgumentNullException("source"); } return string.Format(source.GetString(name), args); } /// /// Get a localized string in given language by formatting string. /// /// Localization source /// Key name /// Culture /// Format arguments /// Formatted and localized string public static string GetString(this ILocalizationSource source, string name, CultureInfo culture, params object[] args) { if (source == null) { throw new ArgumentNullException("source"); } return string.Format(source.GetString(name, culture), args); } } }