0
marklin created
now:
new MenuItemDefinition(
"Home",
L("HomePage"), // DisplayName
url: "",
icon: "fa fa-home",
requiresAuthentication: true
)
after use Extension Methods
new MenuItemDefinition(
"Home",
"HomePage", //remove the L function
url: "",
icon: "fa fa-home",
requiresAuthentication: true
)
And
this.DisplayName = displayName.toLocalLanguage();
1 Answer(s)
-
0
Hi,
There are 2 problems with this code:
- It's not explicit if given string will be localized or not.
- Extension methods are static. So, we can not resolve ILocalizationManager (<a class="postlink" href="http://www.aspnetboilerplate.com/Pages/Documents/Localization#DocInServer">http://www.aspnetboilerplate.com/Pages/ ... ocInServer</a>) from dependency injection. We shouldn't use IocManager.Instance (<a class="postlink" href="http://www.aspnetboilerplate.com/Pages/Documents/Dependency-Injection#DocIocHelper">http://www.aspnetboilerplate.com/Pages/ ... cIocHelper</a>) since it breaks testability.