简体   繁体   English

使用asp.net resx来控制不同的字符串,但不能控制不同的语言

[英]Using asp.net resx to control different strings but not different languages

Generally I use resx to control language, a system in 2,3 different languages and it is OK. 通常,我使用resx来控制语言,这是一种使用2,3种不同语言的系统,没关系。 However, imagine I have only one language and 3 different companies using my system. 但是,假设我的系统只有一种语言和3家不同的公司。 Two of these companies use the word outsourced to define people who works to them and the other one uses the word collaborator. 这些公司中有两家使用外包这个词来定义为他们工作的人,而另一家则使用合作者这个词。 I was wondering if it is possible to make a label text be shown as Outsourced if it is from company x and y and Collaborator if it is from company z. 我想知道是否可以使标签文本显示为“外包”(如果来自x和y公司,而协作者是否来自z)。 Can I use resx to control it? 我可以使用resx来控制它吗?

Just need to add a resource file to the App_GlobalResources folder, then in your code call GetGlobalResourceObject("MyResourceName", "MyResourceKey"); 只需要将资源文件添加到App_GlobalResources文件夹,然后在您的代码中调用GetGlobalResourceObject(“ MyResourceName”,“ MyResourceKey”);

eg: 例如:

return (String)GetGlobalResourceObject(ResourceName, Key); 返回(String)GetGlobalResourceObject(ResourceName,Key);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM