English 中文(简体)
• 如何将多语文的档案列入单一的EXE?
原标题:How to embed multilanguage *.resx (or *.resources) files in single EXE?

有许多教学方法,如何创建多种语言的RESX文档以及如何与AL.exe建立卫星组件,但我没有发现如何把RESX/Resources/SAT-DL文件放在单一EXE档案中,并分发整个多语文参考资料,如EXE。

我试图使用il子,但像它一样,看看一看的是多德Ls的无工作(文化卫星DLs有相同的名称,最初居住在不同的文化子里)。

我也不知道如何创建资源管理小组,以利用内在资源开展工作。

我的目标是使封闭的、预先界定的一套语文能够动态地转换。 我需要获得文化扼杀(即“de-DE”)、资源名称(即“CancelText”)和基于 嵌入<>的回归译本。 页: 1

使用VS2008的Im,请说明需要用何种方式在树脂/资源档案中确定“开展行动”。 工作守则样本或与辅导项目的联系最好。

最佳回答

我的解决办法:方案仅包含一个缺省语言资源档案(resx)。 所有其他语文均编成文、资源及资源档案。 重要! 我改变了延期,因为“资源”被认为是一种特殊资源,因此,我的法国档案被称作“PIAE.LangResources.fr”。

这里是一部简单的法典,可以检索翻译版面(应当改进,从资源中调取分值):

    internal static string GetString(string str, string lang)
    {

        if (string.IsNullOrEmpty(str)) throw new ArgumentNullException("empty language query string");
        if (string.IsNullOrEmpty(lang)) throw new ArgumentNullException("no language resource given");

        // culture-specific file, i.e. "LangResources.fr"
        Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("PIAE.LangResources."+lang);

        // resource not found, revert to default resource
        if (null == stream)
        {                                                                   
            stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("PIAE.Properties.LangResources.resources");
        }

        ResourceReader reader = new ResourceReader(stream);
        IDictionaryEnumerator en= reader.GetEnumerator();
        while (en.MoveNext())
        {
            if (en.Key.Equals(str))
            {
                return en.Value.ToString();
            }
        }

        // string not translated, revert to default resource
        return LangResources.ResourceManager.GetString(str);
    }
问题回答

你没有发现,因为它不是这样。 NET框架行之有效。 NET预计卫星DLs将位于特定名称地点(系以其所含资源语言命名的名录)。 例de ,de-DE,chs,... 如果你不以这种方式工作,网络就能够运用其魔法(即按照目前的国际统一制度文化自动取回正确的资源:<代码>Thread.CurrentitiCulture)。





相关问题
How does gettext handle dynamic content?

In php (or maybe gettext in general), what does gettext do when it sees a variable to dynamic content? I have 2 cases in mind. 1) Let s say I have <?=$user1?> poked John <?=$user2?>. ...

Explain the Need for Mutexes in Locales, Please

Reading the question Why doesn’t C++ STL support atoi(const string& ) like functions?, I encountered a comment which warned that GCC (at least) has a bug that can slow down multi-threaded ...

How does Vistalizer work

How does Vistalizer manage to override the language limit in Windows Vista Home edition. Which api s does it use to allow installation of Multiple language packages.

Localized exceptions (within a Struts2 app)

I am developing a Struts 2 application with support for multiple languages. If one of the domain objects needs to throw an exception, how can it do so in such a way that the error message is no ...

Rails Globalize plugin help

Has anyone gotten the Globalize plugin to work Rails 2.3.2 or later? If so, could you direct me to some useful info?