我试图本地化托管C ++ .NET的DLL多国语言。该形式是很容易的,因为他们经营就像其他语言和创建多个.resx文件。
I am trying to localize a managed C++ .NET DLL for multiple languages. The forms are easy enough because they operate just like the other languages and create multiple .resx files.
我找不到定位在托管C ++中嵌入字符串的任何实例,而不是使用.RC字符串表中的传统C ++的方式等。有没有办法使用的.resx资源文件,以方便与资源编辑器一样使用泽塔等?
I cannot find any examples of localizing embedded strings in managed C++, other than to use .RC string tables in the traditional C++ way. Is there any way to use .resx resource files to facilitate use with resource editors like Zeta, etc?
在创建托管C单独的资源文件++包含应用程序的所有错误信息。要做到这一点,在托管C ++项目在Solution Explorer中右键单击并添加/新项目类型集资源文件中(的.resx)。给它的名字MyMessages.resx为例。
Create a separate resources file in managed C++ containing all the error messages of the application. To do that, right-click on your managed C++ project in the solution explorer and Add / New Item of type Assembly Resource File (.resx). Give it the name MyMessages.resx for example.
添加您的字符串出现,例如邮件名称为错误。
Add your strings there, for example a message with the name "Error".
在你的code可以检索字符串如下,假设你的根命名空间名称为MyApp的。
In your code you can retrieve the string as follows, assuming that your root namespace name is "MyApp".
Resources::ResourceManager^ rm = gcnew Resources::ResourceManager(L"MyApp.MyMessages", this->GetType()->Assembly);
MessageBox::Show(rm->GetString(L"Error"));
您可以稍后在法国为例,通过创建另一个集资源文件的名称MyMessages.fr.resx本地化的错误消息。
You can later localize your error messages in French for example, by creating another Assembly Resource File with the name MyMessages.fr.resx.