add PIString::lineNumber() method
add ""_tr literal to translate string by PITranslator add pip_tr util, now useless, only can generate *.ts add qt_support internal lib, now only works with *.ts file pip_vtt migrate to qt_support
This commit is contained in:
@@ -66,6 +66,11 @@ void PITranslator::loadConfig(const PIString & content) {
|
||||
for (const auto & s: cn.children())
|
||||
c->add(s.name(), s.value().toString());
|
||||
}
|
||||
auto c = s->createContextInternal("");
|
||||
for (const auto & s: lang.children()) {
|
||||
if (s.hasChildren()) continue;
|
||||
c->add(s.name(), s.value().toString());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -26,9 +26,10 @@
|
||||
#ifndef pitranslator_H
|
||||
#define pitranslator_H
|
||||
|
||||
#include "pifile.h"
|
||||
#include "piiostream.h"
|
||||
#include "pithread.h"
|
||||
#include "pistring.h"
|
||||
|
||||
|
||||
#define piTr PITranslator::tr
|
||||
|
||||
//! \ingroup Application
|
||||
//! \~\brief
|
||||
@@ -37,7 +38,7 @@
|
||||
class PIP_EXPORT PITranslator {
|
||||
public:
|
||||
static PIString tr(const PIString & in, const PIString & context = {});
|
||||
static PIString tr(const char * in, const PIString & context = {}) { return tr(PIString(in), context); }
|
||||
static PIString tr(const char * in, const PIString & context = {}) { return tr(PIString::fromUTF8(in), context); }
|
||||
|
||||
static void clear();
|
||||
static void loadLang(const PIString & short_lang);
|
||||
@@ -61,4 +62,11 @@ private:
|
||||
PIMap<uint, Context *> contexts;
|
||||
};
|
||||
|
||||
//! \~\brief
|
||||
//! \~english PIString from UTF-8
|
||||
//! \~russian PIString из UTF-8
|
||||
inline PIString operator""_tr(const char * v, size_t sz) {
|
||||
return PITranslator::tr(PIString::fromUTF8(v, sz));
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user