开发者

Resource Files how to name them?

开发者 https://www.devze.com 2023-04-07 13:29 出处:网络
I am playing around with resource files and开发者_开发知识库 have run into a problem. I have a folder called Languages. When I make a resource file and say call it \"R.resx\" I can call this resource

I am playing around with resource files and开发者_开发知识库 have run into a problem.

I have a folder called Languages. When I make a resource file and say call it "R.resx" I can call this resource file up in my classes.

If I rename this file(or delete and make a new resource file) and call it R.en.resx I cannot call this resource file up in my class anymore.

Does the first language need to be in R.resx where the rest would be R.language.resx?


Step 6

To create resource files for additional languages, copy the file in Solution Explorer or in Windows Explorer, and then rename it using one of the following patterns:

For global resource files:

name.language.resx

name.language-culture.resx

For local resource files:

pageOrControlName.extension.language.resx

pageOrControlName.extension.language-culture.resx

So yes, you are correct in your assumption that the base resource file would be the first language.

EDIT:

var temp = Properties.Resources.ResourceManager.BaseName.Replace("YourNamespace.Properties.",""); 

You may have to also do this (to get rid of the language part after the name chunk):

 temp = temp.Replace(".thelanguagechunk","");

This code would get you the "name" chunk you are after by itself.

0

精彩评论

暂无评论...
验证码 换一张
取 消