• <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>

            Welcome to ErranLi's Blog!

              C++博客 :: 首頁 :: 聯系 :: 聚合  :: 管理
              106 Posts :: 1 Stories :: 97 Comments :: 0 Trackbacks

            常用鏈接

            留言簿(12)

            搜索

            •  

            積分與排名

            • 積分 - 175253
            • 排名 - 151

            最新評論

            閱讀排行榜

            原文:http://dev.csdn.net/article/23/23538.shtm
            作者: ?????

            這應該是一個使用VC的一個小技巧,不過在打算做之前,在網上找了找,沒有找到(可能是我填入的關鍵字不對,:-)),所以在這里給大家提供一個參考,希望對大家能提供方便,不用象我找的這么辛苦。

            意圖:實現多種語言在同一個工程里,如果調試成功后,即可以同時編譯程序的多種語言版本。

            平臺:Win2000 Pro SP4, VC++6.0,SDK

            一般情況下,編寫程序都會使用工程制作向導,生成的工程有兩個編譯版本,一個是Debug,另外一個就是Release,我的目的就是添加多種語言的編譯版本,同時需要多種語言的.rc文件(Source文件),然后經過一些簡單的設置,就Okay了。

            ?????? 我添加很多的圖片,這樣比較容易理解,也少去讀文字的痛苦(用電腦看大篇大篇的文字真的很痛苦)。

            ? 下面我們開始:

            ? 1. 首先是以工程文件里的.rc文件為基礎,制作多種語言的.rc文件,就是把有關對話框,屬性頁,以及一些ID文字替換為其他的語言文字,這里需要注意的 是,不同語言版本的.rc文件,包含很多相同的圖標(Icon),對話框(Dialog),String Table,在VC編譯器的SourceView里都要選擇相應的語種。比如:如果是English,以上說的這些都要選擇English(U.S.)。

            ? 2. 添加多語言編譯版本,選擇Build->Configurations,點擊Add,添加相應的語言編譯版本,我這里添加的是English Release。隨后添加多種語言版本。

            添加多種語言的編譯版本


            ? 3. 編輯不同語言版本的Project Setting。點擊菜單Project->Settings,修改相應的設置
            設置Output directories: 包括Intermediate和Output files,我這里都設置為English Release
            設置Output file name: 我這里設置為English_Release/ktrexe.exe

            設置
            Language英語(美國)?????

            ?

            4. 添加Source Files

            ?

            添加后會彈出一個對話框,不用理會它

            此時你可以在你編譯器的ResourceView里看到:

            ?

            以后如果需要修改不同的語言,可以修改相應的resources文件。


            5. 點擊Project->Settings,點擊你所點擊的.rc文件

            ?

            選中Exclude file from build

            ?

            選擇“是”,每一種.rc文件分別選取相應的語言編譯版本,比如Win32 English Release,選擇Winapp1_English.rc,然后在Exclude file from build打勾即可。

            ?

            6. 編譯:

            選擇Build->Batch Build

            ?

            選中您所要編譯的語種,選中Selection only,點擊Rebuild All即可。

            ?

            7. 此時,您可以看到您的.dsp文件已經被修改。

            ?

            ?????? 我曾經在CSDN論壇上問過此問題,還有不同的解法,我把他們帖出來:

            ?

            ??? 我的操作是在VC++6.0里有一個用Win32程序向導生成的一個工程,此工程代碼添加,調試,運行都已經Okay

            ??? 由于該工程是簡體中文的,我想添加其他的語言版本,我就在.rc復本的基礎上把簡體中文的項目換成了其他的語言(比如西班牙語),然后我在Build->Configurations里添加了Spanish Release,在Project-Settings里設置了語言環境,輸入路徑等等屬性。隨后我就在Project-Add Files添加我剛才更換語言的.rc文件添加進來。

            ??? 目的是用Debug調試,然后在Build-Batch Build選項里選擇我要編譯的語言種類,一次編譯多種語言。

            ??? 問題是VC6.0提示說“Multiple.rc files exist in this project. Only one can be marked as included in the build. The others will be excluded frome the build.

            ??? 請問,如何解決這個問題,我在網上找了兩天了,在其他的Newsgroups上法帖,沒有找到答案,是不是我哪里設置錯了,請高手給個提示。謝謝!

            ?

            把你現在的.rc保存,然后把所有的中文換成其他語言,別存為其他other.rc。

            GetResourceInstance()得到資源句柄。換成另other.rc,(SetResourceHandle)

            就可以搞定。

            因為所有的id沒變,所有程序都能正常運行。

            最好把資源做成dll,LoadResource切換

            寫成INI也是一個好辦法!

            ?

            其他論壇的回答:

            Several solutions:
            1. Place all your resources into one big. rc file.
            2. Exclude the additional rc files from the build and include them by the
            resource includes (right mouse click on the resource file in the resource
            editor). In this case you have to take care that bitmaps and others are only
            included once!
            3. Create seperate DLL's for each language and use the corresponding handle
            to this DLL when loading resources. Read the docu to AfxSetResourceHandle
            when you are using the MFC.

            1)????? use the "resource includes" menu item in VC C++ 6.0 and include one
            resource in the other (i.e. #include "file.rc")? Make sure that there are no
            conflicts and each resource is properly marked with the correct language.
            Mark the RC file as excluded from the build.? It will get built anyway since
            it was included in the main RC.

            2)????? have separate DLL (i.e. a separate sub-project) for each RC file (the
            satellite DLL approach to localization)

            If you are unhappy with having separate builds for each language then
            you'll have to combine the .rc files with (or without if they doesn't use
            same identifiers) the proper LANGUAGE ID #ifdef's. If you don't know
            about these, use the Resource editor built into the Environment to create
            a new .rc with element variants in several languages. Then open the file
            and analyse it.

            In VS.NET 2003 click on Build>Configuration Manager
            You will find your project. Now it is possible to select New in the combo
            "Active Solution Configuration" you can add new settings to the current ones
            Debug/Release.
            In VS6 click on Build->Configurations. You will find your project displayed
            as a tree. Click on Add to add new configurations.
            In both caes you will be asked what base configuratin should be copied.

            Now you can create different Release modes like German/English/Bavarian and
            so on...
            For each configuration you can define diffrent rc files to be excluded from
            the build. Also you can define different output directories.

            The disadvantage is that you always have a complete binary for a language
            and you can not switch the language on user request!

            ?

            ?

            如果有問題,請和我聯系:danielxu22@cellink.com.cn

            posted on 2007-10-13 21:24 erran 閱讀(1159) 評論(1)  編輯 收藏 引用 所屬分類: MFC

            Feedback

            # re: 轉:如何在同一個工程里添加多種語言 2009-03-07 09:10 岳陽
            思路明白了。哈哈  回復  更多評論
              

            99精品国产在热久久| 2021国产精品久久精品| 91视频国产91久久久| 97久久综合精品久久久综合| 久久人人爽人人爽人人片AV不| 久久99国产精一区二区三区| 免费一级做a爰片久久毛片潮| 久久婷婷国产剧情内射白浆| 2022年国产精品久久久久| 精品久久久久久无码中文字幕| 亚洲婷婷国产精品电影人久久 | 久久久久国色AV免费观看| 欧美日韩精品久久久免费观看| 国产韩国精品一区二区三区久久| 精品国产综合区久久久久久| 人妻无码αv中文字幕久久| 久久伊人五月天论坛| 久久精品九九亚洲精品天堂| 东方aⅴ免费观看久久av| 久久精品无码一区二区app| 国产精品99久久99久久久| 一本综合久久国产二区| 精品人妻伦一二三区久久| 999久久久无码国产精品| 亚洲AV日韩精品久久久久久久| 精品久久久无码中文字幕天天| 91久久婷婷国产综合精品青草 | 久久99精品久久久久久野外| 香蕉久久夜色精品升级完成| 久久99精品久久久久久9蜜桃 | 久久久久亚洲精品无码网址| 久久91精品国产91久久户| 国产V亚洲V天堂无码久久久| 久久精品国产亚洲AV不卡| 性高湖久久久久久久久AAAAA| 夜夜亚洲天天久久| 丁香久久婷婷国产午夜视频| 88久久精品无码一区二区毛片 | 亚洲色欲久久久综合网东京热| 伊人伊成久久人综合网777| 一97日本道伊人久久综合影院|