diff --git a/build-msw.txt b/build-msw.txt index 9786255e1..adb526a31 100644 --- a/build-msw.txt +++ b/build-msw.txt @@ -29,11 +29,11 @@ Dependencies ------------ Libraries you need to download separately and build: - default path download -wxWidgets \wxwidgets prebuilt: http://wxpack.sourceforge.net -OpenSSL \openssl http://www.openssl.org/source/ -Berkeley DB \db http://www.oracle.com/technology/software/products/berkeley-db/index.html -Boost \boost http://www.boost.org/users/download/ + default path download +wxWidgets-2.9 \wxwidgets http://www.wxwidgets.org/downloads/ +OpenSSL \openssl http://www.openssl.org/source/ +Berkeley DB \db http://www.oracle.com/technology/software/products/berkeley-db/index.html +Boost \boost http://www.boost.org/users/download/ Their licenses: wxWidgets LGPL 2.1 with very liberal exceptions @@ -43,10 +43,10 @@ Boost MIT-like license Versions used in this release: MinGW GCC 3.4.5 -wxWidgets 2.8.9 +wxWidgets 2.9.0 OpenSSL 0.9.8k Berkeley DB 4.7.25.NC -Boost 1.34.1 +Boost 1.42.1 Notes @@ -59,6 +59,14 @@ The release is built with GCC and then "strip bitcoin.exe" to strip the debug symbols, which reduces the executable size by about 90%. +wxWidgets +--------- +cd \wxwidgets\build\msw +make -f makefile.gcc + or +nmake -f makefile.vc + + OpenSSL ------- Bitcoin does not use any encryption. If you want to do a no-everything @@ -104,5 +112,5 @@ download bjam.exe from http://sourceforge.net/project/showfiles.php?group_id=7586&package_id=72941 cd \boost bjam toolset=gcc --build-type=complete stage -or + or bjam toolset=msvc --build-type=complete stage diff --git a/build-unix.txt b/build-unix.txt index f1a72eaac..5e3f574af 100644 --- a/build-unix.txt +++ b/build-unix.txt @@ -20,15 +20,11 @@ sudo apt-get install libdb4.7-dev sudo apt-get install libdb4.7++-dev sudo apt-get install libboost-dev -The release was built with wxWidgets 2.8.9 ansi on 32-bit. The current -sourcecode can be built on 64-bit with wxWidgets 2.9.0. +We're now using wxWidgets 2.9, which uses UTF-8. -There is currently no libwxgtk2.8-ansi-dev debian package for Karmic. -libwxgtk2.8-dev is the "unicode" build, but for wxWidgets 2.8 "unicode" -means wchar, not UTF-8. wchar wxString doesn't convert to std::string. -We haven't been able to compile the 2.8 versions on 64-bit. - -wxWidgets 2.9 is UTF-8 and compiles on 64-bit. +There isn't currently a debian package of wxWidgets we can use. The 2.8 +packages for Karmic are UTF-16 unicode and won't work for us, and we've had +trouble building 2.8 on 64-bit. You need to download wxWidgets from http://www.wxwidgets.org/downloads/ and build it yourself. See the build instructions and configure parameters @@ -42,9 +38,9 @@ Boost MIT-like license Versions used in this release: GCC 4.3.3 OpenSSL 0.9.8k -wxWidgets 2.8.9 +wxWidgets 2.9.0 Berkeley DB 4.7.25.NC -Boost 1.40.0 +Boost 1.38.0 Notes @@ -59,7 +55,9 @@ symbols, which reduces the executable size by about 90%. wxWidgets --------- -cd /usr/local/wxWidgets-2.8.9 or 2.9.0 +cd /usr/local +tar -xzvf wxWidgets-2.9.0.tar.gz +cd /usr/local/wxWidgets-2.9.0 mkdir buildgtk cd buildgtk ../configure --with-gtk --enable-debug --disable-shared --enable-monolithic @@ -72,7 +70,7 @@ ldconfig Boost ----- If you want to build Boost yourself, -cd /usr/local/boost_1_40_0 +cd /usr/local/boost_1_42_0 su ./bootstrap.sh ./bjam install diff --git a/locale/readme.txt b/locale/readme.txt new file mode 100644 index 000000000..9fca3ce65 --- /dev/null +++ b/locale/readme.txt @@ -0,0 +1,5 @@ +put bitcoin.po and bitcoin.mo files at: +locale//LC_MESSAGES/bitcoin.mo and .po + +.po is the sourcefile +.mo is the compiled translation diff --git a/main.cpp b/main.cpp index 3391a2994..665a78e20 100644 --- a/main.cpp +++ b/main.cpp @@ -1460,27 +1460,13 @@ bool ScanMessageStart(Stream& s) bool CheckDiskSpace(int64 nAdditionalBytes) { -#ifdef __WXMSW__ - uint64 nFreeBytesAvailable = 0; // bytes available to caller - uint64 nTotalNumberOfBytes = 0; // bytes on disk - uint64 nTotalNumberOfFreeBytes = 0; // free bytes on disk - if (!GetDiskFreeSpaceEx(GetDataDir().c_str(), - (PULARGE_INTEGER)&nFreeBytesAvailable, - (PULARGE_INTEGER)&nTotalNumberOfBytes, - (PULARGE_INTEGER)&nTotalNumberOfFreeBytes)) - { - printf("ERROR: GetDiskFreeSpaceEx() failed\n"); - return true; - } -#else uint64 nFreeBytesAvailable = filesystem::space(GetDataDir()).available; -#endif // Check for 15MB because database could create another 10MB log file at any time if (nFreeBytesAvailable < (int64)15000000 + nAdditionalBytes) { fShutdown = true; - ThreadSafeMessageBox("Warning: Your disk space is low ", "Bitcoin", wxOK | wxICON_EXCLAMATION); + ThreadSafeMessageBox(_("Warning: Disk space is low "), "Bitcoin", wxOK | wxICON_EXCLAMATION); CreateThread(Shutdown, NULL); return false; } @@ -2962,16 +2948,16 @@ string SendMoney(CScript scriptPubKey, int64 nValue, CWalletTx& wtxNew) { string strError; if (nValue + nFeeRequired > GetBalance()) - strError = strprintf("Error: This is an oversized transaction that requires a transaction fee of %s ", FormatMoney(nFeeRequired).c_str()); + strError = strprintf(_("Error: This is an oversized transaction that requires a transaction fee of %s "), FormatMoney(nFeeRequired).c_str()); else - strError = "Error: Transaction creation failed "; + strError = _("Error: Transaction creation failed "); printf("SendMoney() : %s", strError.c_str()); return strError; } if (!CommitTransactionSpent(wtxNew, key)) { printf("SendMoney() : Error finalizing transaction"); - return "Error finalizing transaction"; + return _("Error finalizing transaction"); } // Track how many getdata requests our transaction gets @@ -2985,7 +2971,7 @@ string SendMoney(CScript scriptPubKey, int64 nValue, CWalletTx& wtxNew) { // This must not fail. The transaction has already been signed and recorded. printf("SendMoney() : Error: Transaction not valid"); - return "Error: The transaction was rejected. This might happen if some of the coins in your wallet were already spent, such as if you used a copy of wallet.dat and coins were spent in the copy but not marked as spent here."; + return _("Error: The transaction was rejected. This might happen if some of the coins in your wallet were already spent, such as if you used a copy of wallet.dat and coins were spent in the copy but not marked as spent here."); } wtxNew.RelayWalletTransaction(); } @@ -2999,14 +2985,14 @@ string SendMoneyToBitcoinAddress(string strAddress, int64 nValue, CWalletTx& wtx { // Check amount if (nValue <= 0) - return "Invalid amount"; + return _("Invalid amount"); if (nValue + nTransactionFee > GetBalance()) - return "You don't have enough money"; + return _("You don't have enough money"); // Parse bitcoin address CScript scriptPubKey; if (!scriptPubKey.SetBitcoinAddress(strAddress)) - return "Invalid bitcoin address"; + return _("Invalid bitcoin address"); return SendMoney(scriptPubKey, nValue, wtxNew); } diff --git a/makefile b/makefile.mingw similarity index 78% rename from makefile rename to makefile.mingw index 71f374492..2644cbaad 100644 --- a/makefile +++ b/makefile.mingw @@ -3,27 +3,30 @@ # file license.txt or http://www.opensource.org/licenses/mit-license.php. -ifneq "$(BUILD)" "debug" -ifneq "$(BUILD)" "release" -BUILD=debug -endif -endif -ifeq "$(BUILD)" "debug" -D=d -DEBUGFLAGS=-g -D__WXDEBUG__ -endif +# for wxWidgets-2.8.x, search and replace "mswud"->"mswd" and "29u"->"28" +INCLUDEPATHS= \ + -I"/boost" \ + -I"/db/build_unix" \ + -I"/openssl/include" \ + -I"/wxwidgets/lib/gcc_lib/mswud" \ + -I"/wxwidgets/include" +LIBPATHS= \ + -L"/boost/stage/lib" \ + -L"/db/build_unix" \ + -L"/openssl/out" \ + -L"/wxwidgets/lib/gcc_lib" -INCLUDEPATHS=-I"/boost" -I"/db/build_unix" -I"/openssl/include" -I"/wxwidgets/lib/gcc_lib/mswd" -I"/wxwidgets/include" -LIBPATHS=-L"/boost/stage/lib" -L"/db/build_unix" -L"/openssl/out" -L"/wxwidgets/lib/gcc_lib" LIBS= \ -l libboost_system-mgw34-mt-d -l libboost_filesystem-mgw34-mt-d \ -l db_cxx \ -l eay32 \ - -l wxmsw28$(D)_richtext -l wxmsw28$(D)_html -l wxmsw28$(D)_core -l wxmsw28$(D)_adv -l wxbase28$(D) -l wxtiff$(D) -l wxjpeg$(D) -l wxpng$(D) -l wxzlib$(D) -l wxregex$(D) -l wxexpat$(D) \ + -l wxmsw29ud_html -l wxmsw29ud_core -l wxmsw29ud_adv -l wxbase29ud -l wxtiffd -l wxjpegd -l wxpngd -l wxzlibd \ -l kernel32 -l user32 -l gdi32 -l comdlg32 -l winspool -l winmm -l shell32 -l comctl32 -l ole32 -l oleaut32 -l uuid -l rpcrt4 -l advapi32 -l ws2_32 -l shlwapi + WXDEFS=-DWIN32 -D__WXMSW__ -D_WINDOWS -DNOPCH +DEBUGFLAGS=-g -D__WXDEBUG__ CFLAGS=-mthreads -O0 -w -Wno-invalid-offsetof -Wformat $(DEBUGFLAGS) $(WXDEFS) $(INCLUDEPATHS) HEADERS=headers.h strlcpy.h serialize.h uint256.h util.h key.h bignum.h base58.h script.h db.h net.h irc.h main.h rpc.h uibase.h ui.h diff --git a/makefile.unix.wx2.9 b/makefile.unix similarity index 89% rename from makefile.unix.wx2.9 rename to makefile.unix index 0b3b09b57..a8ec93677 100644 --- a/makefile.unix.wx2.9 +++ b/makefile.unix @@ -3,17 +3,6 @@ # file license.txt or http://www.opensource.org/licenses/mit-license.php. -ifneq "$(BUILD)" "debug" -ifneq "$(BUILD)" "release" -BUILD=debug -endif -endif -ifeq "$(BUILD)" "debug" -D=d -DEBUGFLAGS=-g -D__WXDEBUG__ -endif - - INCLUDEPATHS= \ -I"/usr/include" \ @@ -28,12 +17,13 @@ LIBS= \ -Wl,-Bstatic \ -l boost_system-mt -l boost_filesystem-mt \ -l db_cxx \ - -l wx_gtk2u$(D)-2.9 \ + -l wx_gtk2ud-2.9 \ -Wl,-Bdynamic \ -l crypto \ -l gtk-x11-2.0 -l gthread-2.0 -l SM WXDEFS=-D__WXGTK__ -DNOPCH +DEBUGFLAGS=-g -D__WXDEBUG__ CFLAGS=-O0 -Wno-invalid-offsetof -Wformat $(DEBUGFLAGS) $(WXDEFS) $(INCLUDEPATHS) HEADERS=headers.h strlcpy.h serialize.h uint256.h util.h key.h bignum.h base58.h script.h db.h net.h irc.h main.h rpc.h uibase.h ui.h diff --git a/makefile.unix.wx2.8 b/makefile.unix.wx2.8 deleted file mode 100644 index 38d9bc0e9..000000000 --- a/makefile.unix.wx2.8 +++ /dev/null @@ -1,88 +0,0 @@ -# Copyright (c) 2009-2010 Satoshi Nakamoto -# Distributed under the MIT/X11 software license, see the accompanying -# file license.txt or http://www.opensource.org/licenses/mit-license.php. - - -ifneq "$(BUILD)" "debug" -ifneq "$(BUILD)" "release" -BUILD=debug -endif -endif -ifeq "$(BUILD)" "debug" -D=d -DEBUGFLAGS=-g -D__WXDEBUG__ -endif - - - -INCLUDEPATHS= \ - -I"/usr/include" \ - -I"/usr/local/include/wx-2.8" \ - -I"/usr/local/lib/wx/include/gtk2-ansi-debug-static-2.8" - -LIBPATHS= \ - -L"/usr/lib" \ - -L"/usr/local/lib" - -LIBS= \ - -Wl,-Bstatic \ - -l boost_system -l boost_filesystem \ - -l db_cxx \ - -l wx_gtk2$(D)-2.8 \ - -Wl,-Bdynamic \ - -l crypto \ - -l gtk-x11-2.0 -l gthread-2.0 -l SM - -WXDEFS=-D__WXGTK__ -DNOPCH -CFLAGS=-O0 -Wno-invalid-offsetof -Wformat $(DEBUGFLAGS) $(WXDEFS) $(INCLUDEPATHS) -HEADERS=headers.h strlcpy.h serialize.h uint256.h util.h key.h bignum.h base58.h script.h db.h net.h irc.h main.h rpc.h uibase.h ui.h - - - -all: bitcoin - - -headers.h.gch: headers.h $(HEADERS) - g++ -c $(CFLAGS) -o $@ $< - -obj/util.o: util.cpp $(HEADERS) - g++ -c $(CFLAGS) -o $@ $< - -obj/script.o: script.cpp $(HEADERS) - g++ -c $(CFLAGS) -o $@ $< - -obj/db.o: db.cpp $(HEADERS) - g++ -c $(CFLAGS) -o $@ $< - -obj/net.o: net.cpp $(HEADERS) - g++ -c $(CFLAGS) -o $@ $< - -obj/main.o: main.cpp $(HEADERS) sha.h - g++ -c $(CFLAGS) -o $@ $< - -obj/ui.o: ui.cpp $(HEADERS) - g++ -c $(CFLAGS) -o $@ $< - -obj/uibase.o: uibase.cpp uibase.h - g++ -c $(CFLAGS) -o $@ $< - -obj/sha.o: sha.cpp sha.h - g++ -c $(CFLAGS) -O3 -o $@ $< - -obj/irc.o: irc.cpp $(HEADERS) - g++ -c $(CFLAGS) -o $@ $< - -obj/rpc.o: rpc.cpp $(HEADERS) - g++ -c $(CFLAGS) -o $@ $< - - - -OBJS=obj/util.o obj/script.o obj/db.o obj/net.o obj/main.o \ - obj/ui.o obj/uibase.o obj/sha.o obj/irc.o obj/rpc.o - -bitcoin: headers.h.gch $(OBJS) - g++ $(CFLAGS) -o $@ $(LIBPATHS) $(OBJS) $(LIBS) - -clean: - -rm obj/* - -rm headers.h.gch diff --git a/makefile.vc b/makefile.vc index 5ca8de464..c407be3d2 100644 --- a/makefile.vc +++ b/makefile.vc @@ -3,26 +3,31 @@ # file license.txt or http://www.opensource.org/licenses/mit-license.php. -!IF "$(BUILD)" != "debug" && "$(BUILD)" != "release" -BUILD=debug -!ENDIF -!IF "$(BUILD)" == "debug" -D=d -DEBUGFLAGS=/Zi /Od /D__WXDEBUG__ -!ENDIF +# for wxWidgets-2.8.x, search and replace "mswud"->"mswd" and "29u"->"28" +INCLUDEPATHS= \ + /I"/boost" \ + /I"/db/build_windows" \ + /I"/openssl/include" \ + /I"/wxwidgets/lib/vc_lib/mswud" \ + /I"/wxwidgets/include" +LIBPATHS= \ + /LIBPATH:"/boost/stage/lib" \ + /LIBPATH:"/db/build_windows/debug" \ + /LIBPATH:"/openssl/out" \ + /LIBPATH:"/wxwidgets/lib/vc_lib" -INCLUDEPATHS=/I"/boost" /I"/db/build_windows" /I"/openssl/include" /I"/wxwidgets/lib/vc_lib/mswd" /I"/wxwidgets/include" -LIBPATHS=/LIBPATH:"/boost/stage/lib" /LIBPATH:"/db/build_windows/$(BUILD)" /LIBPATH:"/openssl/out" /LIBPATH:"/wxwidgets/lib/vc_lib" LIBS= \ - libboost_system-vc80-mt-gd.lib libboost_filesystem-vc80-mt-gd.lib \ - libdb47s$(D).lib \ - libeay32.lib \ - wxmsw28$(D)_richtext.lib wxmsw28$(D)_html.lib wxmsw28$(D)_core.lib wxmsw28$(D)_adv.lib wxbase28$(D).lib wxtiff$(D).lib wxjpeg$(D).lib wxpng$(D).lib wxzlib$(D).lib wxregex$(D).lib wxexpat$(D).lib \ - kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib ws2_32.lib shlwapi.lib + libboost_system-vc80-mt-gd.lib libboost_filesystem-vc80-mt-gd.lib \ + libdb47sd.lib \ + libeay32.lib \ + wxmsw29ud_html.lib wxmsw29ud_core.lib wxmsw29ud_adv.lib wxbase29ud.lib wxtiffd.lib wxjpegd.lib wxpngd.lib wxzlibd.lib \ + kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib ws2_32.lib shlwapi.lib + WXDEFS=/DWIN32 /D__WXMSW__ /D_WINDOWS /DNOPCH -CFLAGS=/c /nologo /Ob0 /MD$(D) /EHsc /GR /Zm300 $(DEBUGFLAGS) $(WXDEFS) $(INCLUDEPATHS) +DEBUGFLAGS=/Zi /Od /D__WXDEBUG__ +CFLAGS=/c /nologo /Ob0 /MDd /EHsc /GR /Zm300 $(DEBUGFLAGS) $(WXDEFS) $(INCLUDEPATHS) HEADERS=headers.h strlcpy.h serialize.h uint256.h util.h key.h bignum.h base58.h script.h db.h net.h irc.h main.h rpc.h uibase.h ui.h diff --git a/serialize.h b/serialize.h index 12b58ad1c..f3b99978d 100644 --- a/serialize.h +++ b/serialize.h @@ -19,8 +19,8 @@ class CScript; class CDataStream; class CAutoFile; -static const int VERSION = 201; -static const char* pszSubVer = ".2"; +static const int VERSION = 202; +static const char* pszSubVer = ".0"; diff --git a/ui.cpp b/ui.cpp index f506fcf3e..87ba19e08 100644 --- a/ui.cpp +++ b/ui.cpp @@ -229,8 +229,8 @@ CMainFrame::CMainFrame(wxWindow* parent) : CMainFrameBase(parent) m_staticTextBalance->SetSize(140, 17); // & underlines don't work on the toolbar buttons on gtk m_toolBar->ClearTools(); - m_toolBar->AddTool(wxID_BUTTONSEND, "Send Coins", wxBitmap(send20_xpm), wxNullBitmap, wxITEM_NORMAL, wxEmptyString, wxEmptyString); - m_toolBar->AddTool(wxID_BUTTONRECEIVE, "Address Book", wxBitmap(addressbook20_xpm), wxNullBitmap, wxITEM_NORMAL, wxEmptyString, wxEmptyString); + m_toolBar->AddTool(wxID_BUTTONSEND, _("Send Coins"), wxBitmap(send20_xpm), wxNullBitmap, wxITEM_NORMAL, wxEmptyString, wxEmptyString); + m_toolBar->AddTool(wxID_BUTTONRECEIVE, _("Address Book"), wxBitmap(addressbook20_xpm), wxNullBitmap, wxITEM_NORMAL, wxEmptyString, wxEmptyString); m_toolBar->Realize(); // resize to fit ubuntu's huge default font dResize = 1.20; @@ -244,13 +244,13 @@ CMainFrame::CMainFrame(wxWindow* parent) : CMainFrameBase(parent) int nDateWidth = DateTimeStr(1229413914).size() * 6 + 8; if (!strstr(DateTimeStr(1229413914).c_str(), "2008")) nDateWidth += 12; - m_listCtrl->InsertColumn(0, "", wxLIST_FORMAT_LEFT, dResize * 0); - m_listCtrl->InsertColumn(1, "", wxLIST_FORMAT_LEFT, dResize * 0); - m_listCtrl->InsertColumn(2, "Status", wxLIST_FORMAT_LEFT, dResize * 110); - m_listCtrl->InsertColumn(3, "Date", wxLIST_FORMAT_LEFT, dResize * nDateWidth); - m_listCtrl->InsertColumn(4, "Description", wxLIST_FORMAT_LEFT, dResize * 409 - nDateWidth); - m_listCtrl->InsertColumn(5, "Debit", wxLIST_FORMAT_RIGHT, dResize * 79); - m_listCtrl->InsertColumn(6, "Credit", wxLIST_FORMAT_RIGHT, dResize * 79); + m_listCtrl->InsertColumn(0, "", wxLIST_FORMAT_LEFT, dResize * 0); + m_listCtrl->InsertColumn(1, "", wxLIST_FORMAT_LEFT, dResize * 0); + m_listCtrl->InsertColumn(2, _("Status"), wxLIST_FORMAT_LEFT, dResize * 110); + m_listCtrl->InsertColumn(3, _("Date"), wxLIST_FORMAT_LEFT, dResize * nDateWidth); + m_listCtrl->InsertColumn(4, _("Description"), wxLIST_FORMAT_LEFT, dResize * 409 - nDateWidth); + m_listCtrl->InsertColumn(5, _("Debit"), wxLIST_FORMAT_RIGHT, dResize * 79); + m_listCtrl->InsertColumn(6, _("Credit"), wxLIST_FORMAT_RIGHT, dResize * 79); // Init status bar int pnWidths[3] = { -100, 88, 290 }; @@ -450,19 +450,19 @@ string FormatTxStatus(const CWalletTx& wtx) if (!wtx.IsFinal()) { if (wtx.nLockTime < 500000000) - return strprintf("Open for %d blocks", nBestHeight - wtx.nLockTime); + return strprintf(_("Open for %d blocks"), nBestHeight - wtx.nLockTime); else - return strprintf("Open until %s", DateTimeStr(wtx.nLockTime).c_str()); + return strprintf(_("Open until %s"), DateTimeStr(wtx.nLockTime).c_str()); } else { int nDepth = wtx.GetDepthInMainChain(); if (GetAdjustedTime() - wtx.nTimeReceived > 2 * 60 && wtx.GetRequestCount() == 0) - return strprintf("%d/offline?", nDepth); + return strprintf(_("%d/offline?"), nDepth); else if (nDepth < 6) - return strprintf("%d/unconfirmed", nDepth); + return strprintf(_("%d/unconfirmed"), nDepth); else - return strprintf("%d confirmations", nDepth); + return strprintf(_("%d confirmations"), nDepth); } } @@ -547,7 +547,7 @@ bool CMainFrame::InsertTransaction(const CWalletTx& wtx, bool fNew, int nIndex) if (wtx.IsCoinBase()) { // Coinbase - strDescription = "Generated"; + strDescription = _("Generated"); if (nCredit == 0) { int64 nUnmatured = 0; @@ -555,15 +555,15 @@ bool CMainFrame::InsertTransaction(const CWalletTx& wtx, bool fNew, int nIndex) nUnmatured += txout.GetCredit(); if (wtx.IsInMainChain()) { - strDescription = strprintf("Generated (%s matures in %d more blocks)", FormatMoney(nUnmatured).c_str(), wtx.GetBlocksToMaturity()); + strDescription = strprintf(_("Generated (%s matures in %d more blocks)"), FormatMoney(nUnmatured).c_str(), wtx.GetBlocksToMaturity()); // Check if the block was requested by anyone if (GetAdjustedTime() - wtx.nTimeReceived > 2 * 60 && wtx.GetRequestCount() == 0) - strDescription = "Generated - Warning: This block was not received by any other nodes and will probably not be accepted!"; + strDescription = _("Generated - Warning: This block was not received by any other nodes and will probably not be accepted!"); } else { - strDescription = "Generated (not accepted)"; + strDescription = _("Generated (not accepted)"); } } } @@ -571,7 +571,7 @@ bool CMainFrame::InsertTransaction(const CWalletTx& wtx, bool fNew, int nIndex) { // Online transaction if (!mapValue["from"].empty()) - strDescription += "From: " + mapValue["from"]; + strDescription += _("From: ") + mapValue["from"]; if (!mapValue["message"].empty()) { if (!strDescription.empty()) @@ -594,9 +594,9 @@ bool CMainFrame::InsertTransaction(const CWalletTx& wtx, bool fNew, int nIndex) string strAddress = PubKeyToAddress(vchPubKey); if (mapAddressBook.count(strAddress)) { - //strDescription += "Received payment to "; - //strDescription += "Received with address "; - strDescription += "From: unknown, To: "; + //strDescription += _("Received payment to "); + //strDescription += _("Received with address "); + strDescription += _("From: unknown, To: "); strDescription += strAddress; /// The labeling feature is just too confusing, so I hid it /// by putting it at the end where it runs off the screen. @@ -636,7 +636,7 @@ bool CMainFrame::InsertTransaction(const CWalletTx& wtx, bool fNew, int nIndex) InsertLine(fNew, nIndex, hash, strSort, strStatus, nTime ? DateTimeStr(nTime) : "", - "Payment to yourself", + _("Payment to yourself"), "", ""); /// issue: can't tell which is the payment and which is the change anymore @@ -670,7 +670,7 @@ bool CMainFrame::InsertTransaction(const CWalletTx& wtx, bool fNew, int nIndex) strAddress = Hash160ToAddress(hash160); } - string strDescription = "To: "; + string strDescription = _("To: "); CRITICAL_BLOCK(cs_mapAddressBook) if (mapAddressBook.count(strAddress) && !mapAddressBook[strAddress].empty()) strDescription += mapAddressBook[strAddress] + " "; @@ -960,12 +960,12 @@ void CMainFrame::OnPaintListCtrl(wxPaintEvent& event) // Update status bar string strGen = ""; if (fGenerateBitcoins) - strGen = " Generating"; + strGen = _(" Generating"); if (fGenerateBitcoins && vNodes.empty()) - strGen = "(not connected)"; + strGen = _("(not connected)"); m_statusBar->SetStatusText(strGen, 1); - string strStatus = strprintf(" %d connections %d blocks %d transactions", vNodes.size(), nBestHeight + 1, nTransactionCount); + string strStatus = strprintf(_(" %d connections %d blocks %d transactions"), vNodes.size(), nBestHeight + 1, nTransactionCount); m_statusBar->SetStatusText(strStatus, 2); if (fDebug && GetTime() - nThreadSocketHandlerHeartbeat > 60) @@ -1160,20 +1160,20 @@ CTxDetailsDialog::CTxDetailsDialog(wxWindow* parent, CWalletTx wtx) : CTxDetails - strHTML += "Status: " + FormatTxStatus(wtx); + strHTML += _("Status: ") + FormatTxStatus(wtx); int nRequests = wtx.GetRequestCount(); if (nRequests != -1) { if (nRequests == 0) - strHTML += ", has not been successfully broadcast yet"; + strHTML += _(", has not been successfully broadcast yet"); else if (nRequests == 1) - strHTML += strprintf(", broadcast through %d node", nRequests); + strHTML += strprintf(_(", broadcast through %d node"), nRequests); else - strHTML += strprintf(", broadcast through %d nodes", nRequests); + strHTML += strprintf(_(", broadcast through %d nodes"), nRequests); } strHTML += "
"; - strHTML += "Date: " + (nTime ? DateTimeStr(nTime) : "") + "
"; + strHTML += _("Date: ") + (nTime ? DateTimeStr(nTime) : "") + "
"; // @@ -1181,13 +1181,13 @@ CTxDetailsDialog::CTxDetailsDialog(wxWindow* parent, CWalletTx wtx) : CTxDetails // if (wtx.IsCoinBase()) { - strHTML += "Source: Generated
"; + strHTML += _("Source: Generated
"); } else if (!wtx.mapValue["from"].empty()) { // Online transaction if (!wtx.mapValue["from"].empty()) - strHTML += "From: " + HtmlEscape(wtx.mapValue["from"]) + "
"; + strHTML += _("From: ") + HtmlEscape(wtx.mapValue["from"]) + "
"; } else { @@ -1205,13 +1205,13 @@ CTxDetailsDialog::CTxDetailsDialog(wxWindow* parent, CWalletTx wtx) : CTxDetails string strAddress = PubKeyToAddress(vchPubKey); if (mapAddressBook.count(strAddress)) { - strHTML += "From: unknown
"; - strHTML += "To: "; + strHTML += string() + _("From: ") + _("unknown") + "
"; + strHTML += _("To: "); strHTML += HtmlEscape(strAddress); if (!mapAddressBook[strAddress].empty()) - strHTML += " (yours, label: " + mapAddressBook[strAddress] + ")"; + strHTML += _(" (yours, label: ") + mapAddressBook[strAddress] + ")"; else - strHTML += " (yours)"; + strHTML += _(" (yours)"); strHTML += "
"; } } @@ -1230,7 +1230,7 @@ CTxDetailsDialog::CTxDetailsDialog(wxWindow* parent, CWalletTx wtx) : CTxDetails { // Online transaction strAddress = wtx.mapValue["to"]; - strHTML += "To: "; + strHTML += _("To: "); if (mapAddressBook.count(strAddress) && !mapAddressBook[strAddress].empty()) strHTML += mapAddressBook[strAddress] + " "; strHTML += HtmlEscape(strAddress) + "
"; @@ -1248,17 +1248,19 @@ CTxDetailsDialog::CTxDetailsDialog(wxWindow* parent, CWalletTx wtx) : CTxDetails int64 nUnmatured = 0; foreach(const CTxOut& txout, wtx.vout) nUnmatured += txout.GetCredit(); + strHTML += _("Credit: "); if (wtx.IsInMainChain()) - strHTML += strprintf("Credit: (%s matures in %d more blocks)
", FormatMoney(nUnmatured).c_str(), wtx.GetBlocksToMaturity()); + strHTML += strprintf(_("(%s matures in %d more blocks)"), FormatMoney(nUnmatured).c_str(), wtx.GetBlocksToMaturity()); else - strHTML += "Credit: (not accepted)
"; + strHTML += _("(not accepted)"); + strHTML += "
"; } else if (nNet > 0) { // // Credit // - strHTML += "Credit: " + FormatMoney(nNet) + "
"; + strHTML += _("Credit: ") + FormatMoney(nNet) + "
"; } else { @@ -1287,7 +1289,7 @@ CTxDetailsDialog::CTxDetailsDialog(wxWindow* parent, CWalletTx wtx) : CTxDetails if (ExtractHash160(txout.scriptPubKey, hash160)) { string strAddress = Hash160ToAddress(hash160); - strHTML += "To: "; + strHTML += _("To: "); if (mapAddressBook.count(strAddress) && !mapAddressBook[strAddress].empty()) strHTML += mapAddressBook[strAddress] + " "; strHTML += strAddress; @@ -1295,7 +1297,7 @@ CTxDetailsDialog::CTxDetailsDialog(wxWindow* parent, CWalletTx wtx) : CTxDetails } } - strHTML += "Debit: " + FormatMoney(-txout.nValue) + "
"; + strHTML += _("Debit: ") + FormatMoney(-txout.nValue) + "
"; } if (fAllToMe) @@ -1303,13 +1305,13 @@ CTxDetailsDialog::CTxDetailsDialog(wxWindow* parent, CWalletTx wtx) : CTxDetails // Payment to self /// issue: can't tell which is the payment and which is the change anymore //int64 nValue = wtx.vout[0].nValue; - //strHTML += "Debit: " + FormatMoney(-nValue) + "
"; - //strHTML += "Credit: " + FormatMoney(nValue) + "
"; + //strHTML += _("Debit: ") + FormatMoney(-nValue) + "
"; + //strHTML += _("Credit: ") + FormatMoney(nValue) + "
"; } int64 nTxFee = nDebit - wtx.GetValueOut(); if (nTxFee > 0) - strHTML += "Transaction fee: " + FormatMoney(-nTxFee) + "
"; + strHTML += _("Transaction fee: ") + FormatMoney(-nTxFee) + "
"; } else { @@ -1318,24 +1320,24 @@ CTxDetailsDialog::CTxDetailsDialog(wxWindow* parent, CWalletTx wtx) : CTxDetails // foreach(const CTxIn& txin, wtx.vin) if (txin.IsMine()) - strHTML += "Debit: " + FormatMoney(-txin.GetDebit()) + "
"; + strHTML += _("Debit: ") + FormatMoney(-txin.GetDebit()) + "
"; foreach(const CTxOut& txout, wtx.vout) if (txout.IsMine()) - strHTML += "Credit: " + FormatMoney(txout.GetCredit()) + "
"; + strHTML += _("Credit: ") + FormatMoney(txout.GetCredit()) + "
"; } } - strHTML += "Net amount: " + FormatMoney(nNet, true) + "
"; + strHTML += _("Net amount: ") + FormatMoney(nNet, true) + "
"; // // Message // if (!wtx.mapValue["message"].empty()) - strHTML += "
Message:
" + HtmlEscape(wtx.mapValue["message"], true) + "
"; + strHTML += string() + "
" + _("Message:") + "
" + HtmlEscape(wtx.mapValue["message"], true) + "
"; if (wtx.IsCoinBase()) - strHTML += "
Generated coins must wait 120 blocks before they can be spent. When you generated this block, it was broadcast to the network to be added to the block chain. If it fails to get into the chain, it will change to \"not accepted\" and not be spendable. This may occasionally happen if another node generates a block within a few seconds of yours.
"; + strHTML += string() + "
" + _("Generated coins must wait 120 blocks before they can be spent. When you generated this block, it was broadcast to the network to be added to the block chain. If it fails to get into the chain, it will change to \"not accepted\" and not be spendable. This may occasionally happen if another node generates a block within a few seconds of yours.") + "
"; // @@ -1402,12 +1404,12 @@ void CTxDetailsDialog::OnButtonOK(wxCommandEvent& event) COptionsDialog::COptionsDialog(wxWindow* parent) : COptionsDialogBase(parent) { // Set up list box of page choices - m_listBox->Append("Main"); - //m_listBox->Append("Test 2"); + m_listBox->Append(_("Main")); + //m_listBox->Append(_("Test 2")); m_listBox->SetSelection(0); SelectPage(0); #ifndef __WXMSW__ - m_checkBoxMinimizeOnClose->SetLabel("&Minimize on close"); + m_checkBoxMinimizeOnClose->SetLabel(_("&Minimize on close")); m_checkBoxStartOnSystemStartup->Enable(false); // not implemented yet #endif @@ -1559,16 +1561,16 @@ void COptionsDialog::OnButtonApply(wxCommandEvent& event) CAboutDialog::CAboutDialog(wxWindow* parent) : CAboutDialogBase(parent) { - m_staticTextVersion->SetLabel(strprintf("version 0.%d.%d beta", VERSION/100, VERSION%100)); + m_staticTextVersion->SetLabel(strprintf(_("version 0.%d.%d beta"), VERSION/100, VERSION%100)); -#if !wxUSE_UNICODE - // Workaround until upgrade to wxWidgets supporting UTF-8 - // Hack to change the (c) character from UTF-8 back to ANSI + // Change (c) into UTF-8 or ANSI copyright symbol wxString str = m_staticTextMain->GetLabel(); - if (str.Find('\xC2') != wxNOT_FOUND) - str.Remove(str.Find('\xC2'), 1); - m_staticTextMain->SetLabel(str); +#if wxUSE_UNICODE + str.Replace("(c)", wxString::FromUTF8("\xC2\xA9")); +#else + str.Replace("(c)", "\xA9"); #endif + m_staticTextMain->SetLabel(str); #ifndef __WXMSW__ // Resize on Linux to make the window fit the text. // The text was wrapped manually rather than using the Wrap setting because @@ -1577,7 +1579,7 @@ CAboutDialog::CAboutDialog(wxWindow* parent) : CAboutDialogBase(parent) if (fontTmp.GetPointSize() > 8); fontTmp.SetPointSize(8); m_staticTextMain->SetFont(fontTmp); - SetSize(GetSize().GetWidth() + 44, GetSize().GetHeight() - 4); + SetSize(GetSize().GetWidth() + 44, GetSize().GetHeight() + 10); #endif } @@ -1644,8 +1646,8 @@ void CSendDialog::OnTextAddress(wxCommandEvent& event) { strFromSave = m_textCtrlFrom->GetValue(); strMessageSave = m_textCtrlMessage->GetValue(); - m_textCtrlFrom->SetValue("Will appear as \"From: Unknown\""); - m_textCtrlMessage->SetValue("Can't include a message when sending to a Bitcoin address"); + m_textCtrlFrom->SetValue(_("Will appear as \"From: Unknown\"")); + m_textCtrlMessage->SetValue(_("Can't include a message when sending to a Bitcoin address")); } else if (fEnable && !fEnabledPrev) { @@ -1697,17 +1699,17 @@ void CSendDialog::OnButtonSend(wxCommandEvent& event) int64 nValue = 0; if (!ParseMoney(m_textCtrlAmount->GetValue(), nValue) || nValue <= 0) { - wxMessageBox("Error in amount ", "Send Coins"); + wxMessageBox(_("Error in amount "), _("Send Coins")); return; } if (nValue > GetBalance()) { - wxMessageBox("Amount exceeds your balance ", "Send Coins"); + wxMessageBox(_("Amount exceeds your balance "), _("Send Coins")); return; } if (nValue + nTransactionFee > GetBalance()) { - wxMessageBox(string("Total exceeds your balance when the ") + FormatMoney(nTransactionFee) + " transaction fee is included ", "Send Coins"); + wxMessageBox(string(_("Total exceeds your balance when the ")) + FormatMoney(nTransactionFee) + _(" transaction fee is included "), _("Send Coins")); return; } @@ -1723,9 +1725,9 @@ void CSendDialog::OnButtonSend(wxCommandEvent& event) string strError = SendMoney(scriptPubKey, nValue, wtx); if (strError != "") - wxMessageBox(strError + " ", "Sending..."); + wxMessageBox(strError + " ", _("Sending...")); else - wxMessageBox("Payment sent ", "Sending..."); + wxMessageBox(_("Payment sent "), _("Sending...")); } else { @@ -1733,7 +1735,7 @@ void CSendDialog::OnButtonSend(wxCommandEvent& event) CAddress addr(strAddress); if (!addr.IsValid()) { - wxMessageBox("Invalid address ", "Send Coins"); + wxMessageBox(_("Invalid address "), _("Send Coins")); return; } @@ -1787,7 +1789,7 @@ CSendingDialog::CSendingDialog(wxWindow* parent, const CAddress& addrIn, int64 n SetSize(1.2 * GetSize().GetWidth(), 1.08 * GetSize().GetHeight()); #endif - SetTitle(strprintf("Sending %s to %s", FormatMoney(nPrice).c_str(), wtx.mapValue["to"].c_str())); + SetTitle(strprintf(_("Sending %s to %s"), FormatMoney(nPrice).c_str(), wtx.mapValue["to"].c_str())); m_textCtrlStatus->SetValue(""); CreateThread(SendingDialogStartTransfer, this); @@ -1859,13 +1861,13 @@ void CSendingDialog::OnPaint(wxPaintEvent& event) } if (fAbort && fCanCancel && IsShown()) { - strcpy(pszStatus, "CANCELLED"); + strcpy(pszStatus, _("CANCELLED")); m_buttonOK->Enable(true); m_buttonOK->SetFocus(); m_buttonCancel->Enable(false); - m_buttonCancel->SetLabel("Cancelled"); + m_buttonCancel->SetLabel(_("Cancelled")); Close(); - wxMessageBox("Transfer cancelled ", "Sending...", wxOK, this); + wxMessageBox(_("Transfer cancelled "), _("Sending..."), wxOK, this); } event.Skip(); } @@ -1893,7 +1895,7 @@ bool CSendingDialog::Status() if (fAbort && fCanCancel) { memset(pszStatus, 0, 10); - strcpy(pszStatus, "CANCELLED"); + strcpy(pszStatus, _("CANCELLED")); Repaint(); fWorkDone = true; return false; @@ -1919,7 +1921,7 @@ bool CSendingDialog::Error(const string& str) { fCanCancel = false; fWorkDone = true; - Status(string("Error: ") + str); + Status(string(_("Error: ")) + str); return false; } @@ -1933,22 +1935,22 @@ void CSendingDialog::StartTransfer() // Make sure we have enough money if (nPrice + nTransactionFee > GetBalance()) { - Error("You don't have enough money"); + Error(_("You don't have enough money")); return; } // We may have connected already for product details - if (!Status("Connecting...")) + if (!Status(_("Connecting..."))) return; CNode* pnode = ConnectNode(addr, 15 * 60); if (!pnode) { - Error("Unable to connect"); + Error(_("Unable to connect")); return; } // Send order to seller, with response going to OnReply2 via event handler - if (!Status("Requesting public key...")) + if (!Status(_("Requesting public key..."))) return; pnode->PushRequest("checkorder", wtx, SendingDialogOnReply2, this); } @@ -1960,7 +1962,7 @@ void SendingDialogOnReply2(void* parg, CDataStream& vRecv) void CSendingDialog::OnReply2(CDataStream& vRecv) { - if (!Status("Received public key...")) + if (!Status(_("Received public key..."))) return; CScript scriptPubKey; @@ -1972,7 +1974,7 @@ void CSendingDialog::OnReply2(CDataStream& vRecv) { string strMessage; vRecv >> strMessage; - Error("Transfer was not accepted"); + Error(_("Transfer was not accepted")); //// todo: enlarge the window and enable a hidden white box to put seller's message return; } @@ -1981,7 +1983,7 @@ void CSendingDialog::OnReply2(CDataStream& vRecv) catch (...) { //// what do we want to do about this? - Error("Invalid response received"); + Error(_("Invalid response received")); return; } @@ -1996,11 +1998,11 @@ void CSendingDialog::OnReply2(CDataStream& vRecv) CRITICAL_BLOCK(cs_main) { // Pay - if (!Status("Creating transaction...")) + if (!Status(_("Creating transaction..."))) return; if (nPrice + nTransactionFee > GetBalance()) { - Error("You don't have enough money"); + Error(_("You don't have enough money")); return; } CKey key; @@ -2008,9 +2010,9 @@ void CSendingDialog::OnReply2(CDataStream& vRecv) if (!CreateTransaction(scriptPubKey, nPrice, wtx, key, nFeeRequired)) { if (nPrice + nFeeRequired > GetBalance()) - Error(strprintf("This is an oversized transaction that requires a transaction fee of %s", FormatMoney(nFeeRequired).c_str())); + Error(strprintf(_("This is an oversized transaction that requires a transaction fee of %s"), FormatMoney(nFeeRequired).c_str())); else - Error("Transaction creation failed"); + Error(_("Transaction creation failed")); return; } @@ -2018,7 +2020,7 @@ void CSendingDialog::OnReply2(CDataStream& vRecv) CNode* pnode = ConnectNode(addr, 2 * 60 * 60); if (!pnode) { - Error("Lost connection, transaction cancelled"); + Error(_("Lost connection, transaction cancelled")); return; } @@ -2034,13 +2036,13 @@ void CSendingDialog::OnReply2(CDataStream& vRecv) return; fCanCancel = false; } - if (!Status("Sending payment...")) + if (!Status(_("Sending payment..."))) return; // Commit if (!CommitTransactionSpent(wtx, key)) { - Error("Error finalizing payment"); + Error(_("Error finalizing payment")); return; } @@ -2052,7 +2054,7 @@ void CSendingDialog::OnReply2(CDataStream& vRecv) printf("ERROR: CSendingDialog : wtxNew.AcceptTransaction() %s failed\n", wtx.GetHash().ToString().c_str()); wtx.RelayWalletTransaction(); - Status("Waiting for confirmation..."); + Status(_("Waiting for confirmation...")); MainFrameRepaint(); } } @@ -2070,22 +2072,22 @@ void CSendingDialog::OnReply3(CDataStream& vRecv) vRecv >> nRet; if (nRet > 0) { - Error("The payment was sent, but the recipient was unable to verify it.\n" - "The transaction is recorded and will credit to the recipient,\n" - "but the comment information will be blank."); + Error(_("The payment was sent, but the recipient was unable to verify it.\n" + "The transaction is recorded and will credit to the recipient,\n" + "but the comment information will be blank.")); return; } } catch (...) { //// what do we want to do about this? - Error("Payment was sent, but an invalid response was received"); + Error(_("Payment was sent, but an invalid response was received")); return; } fSuccess = true; fWorkDone = true; - Status("Payment completed"); + Status(_("Payment completed")); } @@ -2101,8 +2103,8 @@ void CSendingDialog::OnReply3(CDataStream& vRecv) CYourAddressDialog::CYourAddressDialog(wxWindow* parent, const string& strInitSelected) : CYourAddressDialogBase(parent) { // Init column headers - m_listCtrl->InsertColumn(0, "Label", wxLIST_FORMAT_LEFT, 200); - m_listCtrl->InsertColumn(1, "Bitcoin Address", wxLIST_FORMAT_LEFT, 350); + m_listCtrl->InsertColumn(0, _("Label"), wxLIST_FORMAT_LEFT, 200); + m_listCtrl->InsertColumn(1, _("Bitcoin Address"), wxLIST_FORMAT_LEFT, 350); m_listCtrl->SetFocus(); // Fill listctrl with address book data @@ -2162,7 +2164,7 @@ void CYourAddressDialog::OnButtonRename(wxCommandEvent& event) return; string strName = (string)m_listCtrl->GetItemText(nIndex); string strAddress = (string)GetItemText(m_listCtrl, nIndex, 1); - CGetTextFromUserDialog dialog(this, "Edit Address Label", "New Label", strName); + CGetTextFromUserDialog dialog(this, _("Edit Address Label"), _("New Label"), strName); if (!dialog.ShowModal()) return; strName = dialog.GetValue(); @@ -2176,7 +2178,7 @@ void CYourAddressDialog::OnButtonRename(wxCommandEvent& event) void CYourAddressDialog::OnButtonNew(wxCommandEvent& event) { // Ask name - CGetTextFromUserDialog dialog(this, "New Bitcoin Address", "Label", ""); + CGetTextFromUserDialog dialog(this, _("New Bitcoin Address"), _("Label"), ""); if (!dialog.ShowModal()) return; string strName = dialog.GetValue(); @@ -2236,8 +2238,8 @@ CAddressBookDialog::CAddressBookDialog(wxWindow* parent, const wxString& strInit m_buttonCancel->Show(false); // Init column headers - m_listCtrl->InsertColumn(0, "Name", wxLIST_FORMAT_LEFT, 200); - m_listCtrl->InsertColumn(1, "Address", wxLIST_FORMAT_LEFT, 350); + m_listCtrl->InsertColumn(0, _("Name"), wxLIST_FORMAT_LEFT, 200); + m_listCtrl->InsertColumn(1, _("Address"), wxLIST_FORMAT_LEFT, 350); m_listCtrl->SetFocus(); // Set Icon @@ -2307,7 +2309,7 @@ bool CAddressBookDialog::CheckIfMine(const string& strAddress, const string& str uint160 hash160; bool fMine = (AddressToHash160(strAddress, hash160) && mapPubKeys.count(hash160)); if (fMine) - wxMessageBox("This is one of your own addresses for receiving payments and cannot be entered in the address book. ", strTitle); + wxMessageBox(_("This is one of your own addresses for receiving payments and cannot be entered in the address book. "), strTitle); return fMine; } @@ -2322,13 +2324,13 @@ void CAddressBookDialog::OnButtonEdit(wxCommandEvent& event) string strAddressOrg = strAddress; do { - CGetTextFromUserDialog dialog(this, "Edit Address", "Name", strName, "Address", strAddress); + CGetTextFromUserDialog dialog(this, _("Edit Address"), _("Name"), strName, _("Address"), strAddress); if (!dialog.ShowModal()) return; strName = dialog.GetValue1(); strAddress = dialog.GetValue2(); } - while (CheckIfMine(strAddress, "Edit Address")); + while (CheckIfMine(strAddress, _("Edit Address"))); // Change name if (strAddress != strAddressOrg) @@ -2346,13 +2348,13 @@ void CAddressBookDialog::OnButtonNew(wxCommandEvent& event) string strAddress; do { - CGetTextFromUserDialog dialog(this, "New Address", "Name", strName, "Address", strAddress); + CGetTextFromUserDialog dialog(this, _("New Address"), _("Name"), strName, _("Address"), strAddress); if (!dialog.ShowModal()) return; strName = dialog.GetValue1(); strAddress = dialog.GetValue2(); } - while (CheckIfMine(strAddress, "New Address")); + while (CheckIfMine(strAddress, _("New Address"))); // Add to list and select it SetAddressBookName(strAddress, strName); @@ -2436,11 +2438,11 @@ void CMyTaskBarIcon::Show(bool fShow) static char pszPrevTip[200]; if (fShow) { - string strTooltip = "Bitcoin"; + string strTooltip = _("Bitcoin"); if (fGenerateBitcoins) - strTooltip = "Bitcoin - Generating"; + strTooltip = _("Bitcoin - Generating"); if (fGenerateBitcoins && vNodes.empty()) - strTooltip = "Bitcoin - (not connected)"; + strTooltip = _("Bitcoin - (not connected)"); // Optimization, only update when changed, using char array to be reentrant if (strncmp(pszPrevTip, strTooltip.c_str(), sizeof(pszPrevTip)-1) != 0) @@ -2515,12 +2517,12 @@ void CMyTaskBarIcon::UpdateTooltip() wxMenu* CMyTaskBarIcon::CreatePopupMenu() { wxMenu* pmenu = new wxMenu; - pmenu->Append(ID_TASKBAR_RESTORE, "&Open Bitcoin"); - pmenu->Append(ID_TASKBAR_OPTIONS, "O&ptions..."); - pmenu->AppendCheckItem(ID_TASKBAR_GENERATE, "&Generate Coins")->Check(fGenerateBitcoins); + pmenu->Append(ID_TASKBAR_RESTORE, _("&Open Bitcoin")); + pmenu->Append(ID_TASKBAR_OPTIONS, _("O&ptions...")); + pmenu->AppendCheckItem(ID_TASKBAR_GENERATE, _("&Generate Coins"))->Check(fGenerateBitcoins); #ifndef __WXMAC_OSX__ // Mac has built-in quit menu pmenu->AppendSeparator(); - pmenu->Append(ID_TASKBAR_EXIT, "E&xit"); + pmenu->Append(ID_TASKBAR_EXIT, _("E&xit")); #endif return pmenu; } @@ -2542,7 +2544,9 @@ wxMenu* CMyTaskBarIcon::CreatePopupMenu() // Define a new application class CMyApp: public wxApp { - public: +public: + wxLocale m_locale; + CMyApp(){}; ~CMyApp(){}; bool OnInit(); @@ -2584,9 +2588,9 @@ bool CMyApp::OnInit() bool CMyApp::OnInit2() { #ifdef _MSC_VER - // Turn off microsoft heap dump noise for now + // Turn off microsoft heap dump noise _CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_FILE); - _CrtSetReportFile(_CRT_WARN, CreateFile("NUL", GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, 0)); + _CrtSetReportFile(_CRT_WARN, CreateFileA("NUL", GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, 0)); #endif #if defined(__WXMSW__) && defined(__WXDEBUG__) // Disable malfunctioning wxWidgets debug assertion @@ -2599,6 +2603,31 @@ bool CMyApp::OnInit2() SetAppName("bitcoin"); umask(077); #endif +#ifdef __WXMSW__ +#if wxUSE_UNICODE + // Hack to set wxConvLibc codepage to UTF-8 on Windows, + // may break if wxMBConv_win32 implementation in strconv.cpp changes. + class wxMBConv_win32 : public wxMBConv + { + public: + long m_CodePage; + size_t m_minMBCharWidth; + }; + if (((wxMBConv_win32*)&wxConvLibc)->m_CodePage == CP_ACP) + ((wxMBConv_win32*)&wxConvLibc)->m_CodePage = CP_UTF8; +#endif +#endif + + // Load locale//LC_MESSAGES/bitcoin.mo language file + m_locale.Init(wxLANGUAGE_DEFAULT, 0); + m_locale.AddCatalogLookupPathPrefix("locale"); + if (!fWindows) + { + m_locale.AddCatalogLookupPathPrefix("/usr/share/locale"); + m_locale.AddCatalogLookupPathPrefix("/usr/local/share/locale"); + } + m_locale.AddCatalog("wxstd"); // wxWidgets standard translations, if any + m_locale.AddCatalog("bitcoin"); // // Parameters @@ -2612,33 +2641,31 @@ bool CMyApp::OnInit2() ParseParameters(argc, argv); if (mapArgs.count("-?") || mapArgs.count("--help")) { -#ifdef __WXMSW__ - string strUsage = - "Usage: bitcoin [options]\t\t\t\t\t\t\n" - "Options:\n" - " -gen\t\t Generate coins\n" - " -gen=0\t\t Don't generate coins\n" - " -min\t\t Start minimized\n" - " -datadir=\t Specify data directory\n" - " -proxy=\t Connect through socks4 proxy\n" - " -addnode=\t Add a node to connect to\n" - " -connect=\t Connect only to the specified node\n" - " -?\t\t This help message\n"; - wxMessageBox(strUsage, "Bitcoin", wxOK); -#else - string strUsage = - "Usage: bitcoin [options]\n" - "Options:\n" - " -gen Generate coins\n" - " -gen=0 Don't generate coins\n" - " -min Start minimized\n" - " -datadir= Specify data directory\n" - " -proxy= Connect through socks4 proxy\n" - " -addnode= Add a node to connect to\n" - " -connect= Connect only to the specified node\n" - " -? This help message\n"; - fprintf(stderr, "%s", strUsage.c_str()); -#endif + wxString strUsage = string() + + _("Usage: bitcoin [options]") + "\t\t\t\t\t\t\n" + + _("Options:\n") + + " -gen \t\t " + _("Generate coins\n") + + " -gen=0 \t\t " + _("Don't generate coins\n") + + " -min \t\t " + _("Start minimized\n") + + " -datadir= \t " + _("Specify data directory\n") + + " -proxy=\t " + _("Connect through socks4 proxy\n") + + " -addnode= \t " + _("Add a node to connect to\n") + + " -connect= \t " + _("Connect only to the specified node\n") + + " -? \t\t " + _("This help message\n"); + + if (fWindows) + { + // Remove spaces, the tabs make the columns line up in the message box + for (int i = 0; i < 50; i++) + strUsage.Replace(" \t", "\t"); + wxMessageBox(strUsage, "Bitcoin", wxOK); + } + else + { + // Remove tabs + strUsage.Replace("\t", ""); + fprintf(stderr, "%s", ((string)strUsage).c_str()); + } return false; } @@ -2661,7 +2688,9 @@ bool CMyApp::OnInit2() if (!fDebug && !pszSetDataDir[0]) ShrinkDebugFile(); printf("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"); - printf("Bitcoin version %d%s, OS version %s\n", VERSION, pszSubVer, ((string)wxGetOsDescription()).c_str()); + printf("Bitcoin version 0.%d.%d%s beta, OS version %s\n", VERSION/100, VERSION%100, pszSubVer, ((string)wxGetOsDescription()).c_str()); + printf("System default language is %d %s\n", m_locale.GetSystemLanguage(), ((string)m_locale.GetSysName()).c_str()); + printf("Language file %s (%s)\n", (string("locale/") + (string)m_locale.GetCanonicalName() + "/LC_MESSAGES/bitcoin.mo").c_str(), ((string)m_locale.GetLocale()).c_str()); if (mapArgs.count("-loadblockindextest")) { @@ -2691,7 +2720,7 @@ bool CMyApp::OnInit2() { // TODO: find out how to do this in Linux, or replace with wxWidgets commands // Show the previous instance and exit - HWND hwndPrev = FindWindow("wxWindowClassNR", "Bitcoin"); + HWND hwndPrev = FindWindowA("wxWindowClassNR", "Bitcoin"); if (hwndPrev) { if (IsIconic(hwndPrev)) @@ -2732,19 +2761,19 @@ bool CMyApp::OnInit2() printf("Loading addresses...\n"); nStart = GetTimeMillis(); if (!LoadAddresses()) - strErrors += "Error loading addr.dat \n"; + strErrors += _("Error loading addr.dat \n"); printf(" addresses %15"PRI64d"ms\n", GetTimeMillis() - nStart); printf("Loading block index...\n"); nStart = GetTimeMillis(); if (!LoadBlockIndex()) - strErrors += "Error loading blkindex.dat \n"; + strErrors += _("Error loading blkindex.dat \n"); printf(" block index %15"PRI64d"ms\n", GetTimeMillis() - nStart); printf("Loading wallet...\n"); nStart = GetTimeMillis(); if (!LoadWallet(fFirstRun)) - strErrors += "Error loading wallet.dat \n"; + strErrors += _("Error loading wallet.dat \n"); printf(" wallet %15"PRI64d"ms\n", GetTimeMillis() - nStart); printf("Done loading\n"); @@ -2812,7 +2841,7 @@ bool CMyApp::OnInit2() addrProxy = CAddress(mapArgs["-proxy"]); if (!addrProxy.IsValid()) { - wxMessageBox("Invalid -proxy address", "Bitcoin"); + wxMessageBox(_("Invalid -proxy address"), "Bitcoin"); return false; } } @@ -2947,7 +2976,7 @@ void CMyApp::OnUnhandledException() void CMyApp::OnFatalException() { - wxMessageBox("Program has crashed and will terminate. ", "Bitcoin", wxOK | wxICON_ERROR); + wxMessageBox(_("Program has crashed and will terminate. "), "Bitcoin", wxOK | wxICON_ERROR); } @@ -2962,7 +2991,7 @@ string MyGetSpecialFolderPath(int nFolder, bool fCreate) char pszPath[MAX_PATH+100] = ""; // SHGetSpecialFolderPath is not usually available on NT 4.0 - HMODULE hShell32 = LoadLibrary("shell32.dll"); + HMODULE hShell32 = LoadLibraryA("shell32.dll"); if (hShell32) { PSHGETSPECIALFOLDERPATHA pSHGetSpecialFolderPath = @@ -3017,7 +3046,7 @@ void SetStartOnSystemStartup(bool fAutoStart) if (SUCCEEDED(hres)) { // Get the current executable path - char pszExePath[MAX_PATH]; + TCHAR pszExePath[MAX_PATH]; GetModuleFileName(NULL, pszExePath, sizeof(pszExePath)); // Set the path to the shortcut target diff --git a/ui.h b/ui.h index da1ada7de..50d39ab7f 100644 --- a/ui.h +++ b/ui.h @@ -16,12 +16,12 @@ extern int fMinimizeOnClose; -extern void HandleCtrlA(wxKeyEvent& event); -extern string FormatTxStatus(const CWalletTx& wtx); -extern void UIThreadCall(boost::function0); -extern void MainFrameRepaint(); -extern void Shutdown(void* parg); -extern int ThreadSafeMessageBox(const string& message, const string& caption="Message", int style=wxOK, wxWindow* parent=NULL, int x=-1, int y=-1); +void HandleCtrlA(wxKeyEvent& event); +string FormatTxStatus(const CWalletTx& wtx); +void UIThreadCall(boost::function0); +void MainFrameRepaint(); +void Shutdown(void* parg); +int ThreadSafeMessageBox(const string& message, const string& caption="Message", int style=wxOK, wxWindow* parent=NULL, int x=-1, int y=-1); diff --git a/uibase.cpp b/uibase.cpp index 03bd79122..5b3f9abc2 100644 --- a/uibase.cpp +++ b/uibase.cpp @@ -1,6 +1,3 @@ -// Copyright (c) 2009-2010 Satoshi Nakamoto -// Distributed under the MIT/X11 software license, see the accompanying -// file license.txt or http://www.opensource.org/licenses/mit-license.php. /////////////////////////////////////////////////////////////////////////// // C++ code generated with wxFormBuilder (version Apr 16 2008) // http://www.wxformbuilder.org/ @@ -406,22 +403,14 @@ COptionsDialogBase::COptionsDialogBase( wxWindow* parent, wxWindowID id, const w bSizer64->Add( 0, 16, 0, wxEXPAND, 5 ); - m_staticText321 = new wxStaticText( m_panelTest2, wxID_ANY, _("Test panel 2 for future expansion"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText321 = new wxStaticText( m_panelTest2, wxID_ANY, _("// [don't translate] Test panel 2 for future expansion"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticText321->Wrap( -1 ); bSizer64->Add( m_staticText321, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); - m_staticText69 = new wxStaticText( m_panelTest2, wxID_ANY, _("Let's not start multiple pages until the first page is filled up"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText69 = new wxStaticText( m_panelTest2, wxID_ANY, _("// [don't translate] Let's not start multiple pages until the first page is filled up"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticText69->Wrap( -1 ); bSizer64->Add( m_staticText69, 0, wxALL, 5 ); - m_staticText70 = new wxStaticText( m_panelTest2, wxID_ANY, _("MyLabel"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticText70->Wrap( -1 ); - bSizer64->Add( m_staticText70, 0, wxALL, 5 ); - - m_staticText71 = new wxStaticText( m_panelTest2, wxID_ANY, _("MyLabel"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticText71->Wrap( -1 ); - bSizer64->Add( m_staticText71, 0, wxALL, 5 ); - m_panelTest2->SetSizer( bSizer64 ); m_panelTest2->Layout(); bSizer64->Fit( m_panelTest2 ); @@ -521,7 +510,7 @@ CAboutDialogBase::CAboutDialogBase( wxWindow* parent, wxWindowID id, const wxStr bSizer631->Add( 0, 4, 0, wxEXPAND, 5 ); - m_staticTextMain = new wxStaticText( this, wxID_ANY, _("Copyright © 2009-2010 Satoshi Nakamoto.\n\nThis is experimental software. Do not rely on it for actual financial transactions.\n\nDistributed under the MIT/X11 software license, see the accompanying file \nlicense.txt or http://www.opensource.org/licenses/mit-license.php.\n\nThis product includes software developed by the OpenSSL Project for use in the \nOpenSSL Toolkit (http://www.openssl.org/) and cryptographic software written by \nEric Young (eay@cryptsoft.com)."), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticTextMain = new wxStaticText( this, wxID_ANY, _("Copyright (c) 2009-2010 Satoshi Nakamoto.\n\nThis is experimental software. Do not rely on it for actual financial transactions.\n\nDistributed under the MIT/X11 software license, see the accompanying file \nlicense.txt or http://www.opensource.org/licenses/mit-license.php.\n\nThis product includes software developed by the OpenSSL Project for use in the \nOpenSSL Toolkit (http://www.openssl.org/) and cryptographic software written by \nEric Young (eay@cryptsoft.com)."), wxDefaultPosition, wxDefaultSize, 0 ); m_staticTextMain->Wrap( -1 ); bSizer631->Add( m_staticTextMain, 0, wxALL, 5 ); diff --git a/uibase.h b/uibase.h index 2dfc2af14..494ed10f7 100644 --- a/uibase.h +++ b/uibase.h @@ -1,6 +1,3 @@ -// Copyright (c) 2009-2010 Satoshi Nakamoto -// Distributed under the MIT/X11 software license, see the accompanying -// file license.txt or http://www.opensource.org/licenses/mit-license.php. /////////////////////////////////////////////////////////////////////////// // C++ code generated with wxFormBuilder (version Apr 16 2008) // http://www.wxformbuilder.org/ @@ -178,8 +175,6 @@ class COptionsDialogBase : public wxDialog wxStaticText* m_staticText321; wxStaticText* m_staticText69; - wxStaticText* m_staticText70; - wxStaticText* m_staticText71; wxButton* m_buttonOK; wxButton* m_buttonCancel; wxButton* m_buttonApply; diff --git a/uiproject.fbp b/uiproject.fbp index 5c6eaa55a..988df2a9b 100644 --- a/uiproject.fbp +++ b/uiproject.fbp @@ -2173,7 +2173,7 @@ 0 wxID_ANY - Test panel 2 for future expansion + // [don't translate] Test panel 2 for future expansion m_staticText321 @@ -2224,7 +2224,7 @@ 0 wxID_ANY - Let's not start multiple pages until the first page is filled up + // [don't translate] Let's not start multiple pages until the first page is filled up m_staticText69 @@ -2263,108 +2263,6 @@ - - 5 - wxALL - 0 - - - - 1 - - - 0 - wxID_ANY - MyLabel - - - m_staticText70 - protected - - - - - - - - - -1 - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxALL - 0 - - - - 1 - - - 0 - wxID_ANY - MyLabel - - - m_staticText71 - protected - - - - - - - - - -1 - - - - - - - - - - - - - - - - - - - - - - - - - @@ -2820,7 +2718,7 @@ 0 wxID_ANY - Copyright © 2009-2010 Satoshi Nakamoto. This is experimental software. Do not rely on it for actual financial transactions. Distributed under the MIT/X11 software license, see the accompanying file license.txt or http://www.opensource.org/licenses/mit-license.php. This product includes software developed by the OpenSSL Project for use in the OpenSSL Toolkit (http://www.openssl.org/) and cryptographic software written by Eric Young (eay@cryptsoft.com). + Copyright (c) 2009-2010 Satoshi Nakamoto. This is experimental software. Do not rely on it for actual financial transactions. Distributed under the MIT/X11 software license, see the accompanying file license.txt or http://www.opensource.org/licenses/mit-license.php. This product includes software developed by the OpenSSL Project for use in the OpenSSL Toolkit (http://www.openssl.org/) and cryptographic software written by Eric Young (eay@cryptsoft.com). m_staticTextMain diff --git a/util.cpp b/util.cpp index 2f5be2227..266c1dd7d 100644 --- a/util.cpp +++ b/util.cpp @@ -90,7 +90,7 @@ void RandAddSeedPerfmon() unsigned char pdata[250000]; memset(pdata, 0, sizeof(pdata)); unsigned long nSize = sizeof(pdata); - long ret = RegQueryValueEx(HKEY_PERFORMANCE_DATA, "Global", NULL, NULL, pdata, &nSize); + long ret = RegQueryValueExA(HKEY_PERFORMANCE_DATA, "Global", NULL, NULL, pdata, &nSize); RegCloseKey(HKEY_PERFORMANCE_DATA); if (ret == ERROR_SUCCESS) { @@ -193,7 +193,7 @@ inline int OutputDebugStringF(const char* pszFormat, ...) p2++; char c = *p2; *p2 = '\0'; - OutputDebugString(p1); + OutputDebugStringA(p1); *p2 = c; p1 = p2; } @@ -441,7 +441,7 @@ void FormatException(char* pszMessage, std::exception* pex, const char* pszThrea #ifdef __WXMSW__ char pszModule[MAX_PATH]; pszModule[0] = '\0'; - GetModuleFileName(NULL, pszModule, sizeof(pszModule)); + GetModuleFileNameA(NULL, pszModule, sizeof(pszModule)); #else // might not be thread safe, uses wxString //const char* pszModule = wxStandardPaths::Get().GetExecutablePath().mb_str(); diff --git a/util.h b/util.h index 933c71be0..188a9ece1 100644 --- a/util.h +++ b/util.h @@ -340,10 +340,11 @@ void skipspaces(T& it) ++it; } - - - - +inline const char* wxGetTranslation(const char* psz) +{ + // Return translated UTF-8 const char* + return wxGetTranslation(wxString(psz, wxConvUTF8)).utf8_str(); +}