/// <summary>Converts a quadruplet (type, context, format, args) to a single
/// string containing all that information. The format string and the Severity
/// are localized with <see cref="Localize.Localized(string, object[])"/>.</summary>
/// <remarks>For example, <c>FormatMessage(Severity.Error, "context", "Something happened!")</c>
/// comes out as "Error: context: Something happened!".</remarks>
public static string FormatMessage(Severity type, object context, string format, params object[] args)
{
string loc = ContextToString(context);
string formatted = Localize.Localized(format, args);
if (string.IsNullOrEmpty(loc))
{
return(type.ToString().Localized() + ": " + formatted);
}
else
{
return(loc + ": " +
type.ToString().Localized() + ": " + formatted);
}
}