mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-04-28 19:57:48 +02:00
Merge https://github.com/PurpleI2P/i2pd into ui
This commit is contained in:
commit
feed4c8d4b
7 changed files with 24 additions and 20 deletions
|
@ -472,7 +472,7 @@ namespace http {
|
|||
std::string webroot; i2p::config::GetOption("http.webroot", webroot);
|
||||
|
||||
// Page language
|
||||
std::string currLang = i2p::context.GetLanguage ()->GetLanguage(); // get current used language
|
||||
std::string currLang = i2p::client::context.GetLanguage ()->GetLanguage(); // get current used language
|
||||
auto it = i2p::i18n::languages.find(currLang);
|
||||
std::string langCode = it->second.ShortCode;
|
||||
// SAM
|
||||
|
@ -1340,7 +1340,7 @@ namespace http {
|
|||
s << "</form>\r\n</div>\r\n</th></tr>\r\n";
|
||||
}
|
||||
|
||||
std::string currLang = i2p::context.GetLanguage ()->GetLanguage(); // get current used language
|
||||
std::string currLang = i2p::client::context.GetLanguage ()->GetLanguage(); // get current used language
|
||||
s << "<tr class=\"sectiontitle\"><th colspan=\"2\"><span>" << tr("Console Display Language") << "</span>\r\n";
|
||||
s << "<div id=\"consolelang\" class=\"chrome\">\r\n";
|
||||
s << "<form method=\"get\" action=\"" << webroot << "\">\r\n";
|
||||
|
@ -2123,7 +2123,7 @@ namespace http {
|
|||
else if (cmd == HTTP_COMMAND_SETLANGUAGE)
|
||||
{
|
||||
std::string lang = params["lang"];
|
||||
std::string currLang = i2p::context.GetLanguage ()->GetLanguage();
|
||||
std::string currLang = i2p::client::context.GetLanguage ()->GetLanguage();
|
||||
|
||||
if (currLang.compare(lang) != 0)
|
||||
i2p::i18n::SetLanguage(lang);
|
||||
|
|
10
i18n/I18N.h
10
i18n/I18N.h
|
@ -9,7 +9,7 @@
|
|||
#ifndef __I18N_H__
|
||||
#define __I18N_H__
|
||||
|
||||
#include "RouterContext.h"
|
||||
#include "ClientContext.h"
|
||||
|
||||
namespace i2p
|
||||
{
|
||||
|
@ -19,19 +19,19 @@ namespace i18n
|
|||
{
|
||||
const auto it = i2p::i18n::languages.find(lang);
|
||||
if (it == i2p::i18n::languages.end()) // fallback
|
||||
i2p::context.SetLanguage (i2p::i18n::english::GetLocale());
|
||||
i2p::client::context.SetLanguage (i2p::i18n::english::GetLocale());
|
||||
else
|
||||
i2p::context.SetLanguage (it->second.LocaleFunc());
|
||||
i2p::client::context.SetLanguage (it->second.LocaleFunc());
|
||||
}
|
||||
|
||||
inline std::string translate (const std::string& arg)
|
||||
{
|
||||
return i2p::context.GetLanguage ()->GetString (arg);
|
||||
return i2p::client::context.GetLanguage ()->GetString (arg);
|
||||
}
|
||||
|
||||
inline std::string translate (const std::string& arg, const std::string& arg2, const int& n)
|
||||
{
|
||||
return i2p::context.GetLanguage ()->GetPlural (arg, arg2, n);
|
||||
return i2p::client::context.GetLanguage ()->GetPlural (arg, arg2, n);
|
||||
}
|
||||
} // i18n
|
||||
} // i2p
|
||||
|
|
|
@ -139,6 +139,7 @@ namespace client
|
|||
void SetLeaseSetUpdated ();
|
||||
|
||||
bool IsPublic () const { return m_IsPublic; };
|
||||
void SetPublic (bool pub) { m_IsPublic = pub; };
|
||||
|
||||
protected:
|
||||
|
||||
|
|
|
@ -18,7 +18,6 @@
|
|||
#include "Identity.h"
|
||||
#include "RouterInfo.h"
|
||||
#include "Garlic.h"
|
||||
#include "I18N_langs.h"
|
||||
|
||||
namespace i2p
|
||||
{
|
||||
|
@ -146,10 +145,6 @@ namespace garlic
|
|||
void ProcessGarlicMessage (std::shared_ptr<I2NPMessage> msg);
|
||||
void ProcessDeliveryStatusMessage (std::shared_ptr<I2NPMessage> msg);
|
||||
|
||||
// i18n
|
||||
std::shared_ptr<const i2p::i18n::Locale> GetLanguage () { return m_Language; };
|
||||
void SetLanguage (const std::shared_ptr<const i2p::i18n::Locale> language) { m_Language = language; };
|
||||
|
||||
protected:
|
||||
|
||||
// implements GarlicDestination
|
||||
|
@ -186,9 +181,6 @@ namespace garlic
|
|||
std::unique_ptr<i2p::crypto::X25519Keys> m_StaticKeys;
|
||||
// for ECIESx25519
|
||||
i2p::crypto::NoiseSymmetricState m_InitialNoiseState, m_CurrentNoiseState;
|
||||
|
||||
// i18n
|
||||
std::shared_ptr<const i2p::i18n::Locale> m_Language;
|
||||
};
|
||||
|
||||
extern RouterContext context;
|
||||
|
|
|
@ -713,7 +713,10 @@ namespace client
|
|||
std::shared_ptr<ClientDestination> localDestination = nullptr;
|
||||
auto it = destinations.find (keys);
|
||||
if (it != destinations.end ())
|
||||
{
|
||||
localDestination = it->second;
|
||||
localDestination->SetPublic (true);
|
||||
}
|
||||
else
|
||||
{
|
||||
i2p::data::PrivateKeys k;
|
||||
|
@ -725,6 +728,8 @@ namespace client
|
|||
localDestination = CreateNewLocalDestination (k, true, &options);
|
||||
destinations[keys] = localDestination;
|
||||
}
|
||||
else
|
||||
localDestination->SetPublic (true);
|
||||
}
|
||||
if (type == I2P_TUNNELS_SECTION_TYPE_UDPSERVER)
|
||||
{
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
#include "BOB.h"
|
||||
#include "I2CP.h"
|
||||
#include "AddressBook.h"
|
||||
#include "I18N_langs.h"
|
||||
|
||||
namespace i2p
|
||||
{
|
||||
|
@ -102,6 +103,10 @@ namespace client
|
|||
|
||||
std::vector<std::shared_ptr<DatagramSessionInfo> > GetForwardInfosFor(const i2p::data::IdentHash & destination);
|
||||
|
||||
// i18n
|
||||
std::shared_ptr<const i2p::i18n::Locale> GetLanguage () { return m_Language; };
|
||||
void SetLanguage (const std::shared_ptr<const i2p::i18n::Locale> language) { m_Language = language; };
|
||||
|
||||
private:
|
||||
|
||||
void ReadTunnels ();
|
||||
|
@ -149,6 +154,9 @@ namespace client
|
|||
|
||||
std::unique_ptr<boost::asio::deadline_timer> m_CleanupUDPTimer;
|
||||
|
||||
// i18n
|
||||
std::shared_ptr<const i2p::i18n::Locale> m_Language;
|
||||
|
||||
public:
|
||||
|
||||
// for HTTP
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
CXXFLAGS += -Wall -Wno-unused-parameter -Wextra -pedantic -O0 -g -std=c++11 -D_GLIBCXX_USE_NANOSLEEP=1 -pthread -Wl,--unresolved-symbols=ignore-in-object-files
|
||||
INCFLAGS += -I../libi2pd -I../i18n
|
||||
|
||||
LOCALESRC = ../i18n/Afrikaans.cpp ../i18n/English.cpp ../i18n/Russian.cpp ../i18n/Turkmen.cpp ../i18n/Ukrainian.cpp ../i18n/Uzbek.cpp
|
||||
INCFLAGS += -I../libi2pd
|
||||
|
||||
TESTS = test-gost test-gost-sig test-base-64 test-x25519 test-aeadchacha20poly1305 test-blinding test-elligator
|
||||
|
||||
|
@ -25,7 +23,7 @@ test-x25519: ../libi2pd/Ed25519.cpp ../libi2pd/I2PEndian.cpp ../libi2pd/Log.cpp
|
|||
test-aeadchacha20poly1305: ../libi2pd/Crypto.cpp ../libi2pd/ChaCha20.cpp ../libi2pd/Poly1305.cpp test-aeadchacha20poly1305.cpp
|
||||
$(CXX) $(CXXFLAGS) $(NEEDED_CXXFLAGS) $(INCFLAGS) -o $@ $^ -lcrypto -lssl -lboost_system
|
||||
|
||||
test-blinding: ../libi2pd/Crypto.cpp ../libi2pd/Blinding.cpp ../libi2pd/Ed25519.cpp ../libi2pd/I2PEndian.cpp ../libi2pd/Log.cpp ../libi2pd/util.cpp ../libi2pd/Identity.cpp ../libi2pd/Signature.cpp ../libi2pd/Timestamp.cpp $(LOCALESRC) test-blinding.cpp
|
||||
test-blinding: ../libi2pd/Crypto.cpp ../libi2pd/Blinding.cpp ../libi2pd/Ed25519.cpp ../libi2pd/I2PEndian.cpp ../libi2pd/Log.cpp ../libi2pd/util.cpp ../libi2pd/Identity.cpp ../libi2pd/Signature.cpp ../libi2pd/Timestamp.cpp test-blinding.cpp
|
||||
$(CXX) $(CXXFLAGS) $(NEEDED_CXXFLAGS) $(INCFLAGS) -o $@ $^ -lcrypto -lssl -lboost_system
|
||||
|
||||
test-elligator: ../libi2pd/Elligator.cpp ../libi2pd/Crypto.cpp test-elligator.cpp
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue