2323#include < util/moneystr.h>
2424#include < util/string.h>
2525#include < util/system.h>
26+ #include < util/translation.h>
2627#include < util/url.h>
2728#include < util/vector.h>
2829#include < wallet/coincontrol.h>
@@ -2589,14 +2590,14 @@ static UniValue loadwallet(const JSONRPCRequest& request)
25892590 }
25902591 }
25912592
2592- std::string error;
2593- std::vector<std::string> warning ;
2594- std::shared_ptr<CWallet> const wallet = LoadWallet (*g_rpc_chain, location, error, warning );
2595- if (!wallet) throw JSONRPCError (RPC_WALLET_ERROR, error);
2593+ bilingual_str error;
2594+ std::vector<bilingual_str> warnings ;
2595+ std::shared_ptr<CWallet> const wallet = LoadWallet (*g_rpc_chain, location, error, warnings );
2596+ if (!wallet) throw JSONRPCError (RPC_WALLET_ERROR, error. original );
25962597
25972598 UniValue obj (UniValue::VOBJ);
25982599 obj.pushKV (" name" , wallet->GetName ());
2599- obj.pushKV (" warning" , Join (warning , " \n " ));
2600+ obj.pushKV (" warning" , Join (warnings , " \n " , OpOriginal ));
26002601
26012602 return obj;
26022603}
@@ -2705,12 +2706,12 @@ static UniValue createwallet(const JSONRPCRequest& request)
27052706 }
27062707 SecureString passphrase;
27072708 passphrase.reserve (100 );
2708- std::vector<std::string > warnings;
2709+ std::vector<bilingual_str > warnings;
27092710 if (!request.params [3 ].isNull ()) {
27102711 passphrase = request.params [3 ].get_str ().c_str ();
27112712 if (passphrase.empty ()) {
27122713 // Empty string means unencrypted
2713- warnings.emplace_back (" Empty string given as passphrase, wallet will not be encrypted." );
2714+ warnings.emplace_back (Untranslated ( " Empty string given as passphrase, wallet will not be encrypted." ) );
27142715 }
27152716 }
27162717
@@ -2721,22 +2722,22 @@ static UniValue createwallet(const JSONRPCRequest& request)
27212722 flags |= WALLET_FLAG_DESCRIPTORS;
27222723 }
27232724
2724- std::string error;
2725+ bilingual_str error;
27252726 std::shared_ptr<CWallet> wallet;
27262727 WalletCreationStatus status = CreateWallet (*g_rpc_chain, passphrase, flags, request.params [0 ].get_str (), error, warnings, wallet);
27272728 switch (status) {
27282729 case WalletCreationStatus::CREATION_FAILED:
2729- throw JSONRPCError (RPC_WALLET_ERROR, error);
2730+ throw JSONRPCError (RPC_WALLET_ERROR, error. original );
27302731 case WalletCreationStatus::ENCRYPTION_FAILED:
2731- throw JSONRPCError (RPC_WALLET_ENCRYPTION_FAILED, error);
2732+ throw JSONRPCError (RPC_WALLET_ENCRYPTION_FAILED, error. original );
27322733 case WalletCreationStatus::SUCCESS:
27332734 break ;
27342735 // no default case, so the compiler can warn about missing cases
27352736 }
27362737
27372738 UniValue obj (UniValue::VOBJ);
27382739 obj.pushKV (" name" , wallet->GetName ());
2739- obj.pushKV (" warning" , Join (warnings, " \n " ));
2740+ obj.pushKV (" warning" , Join (warnings, " \n " , OpOriginal ));
27402741
27412742 return obj;
27422743}
@@ -4239,12 +4240,12 @@ static UniValue upgradewallet(const JSONRPCRequest& request)
42394240 version = request.params [0 ].get_int ();
42404241 }
42414242
4242- std::string error;
4243- std::vector<std::string > warnings;
4243+ bilingual_str error;
4244+ std::vector<bilingual_str > warnings;
42444245 if (!pwallet->UpgradeWallet (version, error, warnings)) {
4245- throw JSONRPCError (RPC_WALLET_ERROR, error);
4246+ throw JSONRPCError (RPC_WALLET_ERROR, error. original );
42464247 }
4247- return error;
4248+ return error. original ;
42484249}
42494250
42504251UniValue abortrescan (const JSONRPCRequest& request); // in rpcdump.cpp
0 commit comments