OSDN Git Service

Fix issue #940: Replace slow (2)
[winmerge-jp/winmerge-jp.git] / Src / MergeApp.cpp
index aeb986a..1f14b60 100644 (file)
@@ -1,9 +1,8 @@
 #include "StdAfx.h"
 #include "MergeApp.h"
 #include "Merge.h"
-#include "version.h"
+#include "VersionInfo.h"
 #include "paths.h"
-#include "Environment.h"
 #include "Constants.h"
 #include "unicoder.h"
 
@@ -18,12 +17,12 @@ String GetSysError(int nerr /* =-1 */)
                FORMAT_MESSAGE_ALLOCATE_BUFFER | 
                FORMAT_MESSAGE_FROM_SYSTEM | 
                FORMAT_MESSAGE_IGNORE_INSERTS,
-               NULL,
+               nullptr,
                nerr,
                0, // Default language
                (LPTSTR) &lpMsgBuf,
                0,
-               NULL 
+               nullptr 
                ))
        {
                str = (LPCTSTR)lpMsgBuf;
@@ -77,6 +76,16 @@ String tr(const std::string &str)
        return translated_str;
 }
 
+String tr(const char *msgctxt, const std::string &str)
+{
+       String translated_str;
+       if (msgctxt)
+               theApp.TranslateString("\x01\"" + std::string(msgctxt) + "\"" + str, translated_str);
+       else
+               theApp.TranslateString(str, translated_str);
+       return translated_str;
+}
+
 void AppErrorMessageBox(const String& msg)
 {
        AppMsgBox::error(msg);
@@ -142,43 +151,45 @@ int information(const String& msg, int type)
 AboutInfo::AboutInfo()
 {
        CVersionInfo verinfo;
-       version = string_format_string1(_("Version %1"), verinfo.GetProductVersion());
+       version = strutils::format_string1(_("Version %1"), verinfo.GetProductVersion());
+       private_build = verinfo.GetPrivateBuild();
+       if (!private_build.empty())
+       {
+               version += _T(" + ") + private_build;
+       }
+
        if (version.find(_T(" - ")) != String::npos)
        {
-               string_replace(version, _T(" - "), _T("\n"));
+               strutils::replace(version, _T(" - "), _T("\n"));
                version += _T(" ");
        }
        else
        {
                version += _T("\n");
        }
-#ifdef _UNICODE
-       version += _T(" ");
-       version += _("Unicode");
-#endif
 
 #if defined _M_IX86
-       version += _T(" x86");
+       version += _T(" ");
+       version += _T("x86");
 #elif defined _M_IA64
        version += _T(" IA64");
 #elif defined _M_X64
        version += _T(" ");
        version += _("X64");
+#elif defined _M_ARM64
+       version += _T(" ARM64");
+#endif
+
+#if defined _DEBUG
+       version += _T(" (");
+       version += _T("Debug");
+       version += _T(")");
 #endif
 
        copyright = _("WinMerge comes with ABSOLUTELY NO WARRANTY. This is free software and you are welcome to redistribute it under certain circumstances; see the GNU General Public License in the Help menu for details.");
        copyright += _T("\n");
        copyright += verinfo.GetLegalCopyright();
-       copyright += _T(" All rights reserved.");
-
-       private_build = verinfo.GetPrivateBuild();
-       if (!private_build.empty())
-       {
-               private_build = string_format_string1(_("Private Build: %1"), private_build);
-       }
+       copyright += _T(" - All rights reserved.");
 
        website = WinMergeURL;
-
-       developers = _("Developers:\nDean Grimm, Christian List, Kimmo Varis, Jochen Tucht, Tim Gerundt, Takashi Sawanaki, Gal Hammer, Alexander Skinner");
-       string_replace(developers, _T(", "), _T("\n"));
 }