Skip to content

Commit 753f7cc

Browse files
committed
scripted-diff: Make translation bilingual
-BEGIN VERIFY SCRIPT- sed -i 's/inline std::string _(const char\* psz)/inline bilingual_str _(const char\* psz)/' src/util/translation.h sed -i 's/return G_TRANSLATION_FUN ? (G_TRANSLATION_FUN)(psz) : psz;/return bilingual_str{psz, G_TRANSLATION_FUN ? (G_TRANSLATION_FUN)(psz) : psz};/' src/util/translation.h sed -i 's/\b_("\([^"]\|\\"\)*")/&.translated/g' $(git grep --files-with-matches '\b_("' src) echo Hard cases - multiline strings. sed -i 's/"Visit %s for further information about the software.")/&.translated/g' src/init.cpp sed -i "s/\"Only rebuild the block database if you are sure that your computer's date and time are correct\")/&.translated/g" src/init.cpp sed -i 's/" restore from a backup.")/&.translated/g' src/wallet/db.cpp sed -i 's/" or address book entries might be missing or incorrect.")/&.translated/g' src/wallet/wallet.cpp echo Special case. sed -i 's/_(COPYRIGHT_HOLDERS)/&.translated/' src/util/system.cpp test/lint/lint-format-strings.py -END VERIFY SCRIPT-
1 parent 7c45e14 commit 753f7cc

19 files changed

+147
-147
lines changed

src/banman.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
BanMan::BanMan(fs::path ban_file, CClientUIInterface* client_interface, int64_t default_ban_time)
1616
: m_client_interface(client_interface), m_ban_db(std::move(ban_file)), m_default_ban_time(default_ban_time)
1717
{
18-
if (m_client_interface) m_client_interface->InitMessage(_("Loading banlist..."));
18+
if (m_client_interface) m_client_interface->InitMessage(_("Loading banlist...").translated);
1919

2020
int64_t n_start = GetTimeMillis();
2121
m_is_dirty = false;

src/httprpc.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ static bool InitRPCAuthentication()
219219
LogPrintf("No rpcpassword set - using random cookie authentication.\n");
220220
if (!GenerateAuthCookie(&strRPCUserColonPass)) {
221221
uiInterface.ThreadSafeMessageBox(
222-
_("Error: A fatal internal error occurred, see debug.log for details"), // Same message as AbortNode
222+
_("Error: A fatal internal error occurred, see debug.log for details").translated, // Same message as AbortNode
223223
"", CClientUIInterface::MSG_ERROR);
224224
return false;
225225
}

src/index/txindex.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ bool TxIndex::DB::MigrateData(CBlockTreeDB& block_tree_db, const CBlockLocator&
138138

139139
int64_t count = 0;
140140
LogPrintf("Upgrading txindex database... [0%%]\n");
141-
uiInterface.ShowProgress(_("Upgrading txindex database"), 0, true);
141+
uiInterface.ShowProgress(_("Upgrading txindex database").translated, 0, true);
142142
int report_done = 0;
143143
const size_t batch_size = 1 << 24; // 16 MiB
144144

@@ -175,7 +175,7 @@ bool TxIndex::DB::MigrateData(CBlockTreeDB& block_tree_db, const CBlockLocator&
175175
(static_cast<uint32_t>(*(txid.begin() + 1)) << 0);
176176
int percentage_done = (int)(high_nibble * 100.0 / 65536.0 + 0.5);
177177

178-
uiInterface.ShowProgress(_("Upgrading txindex database"), percentage_done, true);
178+
uiInterface.ShowProgress(_("Upgrading txindex database").translated, percentage_done, true);
179179
if (report_done < percentage_done/10) {
180180
LogPrintf("Upgrading txindex database... [%d%%]\n", percentage_done);
181181
report_done = percentage_done/10;

src/init.cpp

Lines changed: 56 additions & 56 deletions
Large diffs are not rendered by default.

src/net.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2040,9 +2040,9 @@ bool CConnman::BindListenPort(const CService &addrBind, std::string& strError, b
20402040
{
20412041
int nErr = WSAGetLastError();
20422042
if (nErr == WSAEADDRINUSE)
2043-
strError = strprintf(_("Unable to bind to %s on this computer. %s is probably already running."), addrBind.ToString(), PACKAGE_NAME);
2043+
strError = strprintf(_("Unable to bind to %s on this computer. %s is probably already running.").translated, addrBind.ToString(), PACKAGE_NAME);
20442044
else
2045-
strError = strprintf(_("Unable to bind to %s on this computer (bind returned error %s)"), addrBind.ToString(), NetworkErrorString(nErr));
2045+
strError = strprintf(_("Unable to bind to %s on this computer (bind returned error %s)").translated, addrBind.ToString(), NetworkErrorString(nErr));
20462046
LogPrintf("%s\n", strError);
20472047
CloseSocket(hListenSocket);
20482048
return false;
@@ -2052,7 +2052,7 @@ bool CConnman::BindListenPort(const CService &addrBind, std::string& strError, b
20522052
// Listen for incoming connections
20532053
if (listen(hListenSocket, SOMAXCONN) == SOCKET_ERROR)
20542054
{
2055-
strError = strprintf(_("Error: Listening for incoming connections failed (listen returned error %s)"), NetworkErrorString(WSAGetLastError()));
2055+
strError = strprintf(_("Error: Listening for incoming connections failed (listen returned error %s)").translated, NetworkErrorString(WSAGetLastError()));
20562056
LogPrintf("%s\n", strError);
20572057
CloseSocket(hListenSocket);
20582058
return false;
@@ -2193,7 +2193,7 @@ bool CConnman::Start(CScheduler& scheduler, const Options& connOptions)
21932193
if (fListen && !InitBinds(connOptions.vBinds, connOptions.vWhiteBinds)) {
21942194
if (clientInterface) {
21952195
clientInterface->ThreadSafeMessageBox(
2196-
_("Failed to listen on any port. Use -listen=0 if you want this."),
2196+
_("Failed to listen on any port. Use -listen=0 if you want this.").translated,
21972197
"", CClientUIInterface::MSG_ERROR);
21982198
}
21992199
return false;
@@ -2204,7 +2204,7 @@ bool CConnman::Start(CScheduler& scheduler, const Options& connOptions)
22042204
}
22052205

22062206
if (clientInterface) {
2207-
clientInterface->InitMessage(_("Loading P2P addresses..."));
2207+
clientInterface->InitMessage(_("Loading P2P addresses...").translated);
22082208
}
22092209
// Load addresses from peers.dat
22102210
int64_t nStart = GetTimeMillis();
@@ -2219,7 +2219,7 @@ bool CConnman::Start(CScheduler& scheduler, const Options& connOptions)
22192219
}
22202220
}
22212221

2222-
uiInterface.InitMessage(_("Starting network threads..."));
2222+
uiInterface.InitMessage(_("Starting network threads...").translated);
22232223

22242224
fAddressesInitialized = true;
22252225

@@ -2259,7 +2259,7 @@ bool CConnman::Start(CScheduler& scheduler, const Options& connOptions)
22592259
if (connOptions.m_use_addrman_outgoing && !connOptions.m_specified_outgoing.empty()) {
22602260
if (clientInterface) {
22612261
clientInterface->ThreadSafeMessageBox(
2262-
_("Cannot provide specific connections and have addrman find outgoing connections at the same."),
2262+
_("Cannot provide specific connections and have addrman find outgoing connections at the same.").translated,
22632263
"", CClientUIInterface::MSG_ERROR);
22642264
}
22652265
return false;

src/qt/splashscreen.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,8 +168,8 @@ static void InitMessage(SplashScreen *splash, const std::string &message)
168168
static void ShowProgress(SplashScreen *splash, const std::string &title, int nProgress, bool resume_possible)
169169
{
170170
InitMessage(splash, title + std::string("\n") +
171-
(resume_possible ? _("(press q to shutdown and continue later)")
172-
: _("press q to shutdown")) +
171+
(resume_possible ? _("(press q to shutdown and continue later)").translated
172+
: _("press q to shutdown").translated) +
173173
strprintf("\n%d", nProgress) + "%");
174174
}
175175
#ifdef ENABLE_WALLET

src/timedata.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ void AddTimeData(const CNetAddr& ip, int64_t nOffsetSample)
101101
if (!fMatch)
102102
{
103103
fDone = true;
104-
std::string strMessage = strprintf(_("Please check that your computer's date and time are correct! If your clock is wrong, %s will not work properly."), PACKAGE_NAME);
104+
std::string strMessage = strprintf(_("Please check that your computer's date and time are correct! If your clock is wrong, %s will not work properly.").translated, PACKAGE_NAME);
105105
SetMiscWarning(strMessage);
106106
uiInterface.ThreadSafeMessageBox(strMessage, "", CClientUIInterface::MSG_WARNING);
107107
}

src/txdb.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,7 @@ bool CCoinsViewDB::Upgrade() {
358358
int64_t count = 0;
359359
LogPrintf("Upgrading utxo-set database...\n");
360360
LogPrintf("[0%%]..."); /* Continued */
361-
uiInterface.ShowProgress(_("Upgrading UTXO database"), 0, true);
361+
uiInterface.ShowProgress(_("Upgrading UTXO database").translated, 0, true);
362362
size_t batch_size = 1 << 24;
363363
CDBBatch batch(db);
364364
int reportDone = 0;
@@ -373,7 +373,7 @@ bool CCoinsViewDB::Upgrade() {
373373
if (count++ % 256 == 0) {
374374
uint32_t high = 0x100 * *key.second.begin() + *(key.second.begin() + 1);
375375
int percentageDone = (int)(high * 100.0 / 65536.0 + 0.5);
376-
uiInterface.ShowProgress(_("Upgrading UTXO database"), percentageDone, true);
376+
uiInterface.ShowProgress(_("Upgrading UTXO database").translated, percentageDone, true);
377377
if (reportDone < percentageDone/10) {
378378
// report max. every 10% step
379379
LogPrintf("[%d%%]...", percentageDone); /* Continued */

src/util/error.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,10 @@ std::string TransactionErrorString(const TransactionError err)
3838

3939
std::string AmountHighWarn(const std::string& optname)
4040
{
41-
return strprintf(_("%s is set very high!"), optname);
41+
return strprintf(_("%s is set very high!").translated, optname);
4242
}
4343

4444
std::string AmountErrMsg(const char* const optname, const std::string& strValue)
4545
{
46-
return strprintf(_("Invalid amount for -%s=<amount>: '%s'"), optname, strValue);
46+
return strprintf(_("Invalid amount for -%s=<amount>: '%s'").translated, optname, strValue);
4747
}

src/util/system.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1185,7 +1185,7 @@ int GetNumCores()
11851185

11861186
std::string CopyrightHolders(const std::string& strPrefix)
11871187
{
1188-
const auto copyright_devs = strprintf(_(COPYRIGHT_HOLDERS), COPYRIGHT_HOLDERS_SUBSTITUTION);
1188+
const auto copyright_devs = strprintf(_(COPYRIGHT_HOLDERS).translated, COPYRIGHT_HOLDERS_SUBSTITUTION);
11891189
std::string strCopyrightHolders = strPrefix + copyright_devs;
11901190

11911191
// Make sure Bitcoin Core copyright is not removed by accident

0 commit comments

Comments
 (0)