ASP.NET localization--where are the international resource strings?
I just started working on a new International project. All strings in the markup of ASPX pages are instead System.Web.UI.WebControls.Localize controls with "meta:resourcekey=" attributes. In the web root there's a App_LocalResources and in a App_GlobalResources, but the strings in all resource files are all English.
Where is the web site getting the International language-strings? 开发者_开发知识库Is there some built-in translator for ASP.NET? Where should I look to see the unicode foreign language characters?
There is no built in translator.
You should see resource files for each .aspx page in the App_LocalResources folder. For each .aspx file, there will be multiple resources files, one for each translation, with different file names like:
AddCustomer.aspx.resx
AddCustomer.aspx.fr.resx
AddCustomer.aspx.en-US.resx
etc. etc. Each file contains the translation for the culture given in the filename.
When you have a Page or User Control open in design view there's an option to localize off the Tools menu (I think). That'll create an App_LocalResources folder in whatever folder your currently working in. The App_LocalResources in the root will be for pages in the root of the website. App_GlobalResources is for your web.sitemap and any other resources you wish to use throughout the entire site.
I set up sub folders within App_LocalResources for each language.
For example, some pages:
Default.aspx Create.aspx View.aspx
-> App_LocalResources // folder
Default.aspx.resx // default language is picked up if browser's preferences not satisfied. Create.aspx.resx View.aspx.resx
--> DE// sub folder for german
Default.aspx.de.resx Create.aspx.de.resx View.aspx.de.resx
--> FR// sub folder for french
Default.aspx.fr.resx Create.aspx.fr.resx View.aspx.fr.resx
I've never had to do anything to specify a particular country's brand of a language (outside of displaying currenceis that is) but if you needed Austrian German say then you could do this.
--> DE-AT// sub folder for Austrian german
Default.aspx.de-AT.resx Create.aspx.de-AT.resx View.aspx.de-AT.resx
It's also possible that a custom resource provider has been created (this is the best thing to do when dealing with a largish site/program). There's an overview of resource providers here which might help you track down what's happen if the resx files are genuinely nowhere to be found.
精彩评论