资源文件如何命名呢? [英] Resource Files how to name them?

查看:436
本文介绍了资源文件如何命名呢?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我玩弄资源文件和所遇到的问题。

I am playing around with resource files and have run into a problem.

我有一个名为语言的文件夹。当我做一个资源文件,说把它称为R.resx我可以在我的类调用这个资源文件了。

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.

如果我重命名该文件(或删除,并作出新的资源文件),并调用它R.en.resx 我不能调用这个资源文件在我的课了。

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.

做的第一语言需要在R.resx,其中的其余部分将R.language.resx?

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

推荐答案

第6步

要创建资源文件,对其他语言,复制在Solution Explorer或Windows资源管理器的文件,然后使用下列模式之一将其重命名:

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.

编辑:

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","");

后,你是本身这个code会得到您的姓名大块。

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

这篇关于资源文件如何命名呢?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆