public static string Translate(this Application application, string id, StartCaseType startCase, CultureInfo cultureInfo, params object[] args) { if (application == null) { throw new ArgumentNullException(nameof(application)); } if (string.IsNullOrWhiteSpace(id)) { throw new ArgumentNullException(nameof(id)); } if (cultureInfo == null) { throw new ArgumentNullException(nameof(cultureInfo)); } var result = ResourceManager.GetString(id, cultureInfo) ?? id; if (startCase == StartCaseType.LowerCase) { var resultStart = char.ToLowerInvariant(result[0]); if (result.Length == 1) { return(resultStart.ToString()); } result = resultStart + result.Substring(1); } if (args != null && args.Any()) { result = string.Format(result, args); } return(result); }
public static string Translate(this Application application, string id, StartCaseType startCase, params object[] args) { return(Translate(application, id, startCase, CultureInfo.CurrentUICulture, args)); }