More translateable strings (fix #1354)

This commit is contained in:
Alexey Sokolov
2018-04-03 22:30:18 +01:00
parent f3ddbccedd
commit 9de990715b
4 changed files with 27 additions and 24 deletions
+2 -1
View File
@@ -21,6 +21,7 @@
#include <znc/Utils.h>
#include <znc/Buffer.h>
#include <znc/Nick.h>
#include <znc/Translation.h>
#include <set>
#include <vector>
@@ -34,7 +35,7 @@ class CIRCSock;
class CUserTimer;
class CServer;
class CUser {
class CUser : private CCoreTranslationMixin {
public:
CUser(const CString& sUserName);
~CUser();
+3 -1
View File
@@ -35,7 +35,7 @@ class CConfigWriteTimer;
class CConfig;
class CFile;
class CZNC {
class CZNC : private CCoreTranslationMixin {
public:
CZNC();
~CZNC();
@@ -253,6 +253,8 @@ class CZNC {
static void DumpConfig(const CConfig* Config);
private:
static CString FormatBindError();
CFile* InitPidFile();
bool ReadConfig(CConfig& config, CString& sError);
+11 -11
View File
@@ -504,11 +504,11 @@ bool CUser::ParseConfig(CConfig* pConfig, CString& sError) {
CIRCNetwork* CUser::AddNetwork(const CString& sNetwork, CString& sErrorRet) {
if (!CIRCNetwork::IsValidNetwork(sNetwork)) {
sErrorRet =
"Invalid network name. It should be alphanumeric. Not to be "
"confused with server name";
t_s("Invalid network name. It should be alphanumeric. Not to be "
"confused with server name");
return nullptr;
} else if (FindNetwork(sNetwork)) {
sErrorRet = "Network [" + sNetwork.Token(0) + "] already exists";
sErrorRet = t_f("Network {1} already exists")(sNetwork);
return nullptr;
}
@@ -674,8 +674,8 @@ void CUser::UserConnected(CClient* pClient) {
BounceAllClients();
}
pClient->PutClient(":irc.znc.in 001 " + pClient->GetNick() +
" :- Welcome to ZNC -");
pClient->PutClient(":irc.znc.in 001 " + pClient->GetNick() + " :" +
t_s("Welcome to ZNC"));
m_vClients.push_back(pClient);
}
@@ -774,8 +774,8 @@ bool CUser::Clone(const CUser& User, CString& sErrorRet, bool bCloneNetworks) {
for (CClient* pSock : m_vClients) {
if (!IsHostAllowed(pSock->GetRemoteIP())) {
pSock->PutStatusNotice(
"You are being disconnected because your IP is no longer "
"allowed to connect to this user");
t_s("You are being disconnected because your IP is no longer "
"allowed to connect to this user"));
pSock->Close();
}
}
@@ -904,17 +904,17 @@ bool CUser::IsValid(CString& sErrMsg, bool bSkipPass) const {
sErrMsg.clear();
if (!bSkipPass && m_sPass.empty()) {
sErrMsg = "Pass is empty";
sErrMsg = t_s("Password is empty");
return false;
}
if (m_sUserName.empty()) {
sErrMsg = "Username is empty";
sErrMsg = t_s("Username is empty");
return false;
}
if (!CUser::IsValidUserName(m_sUserName)) {
sErrMsg = "Username is invalid";
sErrMsg = t_s("Username is invalid");
return false;
}
@@ -1185,7 +1185,7 @@ bool CUser::LoadModule(const CString& sModName, const CString& sArgs,
CModInfo ModInfo;
if (!CZNC::Get().GetModules().GetModInfo(ModInfo, sModName, sModRet)) {
sError = "Unable to find modinfo [" + sModName + "] [" + sModRet + "]";
sError = t_f("Unable to find modinfo {1}: {2}")(sModName, sModRet);
return false;
}
+11 -11
View File
@@ -34,12 +34,6 @@ using std::list;
using std::tuple;
using std::make_tuple;
static inline CString FormatBindError() {
CString sError = (errno == 0 ? CString("unknown error, check the host name")
: CString(strerror(errno)));
return "Unable to bind [" + sError + "]";
}
CZNC::CZNC()
: m_TimeStarted(time(nullptr)),
m_eConfigState(ECONFIG_NOTHING),
@@ -1566,7 +1560,7 @@ bool CZNC::DeleteUser(const CString& sUsername) {
bool CZNC::AddUser(CUser* pUser, CString& sErrorRet, bool bStartup) {
if (FindUser(pUser->GetUserName()) != nullptr) {
sErrorRet = "User already exists";
sErrorRet = t_s("User already exists");
DEBUG("User [" << pUser->GetUserName() << "] - already exists");
return false;
}
@@ -1674,7 +1668,7 @@ bool CZNC::AddListener(unsigned short uPort, const CString& sBindHost,
#ifndef HAVE_IPV6
if (ADDR_IPV6ONLY == eAddr) {
sError = "IPV6 is not enabled";
sError = t_s("IPv6 is not enabled");
CUtils::PrintStatus(false, sError);
return false;
}
@@ -1682,7 +1676,7 @@ bool CZNC::AddListener(unsigned short uPort, const CString& sBindHost,
#ifndef HAVE_LIBSSL
if (bSSL) {
sError = "SSL is not enabled";
sError = t_s("SSL is not enabled");
CUtils::PrintStatus(false, sError);
return false;
}
@@ -1690,7 +1684,7 @@ bool CZNC::AddListener(unsigned short uPort, const CString& sBindHost,
CString sPemFile = GetPemLocation();
if (bSSL && !CFile::Exists(sPemFile)) {
sError = "Unable to locate pem file: [" + sPemFile + "]";
sError = t_f("Unable to locate pem file: {1}")(sPemFile);
CUtils::PrintStatus(false, sError);
// If stdin is e.g. /dev/null and we call GetBoolInput(),
@@ -1709,7 +1703,7 @@ bool CZNC::AddListener(unsigned short uPort, const CString& sBindHost,
}
#endif
if (!uPort) {
sError = "Invalid port";
sError = t_s("Invalid port");
CUtils::PrintStatus(false, sError);
return false;
}
@@ -1822,6 +1816,12 @@ bool CZNC::DelListener(CListener* pListener) {
return false;
}
CString CZNC::FormatBindError() {
CString sError = (errno == 0 ? t_s(("unknown error, check the host name"))
: CString(strerror(errno)));
return t_f("Unable to bind: {1}")(sError);
}
static CZNC* s_pZNC = nullptr;
void CZNC::CreateInstance() {