Make Cert module translateable

This commit is contained in:
Alexey Sokolov committed 2016-01-31 20:09:19 +00:00
1 parent d09a0a0966
commit a4c491888f
3 files changed
+81 -21

No files matched your search

+15 -16
View File
@@ -25,36 +25,35 @@ class CCertMod : public CModule {
public: public:
void Delete(const CString& line) { void Delete(const CString& line) {
if (CFile::Delete(PemFile())) { if (CFile::Delete(PemFile())) {
PutModule("Pem file deleted"); PutModule(t("Pem file deleted"));
} else { } else {
PutModule( PutModule(t(
"The pem file doesn't exist or there was a error deleting the " "The pem file doesn't exist or there was a error deleting the "
"pem file."); "pem file."));
} }
} }
void Info(const CString& line) { void Info(const CString& line) {
if (HasPemFile()) { if (HasPemFile()) {
PutModule("You have a certificate in: " + PemFile()); PutModule(f("You have a certificate in {1}")(PemFile()));
} else { } else {
PutModule( PutModule(t(
"You do not have a certificate. Please use the web interface " "You do not have a certificate. Please use the web interface "
"to add a certificate"); "to add a certificate"));
if (GetUser()->IsAdmin()) { if (GetUser()->IsAdmin()) {
PutModule("Alternatively you can either place one at " + PutModule(f(
PemFile()); "Alternatively you can either place one at {1}")(
PemFile()));
} }
} }
} }
MODCONSTRUCTOR(CCertMod) { MODCONSTRUCTOR(CCertMod) {
AddHelpCommand(); AddHelpCommand();
AddCommand("delete", AddCommand("delete", "", d("Delete the current certificate"),
static_cast<CModCommand::ModCmdFunc>(&CCertMod::Delete), "", [=](const CString& sLine) { Delete(sLine); });
"Delete the current certificate"); AddCommand("info", "", d("Show the current certificate"),
AddCommand("info", [=](const CString& sLine) { Info(sLine); });
static_cast<CModCommand::ModCmdFunc>(&CCertMod::Info), "",
"Show the current certificate");
} }
~CCertMod() override {} ~CCertMod() override {}
@@ -71,7 +70,7 @@ class CCertMod : public CModule {
return CONTINUE; return CONTINUE;
} }
CString GetWebMenuTitle() override { return "Certificate"; } CString GetWebMenuTitle() override { return t("Certificate"); }
bool OnWebRequest(CWebSock& WebSock, const CString& sPageName, bool OnWebRequest(CWebSock& WebSock, const CString& sPageName,
CTemplate& Tmpl) override { CTemplate& Tmpl) override {
@@ -104,4 +103,4 @@ void TModInfo<CCertMod>(CModInfo& Info) {
Info.SetWikiPage("cert"); Info.SetWikiPage("cert");
} }
NETWORKMODULEDEFS(CCertMod, "Use a ssl certificate to connect to a server") NETWORKMODULEDEFS(CCertMod, t("Use a ssl certificate to connect to a server"))
+7 -5
View File
@@ -1,23 +1,25 @@
<? I18N znc-cert ?>
<? INC Header.tmpl ?> <? INC Header.tmpl ?>
<? IF Cert ?> <? IF Cert ?>
<p>You already have a certificate set, use the form below to overwrite the current certificate. Alternatively click <a href="<? VAR URIPrefix TOP ?><? VAR ModPath ?>delete">here</a> to <a href="<? VAR URIPrefix TOP ?><? VAR ModPath ?>delete">delete</a> your certificate.</p> <? SETBLOCK DELLINK ?><a href="<? VAR URIPrefix TOP ?><? VAR ModPath ?>delete"><? FORMAT "here" ?></a><? ENDSETBLOCK ?>
<p><? FORMAT "You already have a certificate set, use the form below to overwrite the current certificate. Alternatively click {1} to delete your certificate." "DELLINK ESC=" ?></p>
<? ELSE ?> <? ELSE ?>
<p>You do not have a cert.</p> <p><? FORMAT "You do not have a certificate yet." ?></p>
<? ENDIF ?> <? ENDIF ?>
<form method="post" action="<? VAR URIPrefix TOP ?><? VAR ModPath ?>update"> <form method="post" action="<? VAR URIPrefix TOP ?><? VAR ModPath ?>update">
<? INC _csrf_check.tmpl ?> <? INC _csrf_check.tmpl ?>
<div class="section"> <div class="section">
<h3>Certificate</h3> <h3><? FORMAT "Certificate" ?></h3>
<div class="sectionbg"> <div class="sectionbg">
<div class="sectionbody"> <div class="sectionbody">
<div class="subsection full"> <div class="subsection full">
<div class="inputlabel">PEM File:</div> <div class="inputlabel"><? FORMAT "PEM File:" ?></div>
<textarea name="cert" style="height: 300px;"></textarea> <textarea name="cert" style="height: 300px;"></textarea>
</div> </div>
<div class="subsection submitline"> <div class="subsection submitline">
<input type="submit" name="add" value="Update" /> <input type="submit" name="add" value="<? FORMAT "Update" ?>" />
</div> </div>
</div> </div>
</div> </div>
+59
View File
@@ -0,0 +1,59 @@
#: cert.cpp:28
msgid "Pem file deleted"
msgstr ""
#: cert.cpp:31
msgid "The pem file doesn't exist or there was a error deleting the pem file."
msgstr ""
#: cert.cpp:38
msgid "You have a certificate in {1}"
msgstr ""
#: cert.cpp:41
msgid ""
"You do not have a certificate. Please use the web interface to add a "
"certificate"
msgstr ""
#: cert.cpp:45
msgid "Alternatively you can either place one at {1}"
msgstr ""
#: cert.cpp:53
msgid "Delete the current certificate"
msgstr ""
#: cert.cpp:55
msgid "Show the current certificate"
msgstr ""
#: cert.cpp:73 modules/po/../data/cert/tmpl/index.tmpl:14
msgid "Certificate"
msgstr ""
#: cert.cpp:106
msgid "Use a ssl certificate to connect to a server"
msgstr ""
#: modules/po/../data/cert/tmpl/index.tmpl:5
msgid "here"
msgstr ""
#: modules/po/../data/cert/tmpl/index.tmpl:6
msgid ""
"You already have a certificate set, use the form below to overwrite the "
"current certificate. Alternatively click {1} to delete your certificate."
msgstr ""
#: modules/po/../data/cert/tmpl/index.tmpl:8
msgid "You do not have a certificate yet."
msgstr ""
#: modules/po/../data/cert/tmpl/index.tmpl:18
msgid "PEM File:"
msgstr ""
#: modules/po/../data/cert/tmpl/index.tmpl:22
msgid "Update"
msgstr ""