关于本地化资源 [英] Regarding Resources in Localization
问题描述
您好,我是C#的新手,并在Localization中使用资源.我的查询是:
如果我的应用程序中有一些本地资源和全局资源.假设如果我的App_LocalResources
文件夹中没有特定语言的资源,应用程序会为该语言资源寻找App_GlobalResource
文件夹吗?
例如:
Hi, I am pretty new to C# and using resources in Localization. My query is :
If I have some Local Resources and Global resources in my application. Suppose If i don''t have a resource in my App_LocalResources
folder for particular language, Will the application look for App_GlobalResource
folder for that language resource ?
For example :
App_GlobalResources folder :
Myweb.en-US.resx
Myweb.hi-IN.resx
App_LocalResources folder :
Myweb.en-US.resx
Myweb.hi-IN.resx
假设如果App_LocalResources文件夹中缺少我的印地语resx文件,如果App_LocalResource文件夹中缺少resx文件,是否可以使应用程序查找APP_GlobalResource的文件夹?如果可能的话,我们该怎么做?
预先谢谢您.
Suppose if my hindi-Indian resx file will be missing in App_LocalResources folder,,, Is it possible, to make the application look for APP_GlobalResource ''s folder if the resx file is missing in App_LocalResource folder ? If it''s possible, how can we do that ?
Thank you in advance.
推荐答案
它不会查看Global资源,也不会查看.在这种情况下,全局"是指应用程序的全局变量(适用于跨页面等),而不是全局语言环境.
规则是它遍历树:
例如
Foo.resx(默认-可以说英语)
Foo.hi.resx(默认印地文)
Foo.hi-IN.resx(印地语"印地语,不确定是否还有其他形式,但这就是它!)
假设您访问一个名为Foo
的值,并且您的区域性设置为hi-IN.首先,它将查看印度印地语,然后是通用印地语,然后是默认印地语.因此,要做的就是在基本Foo.resx文件中使用默认语言(例如,美式英语),然后将其本地化为不同的方言(例如,英式英语).然后为印地语(可能是印地语"印地语)添加断言,然后再对印地语方言进行本地化.这应该涵盖了几乎所有情况,并且您应该能够重构现有本地机制中必须执行的操作.
希望这能完全回答您的问题!
It won''t look at the Global resources, nor should it. "Global" in this context means global to the application (available to across pages etc) rather than a global locale.
The rule is it traverses up the tree:
e.g.
Foo.resx (default - lets say english)
Foo.hi.resx (default hindi)
Foo.hi-IN.resx ("Indian" hindi, not sure what other forms there are, but this is it!)
Let''s say you access a value calledFoo
and your culture is set to hi-IN. First it will look at the Indian Hindi, then just the generic Hindi, then the default. So the thing to do is have the default language (e.g. American English) in the base Foo.resx file, then localize it for different dialects (e.g. British English). Then add a deafault for Hindi (probably "Indian" hindi, then localize further for Hindi dialects). This should cover pretty much all circumstances and you should be able to re-factor what you have to do what you want in the existing local mechanism.
Hope this answers your question fully!
这篇关于关于本地化资源的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!