mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2026-02-09 09:16:41 +08:00
#19010: Removing Html encoding when translating arguments
Work Item: 19010 --HG-- branch : 1.x
This commit is contained in:
@@ -11,7 +11,6 @@ namespace Orchard.Localization {
|
|||||||
private readonly IWorkContextAccessor _workContextAccessor;
|
private readonly IWorkContextAccessor _workContextAccessor;
|
||||||
private readonly ILocalizedStringManager _localizedStringManager;
|
private readonly ILocalizedStringManager _localizedStringManager;
|
||||||
|
|
||||||
|
|
||||||
public Text(string scope, IWorkContextAccessor workContextAccessor, ILocalizedStringManager localizedStringManager) {
|
public Text(string scope, IWorkContextAccessor workContextAccessor, ILocalizedStringManager localizedStringManager) {
|
||||||
_scope = scope;
|
_scope = scope;
|
||||||
_workContextAccessor = workContextAccessor;
|
_workContextAccessor = workContextAccessor;
|
||||||
@@ -30,7 +29,7 @@ namespace Orchard.Localization {
|
|||||||
|
|
||||||
return args.Length == 0
|
return args.Length == 0
|
||||||
? new LocalizedString(localizedFormat, _scope, textHint, args)
|
? new LocalizedString(localizedFormat, _scope, textHint, args)
|
||||||
: new LocalizedString(string.Format(GetFormatProvider(currentCulture), localizedFormat, args.Select(Encode).ToArray()), _scope, textHint, args);
|
: new LocalizedString(string.Format(GetFormatProvider(currentCulture), localizedFormat, args), _scope, textHint, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static IFormatProvider GetFormatProvider(string currentCulture) {
|
private static IFormatProvider GetFormatProvider(string currentCulture) {
|
||||||
@@ -41,12 +40,5 @@ namespace Orchard.Localization {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static object Encode(object arg) {
|
|
||||||
if (arg is IFormattable || arg is IHtmlString) {
|
|
||||||
return arg;
|
|
||||||
}
|
|
||||||
return HttpUtility.HtmlEncode(arg);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user