问题标签 [app-globalresources]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
asp.net - 使用 App_GlobalResources 在 ASP.NET MVC 4 中进行本地化
我正在尝试完成两件事:
- 本地化“FieldMustBeDate”和“FieldMustBeNumeric”的“内置”错误消息。
- 本地化您会遇到的其他一些错误消息,例如“PropertyValueRequired”。
通过使用http://forums.asp.net/t/1862672.aspx/1解决问题 1 和MVC 4 忽略问题 2 的 DefaultModelBinder.ResourceClassKey 我已经设法让两者都在本地工作。
但是,一旦我发布到网站,“内置”错误消息默认恢复为英文,而其他错误消息保持本地化。
我已经阅读了几个应该避免使用 App_GlobalResources 的地方,但是如果不使用它,我将无法完成问题 1。
我创建了一个名为“WebResources.resx”的 .resx 文件,将 Build Action 设置为“Embedded”,将 Copy to Output Directory 设置为“Do no Copy”,将 Custom Tool 设置为“PublicResXFileCodeGenerator”并设置 Custom工具命名空间到“资源”。项目本身设置为仅发布需要的文件。
我的 Global.asax.cs 包含以下(相关)代码:
MyRequiredAttributeAdapter 类包含以下代码:
这是在本地工作,但是有没有人知道如何让“内置”消息在发布后工作?
谢谢您的帮助!
最好的问候, 安德烈亚斯
silverlight-5.0 - 资源文件 en-US 未正确呈现
我有一个silverlight 应用程序支持英语、日语和法语。
我可以将日语更改为法语,将法语更改为日语,我尝试将法语加载为英语,将日语加载为英语,它只加载日语。
此问题仅存在于 Windows 7 JPN 环境中。为什么?如何克服这个问题?
注意:浏览器语言为 ja-JP。
asp.net-mvc-4 - 读取控制器内的全局资源文件
如何在 MVC 控制器中读取全局资源文件,我正在使用此代码但它不起作用
返回以下异常
无法加载文件或程序集“资源”或其依赖项之一。该系统找不到指定的文件。
我的应用程序是 MVC 4 和框架 4.5
请指教
c# - App_GlobalResources 来自我的类库中的 resx 文件
如何在运行时将我的类库中的 cystom resrouce 文件传输到我的 mvc Web 应用程序中的 App_GlobalResources 文件夹?
c# - 多语言 ASP.NET 网站不起作用
当我运行代码时,我收到这样的错误消息“已检测到不适用于集成托管管道模式的 ASP.NET 设置。”
然后我在 web.config 文件中找到了这样的解决方法:
现在该网站对我有用,但仅以俄语显示,而不是英语或希腊语。我是 ASP.NET 的新手,所以不清楚源的 LanguageModule 类,我应该以某种方式修改它吗?
javascript - 如何从 .resx 文件获取字符串到 .js 文件
我想以两种不同的语言显示警报消息。我正在使用 asp.net App_GlobalResources。我可以在我的 script.js 文件中使用它吗?
c# - ASP.NET global resources issue
I got an issue which already cost me some evenings to resolve. I migrated a ASP.NET Web Project to a Web Application.
My main issue are the .resx files below App_GlobalResources. Let's say that I have MyStrings.resx (= default culture) and MyStrings.en.resx (yes, english is not my default).
If I create the files in the solution in Solution Explorer with "Add...", I am getting the following settings: * Build Action: Content * Custom Tool: GlobalResourceProxyGenerator
I would guess that the default setting is fine for most cases but I already have two issues with that: a) If I leave the Build Action as "Content", I will get a MissingManifestResourceException when using ResourceManager.GetString in code. Solution: Change it to "EmbeddedResource". b) The GlobalResourceProxyGenerator seems to missing on my computer. If I choose "Run Custom Tool" on the .resx I get the error message "Cannot find custom tool '...' on this system. Great. Solution: Change it to "PublicResXFileCodeGenerator". This works.
Now, if I leave the setting at PublicResXFileCodeGenerator, everything compiles but when I run the solution (IIS and VS Express 2013 for Web) I get the friendly message that I got "Resources.MyStrings" both in MyWebSite.dll and in App_GlobalResources.dll.
OK, I change the Custom Tool to "ResXFileCodeGenerator". Now, everything's working fine. I am now deploying the solution to the webserver. There I get CS0122: Resources.MyStrings is inaccessible due to its protection level. That's probably due to it's "internal" declaration.
By now I am completely lost. Any help to clean up the situation?
Environment: IIS locally and online VS Express 2013 for Web Two languages. For both the settings are: Build Action: Embedded Resource Copy to Output Directory: Do not copy Custom Tool: ResXfileCodeGenerator Custom Tool Namespace: Resources
For the generated designer files (only default language) the settings are: Build Action: Compile Copy to Output Directory: Do not copy
Any help is appreciated
c# - 全球资源文件 asp.net
好的,下面的图片正在解释一切。
我还包括了进一步解释的代码。
错误信息:
mscorlib.dll 中出现“System.Resources.MissingManifestResourceException”类型的异常,但未在用户代码中处理
附加信息:找不到适合指定文化或中性文化的任何资源。确保“TodayTimesheet.App_GlobalResources.Lang.resources”在编译时正确嵌入或链接到程序集“TodayTimesheet”中,或者所有所需的附属程序集都是可加载的并且完全签名。
session - 登录页面中的会话或 Cookie = 主页面 = 子页面
我创建了一个多语言网站,我有一些文件:
- 登录页面。
- 母版页。
- 使用母版页的子页。
在login
页面中,我使用链接控件来按用户选择语言:
我使用BasePage.cs
代码:
所以在登录页面我使用:
使用 BasePage。
在这种形式中有一些我不能使用本地资源的项目,所以我使用了 2 个资源:global resource
和local resource
。但我不在乎,因为当我在链接中选择语言 - > 语言更改时,全局和本地资源也会更改。
现在,当我登录时,网站将重定向到使用母版页的页面。在母版页中,我为用户放置了一个下拉列表,以防他们再次更改语言:
在母版页中我添加:
和 :
在 global.asax 中是:
问题 1:如何使用会话或链接值的 cookie(在登录页面中)到母版页:ddlanguage 值 = session 或 lang 的 cookie?
现在,在子页面中使用母版页。我必须使用本地资源,因为如果使用全局资源,我必须使用<%$ Resources:nameresource, keysource%> ->
太慢。而且我有一个问题:在具有本地资源的子页面中,文化和 uiculture 值不取决于母版页中的 ddlanguage 值。
问题 2:如何在子页面中设置文化和 uiculture 值 = 母版页中的 ddlanguage 值。
结果是:使用该母版页的lang value in login page = ddlanguage
下拉值。但是可以更改母版页中的 ddlanguage 值,子页中的文化 uiculture 也会更改。master page = culture
uiculture in child page
and
我是编码方面的业余爱好者,所以我希望在我的情况下有解决方案。非常感谢(对不起我的英语)。
asp.net - 可再发行程序集中自定义控件的本地化
我正在尝试构建一个包含多个自定义控件(CommonControls)的可再发行程序集。 我的环境:MSVC 2010、ASP.NET (WebForms) .NET 2.0/3.0/3.5
问题:如果我通过App_GlobalResources 对CommonControls进行本地化,那么使用Web 部署项目编译所有内容都将不起作用。
以下是我构建CommonControls程序集的方式:
我使用包含 .ascx 和 .ascx.cs 文件的网站:
以及具有以下设置的Web 部署项目:
这将创建“CommonControls.dll”。该程序集将在不同的 ASP.NET WebApplication 中使用,如下所示:
网络配置:
第一个(次要)问题:将CommonControls添加为依赖项不会自动复制语言的附属程序集。手动将它们复制到正确的输出路径似乎可行(用于调试)。
主要问题:主要Web 应用程序也通过App_GlobalResources本地化并使用Web 部署项目构建:
该构建过程将失败
ASPNETCOMPILER:错误 ASPRUNTIME:对象引用未设置为对象的实例。
两个部署项目都创建了一个名为“bin\App_GlobalResources.compiled”的文件,我猜这两个文件不能在同一个输出项目中和平共存。
有没有使用 ASP.NET 内置本地化本地化CommonContols和Main的优雅解决方案?
注意:我正在处理的项目必须与 Apache+Mono 兼容,所以我的项目设置(上面的屏幕截图)必须完全像这样才能正常工作(已经测试了所有其他变体)。