Asp.Net身份本地化PublicKeyToken [英] Asp.Net Identity Localization PublicKeyToken

查看:139
本文介绍了Asp.Net身份本地化PublicKeyToken的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图通过使用这篇文章的建议来获取瑞典语Asp.Net Identity的本地化错误消息:如何本地化ASP.NET Identity UserName和密码错误消息?

I'm trying to get localized error messages for Swedish for Asp.Net Identity by using advice from this post: How to localize ASP.NET Identity UserName and Password error messages?

使用NuGet我下载了德语语言包,然后在dotPeek中打开\packages\Microsoft.AspNet.Identity.Core.2.0.0\lib\\\
et45\de\Microsoft.AspNet.Identity.Core.resources.dll,然后将其导出到一个新的VS项目:

Using NuGet I downloaded the German language pack and then opened \packages\Microsoft.AspNet.Identity.Core.2.0.0\lib\net45\de\Microsoft.AspNet.Identity.Core.resources.dll in dotPeek and then exported this to a new VS project:

https:/ /github.com/nielsbosma/AspNet.Identity.Resources.Swedish/

我已经复制了生成的\Microsoft.AspNet.Identity.Core。 resources.dll到\packages\Microsoft.AspNet.Identity.Core.2.0.0\lib\\\
et45\se下的新文件夹。

I've copied the generated \Microsoft.AspNet.Identity.Core.resources.dll to a new folder under \packages\Microsoft.AspNet.Identity.Core.2.0.0\lib\net45\se.

当一世 在本地运行我的站点我看到Microsoft.AspNet.Identity.Core.resources.dll已被复制到MySite\bin\sv\

When I run my site locally I see that Microsoft.AspNet.Identity.Core.resources.dll has been copied to MySite\bin\sv\

但我可以' (

如果我设置在我的Web.config中:

If I set in my Web.config:

<system.web>
    ...
    <globalization culture="sv-SE" uiCulture="sv" />
</system.web>

我仍然会收到英文的默认错误消息。但是,如果我更改为从NuGet中包含的德国人,我会收到德国的错误消息。

I still get english default error messages. But if I change to german that I've included from NuGet I get german error messages.

使用dotPeek我已经将我的dll与德国人进行了比较,他们是一样的除了我的PublicKeyToken = null和德国的一个是31bf3856ad364e35。这可能是为什么我不能让我的dll加载?有没有为一个dll设置一个PublicKeyToken?任何解决方法?

Using dotPeek I've compared my dll with the german and they are the same except my has PublicKeyToken=null and the one for german is "31bf3856ad364e35". Could this be why I can't get my dll to load? Is there anyway to set a PublicKeyToken for a dll? Any workaround?

感谢任何指针。

推荐答案

除非您具有Microsoft用于签署dll的私钥。

Not unless you have the private key that Microsoft uses to sign dlls.

更新:作为一种解决方法,直到我们添加对自己的资源插件的支持,您可能只需使用显式切换来包装所有默认身份结果错误消息,那么应该只有大约10-20个用户面临的错误

Updated: as a workaround until we add support for plugging in your own resources, you can probably just wrap all the default identity result error messages with an explicit switch for now, there should only be about 10-20 user facing errors.

某些东西:

public static string Localize(string error) {
     switch (error) {
          case "<english error>": return "<localized version";
     }
}

这篇关于Asp.Net身份本地化PublicKeyToken的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆