• <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++博客 :: 首頁(yè) :: 聯(lián)系 :: 聚合  :: 管理
              106 Posts :: 1 Stories :: 97 Comments :: 0 Trackbacks

            常用鏈接

            留言簿(12)

            搜索

            •  

            積分與排名

            • 積分 - 175922
            • 排名 - 151

            最新評(píng)論

            閱讀排行榜

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

            這應(yīng)該是一個(gè)使用VC的一個(gè)小技巧,不過(guò)在打算做之前,在網(wǎng)上找了找,沒(méi)有找到(可能是我填入的關(guān)鍵字不對(duì),:-)),所以在這里給大家提供一個(gè)參考,希望對(duì)大家能提供方便,不用象我找的這么辛苦。

            意圖:實(shí)現(xiàn)多種語(yǔ)言在同一個(gè)工程里,如果調(diào)試成功后,即可以同時(shí)編譯程序的多種語(yǔ)言版本。

            平臺(tái):Win2000 Pro SP4, VC++6.0,SDK

            一般情況下,編寫程序都會(huì)使用工程制作向?qū)В傻墓こ逃袃蓚€(gè)編譯版本,一個(gè)是Debug,另外一個(gè)就是Release,我的目的就是添加多種語(yǔ)言的編譯版本,同時(shí)需要多種語(yǔ)言的.rc文件(Source文件),然后經(jīng)過(guò)一些簡(jiǎn)單的設(shè)置,就Okay了。

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

            ? 下面我們開(kāi)始:

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

            ? 2. 添加多語(yǔ)言編譯版本,選擇Build->Configurations,點(diǎn)擊Add,添加相應(yīng)的語(yǔ)言編譯版本,我這里添加的是English Release。隨后添加多種語(yǔ)言版本。

            添加多種語(yǔ)言的編譯版本


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

            設(shè)置
            Language英語(yǔ)(美國(guó))?????

            ?

            4. 添加Source Files

            ?

            添加后會(huì)彈出一個(gè)對(duì)話框,不用理會(huì)它

            此時(shí)你可以在你編譯器的ResourceView里看到:

            ?

            以后如果需要修改不同的語(yǔ)言,可以修改相應(yīng)的resources文件。


            5. 點(diǎn)擊Project->Settings,點(diǎn)擊你所點(diǎn)擊的.rc文件

            ?

            選中Exclude file from build

            ?

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

            ?

            6. 編譯:

            選擇Build->Batch Build

            ?

            選中您所要編譯的語(yǔ)種,選中Selection only,點(diǎn)擊Rebuild All即可。

            ?

            7. 此時(shí),您可以看到您的.dsp文件已經(jīng)被修改。

            ?

            ?????? 我曾經(jīng)在CSDN論壇上問(wèn)過(guò)此問(wèn)題,還有不同的解法,我把他們帖出來(lái):

            ?

            ??? 我的操作是在VC++6.0里有一個(gè)用Win32程序向?qū)傻囊粋€(gè)工程,此工程代碼添加,調(diào)試,運(yùn)行都已經(jīng)Okay。

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

            ??? 目的是用Debug調(diào)試,然后在Build-Batch Build選項(xiàng)里選擇我要編譯的語(yǔ)言種類,一次編譯多種語(yǔ)言。

            ??? 問(wèn)題是VC6.0提示說(shuō)“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.

            ??? 請(qǐng)問(wèn),如何解決這個(gè)問(wèn)題,我在網(wǎng)上找了兩天了,在其他的Newsgroups上法帖,沒(méi)有找到答案,是不是我哪里設(shè)置錯(cuò)了,請(qǐng)高手給個(gè)提示。謝謝!

            ?

            把你現(xiàn)在的.rc保存,然后把所有的中文換成其他語(yǔ)言,別存為其他other.rc。

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

            就可以搞定。

            因?yàn)樗械?/span>id沒(méi)變,所有程序都能正常運(yùn)行。

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

            寫成INI也是一個(gè)好辦法!

            ?

            其他論壇的回答:

            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!

            ?

            ?

            如果有問(wèn)題,請(qǐng)和我聯(lián)系:danielxu22@cellink.com.cn

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

            Feedback

            # re: 轉(zhuǎn):如何在同一個(gè)工程里添加多種語(yǔ)言 2009-03-07 09:10 岳陽(yáng)
            思路明白了。哈哈  回復(fù)  更多評(píng)論
              

            一本大道久久a久久精品综合| 国产精品免费久久| 国产69精品久久久久久人妻精品| 热久久最新网站获取| 久久亚洲精品人成综合网| 26uuu久久五月天| 成人久久免费网站| 国产精品亚洲美女久久久| 亚洲国产另类久久久精品 | 久久男人中文字幕资源站| 久久久久久久亚洲精品| 人妻精品久久无码区| 久久精品国产欧美日韩| 久久天天躁狠狠躁夜夜avapp| 久久精品人妻一区二区三区| 性做久久久久久久| 久久久久久亚洲精品影院| 久久精品无码一区二区三区| 久久午夜夜伦鲁鲁片免费无码影视 | 久久人人爽人人爽人人爽 | 国产精品久久久福利| 国内精品伊人久久久影院| 99久久精品国产一区二区蜜芽| 久久永久免费人妻精品下载| 人妻少妇精品久久| 色综合久久中文色婷婷| 久久国产精品久久精品国产| 久久精品人人做人人爽97 | 欧美大香线蕉线伊人久久| 思思久久99热只有频精品66| 久久伊人中文无码| 久久精品一区二区影院| 久久精品成人影院| 色8激情欧美成人久久综合电| 国产成人精品久久一区二区三区av | 久久精品国产99久久无毒不卡| 无码人妻久久一区二区三区蜜桃| 亚洲精品WWW久久久久久| 亚洲婷婷国产精品电影人久久| 无码任你躁久久久久久老妇| 中文字幕无码久久人妻|