久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

    <tfoot id='K5OaC'></tfoot>
  1. <legend id='K5OaC'><style id='K5OaC'><dir id='K5OaC'><q id='K5OaC'></q></dir></style></legend>
    <i id='K5OaC'><tr id='K5OaC'><dt id='K5OaC'><q id='K5OaC'><span id='K5OaC'><b id='K5OaC'><form id='K5OaC'><ins id='K5OaC'></ins><ul id='K5OaC'></ul><sub id='K5OaC'></sub></form><legend id='K5OaC'></legend><bdo id='K5OaC'><pre id='K5OaC'><center id='K5OaC'></center></pre></bdo></b><th id='K5OaC'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='K5OaC'><tfoot id='K5OaC'></tfoot><dl id='K5OaC'><fieldset id='K5OaC'></fieldset></dl></div>

      <small id='K5OaC'></small><noframes id='K5OaC'>

        <bdo id='K5OaC'></bdo><ul id='K5OaC'></ul>

      C# 本地化和資源文件

      C# Localization and Resource Files(C# 本地化和資源文件)

      <legend id='AfMgw'><style id='AfMgw'><dir id='AfMgw'><q id='AfMgw'></q></dir></style></legend>
    1. <small id='AfMgw'></small><noframes id='AfMgw'>

        <bdo id='AfMgw'></bdo><ul id='AfMgw'></ul>
          <tbody id='AfMgw'></tbody>

            • <i id='AfMgw'><tr id='AfMgw'><dt id='AfMgw'><q id='AfMgw'><span id='AfMgw'><b id='AfMgw'><form id='AfMgw'><ins id='AfMgw'></ins><ul id='AfMgw'></ul><sub id='AfMgw'></sub></form><legend id='AfMgw'></legend><bdo id='AfMgw'><pre id='AfMgw'><center id='AfMgw'></center></pre></bdo></b><th id='AfMgw'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='AfMgw'><tfoot id='AfMgw'></tfoot><dl id='AfMgw'><fieldset id='AfMgw'></fieldset></dl></div>
              • <tfoot id='AfMgw'></tfoot>
                本文介紹了C# 本地化和資源文件的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                問題描述

                我正在嘗試在我的應用程序中進行本地化.我的解決方案中有名為ui.resx"和ui.de.resx"的 ui 資源文件.但是,我的實現(xiàn)中有些地方是不正確的,我很難過.

                I'm trying to get localization working in my application. I have my ui resource files, named "ui.resx" and "ui.de.resx" in my solution. However, something in my implementation is incorrect, and I'm stumped.

                ResourceManager res_man;
                CultureInfo culture;
                string exception;
                
                private void myForm_Load(object sender, EventArgs e)
                {
                    culture = CultureInfo.CreateSpecificCulture("de");
                    res_man = new ResourceManager("MyApp.ui.resx", typeof(myForm).Assembly);
                    doTheThing();
                }
                
                private void doTheThing()
                {
                    try
                    {
                        BTN_save.text = ui.SAVE;
                        //Do code here
                    }
                    catch(Exception e)
                    {
                        exception = e.toString();
                    }
                }
                

                當我運行程序時,它會出錯并顯示異常:

                When I run the program, it errors out and exception reads:

                異常:System.Resources.MissingManifestResourceException:找不到適合指定區(qū)域性或中性區(qū)域性的任何資源.確保ui.resx.resources"在編譯時正確嵌入或鏈接到程序集myProgram"中,或者所需的所有附屬程序集都是可加載的且完全簽名的."

                "Exception: System.Resources.MissingManifestResourceException: Could not find any resources appropriate for the specified culture or the neutral culture. Make sure "ui.resx.resources" was correctly embedded or linked into assembly "myProgram" at compile time, or that all the satellite assemblies required are loadable and fully signed."

                推薦答案

                你應該使用你的類的全名(帶命名空間)作為第一個參數(shù),比如:

                You should use the full name (with namespace) of your class as first parameter lik:

                var resman= new ResourceManager("Sample.Resources", typeof(Resources).Assembly);
                

                要知道應該使用什么名稱,請打開 ui.resx 節(jié)點下的 ui.cs 并查看類的命名空間和類名并使用它們?nèi)缟蠄D.

                To know what name you should use, open ui.cs under the ui.resx node and look at the namespace of the class and the class name and use them as shown above.

                注意不要傳"MyApp.ui.resx",而是傳"MyApp.ui"

                然后您可以簡單地使用管理器來獲取特定文化的資源,如下所示:

                Then you can simply use the manager to get a resource for specific culture like this:

                var str = resman.GetString("YourResourceKey", culture);
                

                注意:

                您應該注意的另一件事是,閱讀特定文化資源的方法更簡單.您可以簡單地設置:

                Another thing you should notice, there is more simple way to read culture specific resources. You can simply set :

                var culture= ...    
                
                System.Threading.Thread.CurrentThread.CurrentUICulture = culture;
                System.Threading.Thread.CurrentThread.CurrentCulture = culture;
                

                設置文化后,無論您在何處使用,例如 MyApp.Ui.Key,都將使用特定于該文化的 Key 的值.

                After setting culture, wherever you use for example MyApp.Ui.Key the value of the Key specific to that culture will be used.

                這篇關(guān)于C# 本地化和資源文件的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

                【網(wǎng)站聲明】本站部分內(nèi)容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請聯(lián)系我們刪除處理,感謝您的支持!

                相關(guān)文檔推薦

                Ignore whitespace while reading XML(讀取 XML 時忽略空格)
                XML to LINQ with Checking Null Elements(帶有檢查空元素的 XML 到 LINQ)
                Reading XML with unclosed tags in C#(在 C# 中讀取帶有未閉合標簽的 XML)
                Parsing tables, cells with Html agility in C#(在 C# 中使用 Html 敏捷性解析表格、單元格)
                delete element from xml using LINQ(使用 LINQ 從 xml 中刪除元素)
                Parse malformed XML(解析格式錯誤的 XML)
                  • <i id='h9RCK'><tr id='h9RCK'><dt id='h9RCK'><q id='h9RCK'><span id='h9RCK'><b id='h9RCK'><form id='h9RCK'><ins id='h9RCK'></ins><ul id='h9RCK'></ul><sub id='h9RCK'></sub></form><legend id='h9RCK'></legend><bdo id='h9RCK'><pre id='h9RCK'><center id='h9RCK'></center></pre></bdo></b><th id='h9RCK'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='h9RCK'><tfoot id='h9RCK'></tfoot><dl id='h9RCK'><fieldset id='h9RCK'></fieldset></dl></div>

                    • <bdo id='h9RCK'></bdo><ul id='h9RCK'></ul>
                        <tbody id='h9RCK'></tbody>
                      <tfoot id='h9RCK'></tfoot><legend id='h9RCK'><style id='h9RCK'><dir id='h9RCK'><q id='h9RCK'></q></dir></style></legend>
                    • <small id='h9RCK'></small><noframes id='h9RCK'>

                          主站蜘蛛池模板: 国产在线精品一区二区三区 | 国产精品久久久久久久久久久久午夜片 | 黄网站涩免费蜜桃网站 | 97影院2| 国产伦精品一区二区三区视频金莲 | 国产午夜精品久久久久 | 中文字幕精品一区久久久久 | 国产欧美一区二区三区日本久久久 | 亚洲午夜视频在线观看 | 日日摸夜夜添夜夜添精品视频 | 午夜专区 | 欧美一区二区三区大片 | 成人免费三级电影 | 国产成人99久久亚洲综合精品 | 成人福利网 | 欧美一级大片免费看 | 黄片毛片免费观看 | 免费观看一级毛片视频 | 国产精品久久久久无码av | 亚洲一区不卡 | 欧美日韩精品一区二区三区四区 | 国产精品毛片一区二区三区 | 成人午夜性成交 | 免费视频色 | 久久精品中文 | 91精品国产自产精品男人的天堂 | 日韩激情在线 | 一区二区免费 | 精品国产精品国产偷麻豆 | 可以免费看的毛片 | 国产免费一区二区 | 国产精品视频久久久久久 | www.久草.com | a级性视频 | 国产偷录视频叫床高潮对白 | 91超碰caoporn97人人 | 欧美激情在线精品一区二区三区 | 欧美性tv | 亚洲欧美日韩久久 | 91精品国产综合久久香蕉922 | www国产成人免费观看视频,深夜成人网 |