Translation set database and other translation sets added
This commit is contained in:
parent
acbae76737
commit
6dff6eed4f
@ -102,6 +102,12 @@ bool ZRColaApp::OnInit()
|
||||
wxFAIL_MSG(wxT("Error reading translation data from ZRCola.zrcdb."));
|
||||
m_t_db.clear();
|
||||
}
|
||||
} else if (id == ZRCola::transet_rec::id) {
|
||||
dat >> ZRCola::transet_rec(m_ts_db);
|
||||
if (!dat.good()) {
|
||||
wxFAIL_MSG(wxT("Error reading translation set data from ZRCola.zrcdb."));
|
||||
m_ts_db.clear();
|
||||
}
|
||||
} else if (id == ZRCola::langchar_rec::id) {
|
||||
dat >> ZRCola::langchar_rec(m_lc_db);
|
||||
if (!dat.good()) {
|
||||
|
@ -73,6 +73,7 @@ public:
|
||||
|
||||
public:
|
||||
ZRCola::translation_db m_t_db; ///< Translation database
|
||||
ZRCola::transet_db m_ts_db; ///< Translation set database
|
||||
ZRCola::langchar_db m_lc_db; ///< Language character database
|
||||
ZRCola::language_db m_lang_db; ///< Language database
|
||||
ZRCola::keyseq_db m_ks_db; ///< Key sequence database
|
||||
|
@ -249,6 +249,8 @@ ZRCola::DBSource::DBSource()
|
||||
ZRCola::DBSource::~DBSource()
|
||||
{
|
||||
// Manually release all COM objects related to the database before we close the database.
|
||||
m_pTranslation1.free();
|
||||
m_comTranslation.free();
|
||||
m_pCharacterGroup1.free();
|
||||
m_comCharacterGroup.free();
|
||||
|
||||
@ -279,13 +281,16 @@ bool ZRCola::DBSource::Open(LPCTSTR filename)
|
||||
m_filename = filename;
|
||||
m_locale = _create_locale(LC_ALL, "Slovenian_Slovenia.1250");
|
||||
|
||||
wxASSERT_MSG(!m_comCharacterGroup, wxT("ADO command already created"));
|
||||
|
||||
// Create ADO command(s).
|
||||
wxASSERT_MSG(!m_comCharacterGroup, wxT("ADO command already created"));
|
||||
wxVERIFY(SUCCEEDED(::CoCreateInstance(CLSID_CADOCommand, NULL, CLSCTX_ALL, IID_IADOCommand, (LPVOID*)&m_comCharacterGroup)));
|
||||
wxVERIFY(SUCCEEDED(m_comCharacterGroup->put_ActiveConnection(variant(m_db))));
|
||||
wxVERIFY(SUCCEEDED(m_comCharacterGroup->put_CommandType(adCmdText)));
|
||||
wxVERIFY(SUCCEEDED(m_comCharacterGroup->put_CommandText(bstr(L"SELECT [VRS_SkupineZnakov].[Znak], [VRS_SkupineZnakov].[pogost] FROM [VRS_SkupineZnakov] LEFT JOIN [VRS_CharList] ON [VRS_SkupineZnakov].[Znak]=[VRS_CharList].[znak] WHERE [VRS_CharList].[aktiven]=1 AND [VRS_SkupineZnakov].[Skupina]=? ORDER BY [VRS_SkupineZnakov].[Rang] ASC, [VRS_SkupineZnakov].[Znak] ASC"))));
|
||||
wxVERIFY(SUCCEEDED(m_comCharacterGroup->put_CommandText(bstr(L"SELECT [VRS_SkupineZnakov].[Znak], [VRS_SkupineZnakov].[pogost] "
|
||||
L"FROM [VRS_SkupineZnakov] "
|
||||
L"LEFT JOIN [VRS_CharList] ON [VRS_SkupineZnakov].[Znak]=[VRS_CharList].[znak] "
|
||||
L"WHERE [VRS_CharList].[aktiven]=1 AND [VRS_SkupineZnakov].[Skupina]=? "
|
||||
L"ORDER BY [VRS_SkupineZnakov].[Rang] ASC, [VRS_SkupineZnakov].[Znak] ASC"))));
|
||||
{
|
||||
// Create and add command parameters.
|
||||
com_obj<ADOParameters> params;
|
||||
@ -295,6 +300,23 @@ bool ZRCola::DBSource::Open(LPCTSTR filename)
|
||||
wxVERIFY(SUCCEEDED(params->Append(m_pCharacterGroup1)));
|
||||
}
|
||||
|
||||
wxASSERT_MSG(!m_comTranslation, wxT("ADO command already created"));
|
||||
wxVERIFY(SUCCEEDED(::CoCreateInstance(CLSID_CADOCommand, NULL, CLSCTX_ALL, IID_IADOCommand, (LPVOID*)&m_comTranslation)));
|
||||
wxVERIFY(SUCCEEDED(m_comTranslation->put_ActiveConnection(variant(m_db))));
|
||||
wxVERIFY(SUCCEEDED(m_comTranslation->put_CommandType(adCmdText)));
|
||||
wxVERIFY(SUCCEEDED(m_comTranslation->put_CommandText(bstr(L"SELECT [Komb1] AS [komb], [rang_komb1] AS [rang_komb], [Komb2] AS [znak], [rang_komb2] AS [rang_znak] "
|
||||
L"FROM [VRS_ScriptRepl] "
|
||||
L"WHERE [Script]=? "
|
||||
L"ORDER BY [Komb2], [rang_komb2], [rang_komb1], [Komb1]"))));
|
||||
{
|
||||
// Create and add command parameters.
|
||||
com_obj<ADOParameters> params;
|
||||
wxVERIFY(SUCCEEDED(m_comTranslation->get_Parameters(¶ms)));
|
||||
wxASSERT_MSG(!m_pTranslation1, wxT("ADO command parameter already created"));
|
||||
wxVERIFY(SUCCEEDED(m_comTranslation->CreateParameter(bstr(L"@Script"), adInteger, adParamInput, 0, variant(DISP_E_PARAMNOTFOUND, VT_ERROR), &m_pTranslation1)));
|
||||
wxVERIFY(SUCCEEDED(params->Append(m_pTranslation1)));
|
||||
}
|
||||
|
||||
return true;
|
||||
} else {
|
||||
_ftprintf(stderr, wxT("%s: error ZCC0011: Could not open database (0x%x).\n"), (LPCTSTR)filename, hr);
|
||||
@ -591,7 +613,28 @@ bool ZRCola::DBSource::SelectTranslations(com_obj<ADORecordset> &rs) const
|
||||
L"WHERE [rang_komb]=1 "
|
||||
L"ORDER BY [znak], [rang_znak], [rang_komb], [komb]"), variant(m_db), adOpenStatic, adLockReadOnly, adCmdText)))
|
||||
{
|
||||
_ftprintf(stderr, wxT("%s: error ZCC0040: Error loading compositions from database. Please make sure the file is ZRCola.zrc compatible.\n"), m_filename.c_str());
|
||||
_ftprintf(stderr, wxT("%s: error ZCC0040: Error loading translations from database. Please make sure the file is ZRCola.zrc compatible.\n"), m_filename.c_str());
|
||||
LogErrors();
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool ZRCola::DBSource::SelectTranslations(int set, winstd::com_obj<ADORecordset>& rs) const
|
||||
{
|
||||
// Create a new recordset.
|
||||
rs.free();
|
||||
wxVERIFY(SUCCEEDED(::CoCreateInstance(CLSID_CADORecordset, NULL, CLSCTX_ALL, IID_IADORecordset, (LPVOID*)&rs)));
|
||||
wxVERIFY(SUCCEEDED(rs->put_CursorLocation(adUseClient)));
|
||||
wxVERIFY(SUCCEEDED(rs->put_CursorType(adOpenForwardOnly)));
|
||||
wxVERIFY(SUCCEEDED(rs->put_LockType(adLockReadOnly)));
|
||||
|
||||
// Open it.
|
||||
wxVERIFY(SUCCEEDED(m_pTranslation1->put_Value(variant(set))));
|
||||
if (FAILED(rs->Open(variant(m_comTranslation), variant(DISP_E_PARAMNOTFOUND, VT_ERROR)))) {
|
||||
_ftprintf(stderr, wxT("%s: error ZCC0100: Error loading translations from database. Please make sure the file is ZRCola.zrc compatible.\n"), m_filename.c_str());
|
||||
LogErrors();
|
||||
return false;
|
||||
}
|
||||
@ -635,6 +678,56 @@ bool ZRCola::DBSource::GetTranslation(const com_obj<ADORecordset>& rs, ZRCola::D
|
||||
}
|
||||
|
||||
|
||||
bool ZRCola::DBSource::SelectTranlationSets(com_obj<ADORecordset> &rs) const
|
||||
{
|
||||
// Create a new recordset.
|
||||
rs.free();
|
||||
wxCHECK(SUCCEEDED(::CoCreateInstance(CLSID_CADORecordset, NULL, CLSCTX_ALL, IID_IADORecordset, (LPVOID*)&rs)), false);
|
||||
|
||||
// Open it.
|
||||
if (FAILED(rs->Open(variant(
|
||||
L"SELECT DISTINCT [entCode], [Src_En], [Dst_En] "
|
||||
L"FROM [VRS_Script] "
|
||||
L"ORDER BY [entCode], [Src_En], [Dst_En]"), variant(m_db), adOpenStatic, adLockReadOnly, adCmdText)))
|
||||
{
|
||||
_ftprintf(stderr, wxT("%s: error ZCC0060: Error loading translation sets from database. Please make sure the file is ZRCola.zrc compatible.\n"), m_filename.c_str());
|
||||
LogErrors();
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool ZRCola::DBSource::GetTranslationSet(const com_obj<ADORecordset>& rs, ZRCola::DBSource::transet& ts) const
|
||||
{
|
||||
wxASSERT_MSG(rs, wxT("recordset is empty"));
|
||||
|
||||
com_obj<ADOFields> flds;
|
||||
wxVERIFY(SUCCEEDED(rs->get_Fields(&flds)));
|
||||
|
||||
{
|
||||
com_obj<ADOField> f;
|
||||
wxVERIFY(SUCCEEDED(flds->get_Item(variant(L"entCode"), &f)));
|
||||
wxCHECK(GetValue(f, ts.id), false);
|
||||
}
|
||||
|
||||
{
|
||||
com_obj<ADOField> f;
|
||||
wxVERIFY(SUCCEEDED(flds->get_Item(variant(L"Src_En"), &f)));
|
||||
wxCHECK(GetValue(f, ts.src), false);
|
||||
}
|
||||
|
||||
{
|
||||
com_obj<ADOField> f;
|
||||
wxVERIFY(SUCCEEDED(flds->get_Item(variant(L"Dst_En"), &f)));
|
||||
wxCHECK(GetValue(f, ts.dst), false);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool ZRCola::DBSource::SelectKeySequences(com_obj<ADORecordset> &rs) const
|
||||
{
|
||||
// Create a new recordset.
|
||||
|
@ -21,6 +21,7 @@
|
||||
|
||||
#include <zrcola/character.h>
|
||||
#include <zrcola/common.h>
|
||||
#include <zrcola/translate.h>
|
||||
|
||||
#include <WinStd/COM.h>
|
||||
#include <WinStd/Win.h>
|
||||
@ -71,6 +72,17 @@ namespace ZRCola {
|
||||
};
|
||||
|
||||
|
||||
///
|
||||
/// Translation set
|
||||
///
|
||||
class transet {
|
||||
public:
|
||||
int id; ///< ID
|
||||
std::wstring src; ///< Source name
|
||||
std::wstring dst; ///< Destination name
|
||||
};
|
||||
|
||||
|
||||
///
|
||||
/// Key sequence
|
||||
///
|
||||
@ -472,6 +484,18 @@ namespace ZRCola {
|
||||
///
|
||||
bool SelectTranslations(winstd::com_obj<ADORecordset>& rs) const;
|
||||
|
||||
///
|
||||
/// Returns character translations by set
|
||||
///
|
||||
/// \param[in ] set Translation set ID
|
||||
/// \param[out] rs Recordset with results
|
||||
///
|
||||
/// \returns
|
||||
/// - true when query succeeds
|
||||
/// - false otherwise
|
||||
///
|
||||
bool SelectTranslations(int set, winstd::com_obj<ADORecordset>& rs) const;
|
||||
|
||||
///
|
||||
/// Returns translation data
|
||||
///
|
||||
@ -484,6 +508,29 @@ namespace ZRCola {
|
||||
///
|
||||
bool GetTranslation(const winstd::com_obj<ADORecordset>& rs, translation& t) const;
|
||||
|
||||
///
|
||||
/// Returns translation sets
|
||||
///
|
||||
/// \param[out] rs Recordset with results
|
||||
///
|
||||
/// \returns
|
||||
/// - true when query succeeds
|
||||
/// - false otherwise
|
||||
///
|
||||
bool SelectTranlationSets(winstd::com_obj<ADORecordset>& rs) const;
|
||||
|
||||
///
|
||||
/// Returns translation set data
|
||||
///
|
||||
/// \param[in] rs Recordset with results
|
||||
/// \param[out] lang Language
|
||||
///
|
||||
/// \returns
|
||||
/// - true when succeeded
|
||||
/// - false otherwise
|
||||
///
|
||||
bool GetTranslationSet(const winstd::com_obj<ADORecordset>& rs, transet& ts) const;
|
||||
|
||||
///
|
||||
/// Returns key sequences
|
||||
///
|
||||
@ -673,8 +720,11 @@ namespace ZRCola {
|
||||
winstd::com_obj<ADOConnection> m_db; ///< Database
|
||||
_locale_t m_locale; ///< Database locale
|
||||
|
||||
winstd::com_obj<ADOCommand> m_comCharacterGroup; ///< ADO Command for GetCharacterGroup subquery
|
||||
winstd::com_obj<ADOParameter> m_pCharacterGroup1; ///< \c m_comCharacterGroup parameter
|
||||
winstd::com_obj<ADOCommand> m_comCharacterGroup; ///< ADO Command for GetCharacterGroup subquery
|
||||
winstd::com_obj<ADOParameter> m_pCharacterGroup1; ///< \c m_comCharacterGroup parameter
|
||||
|
||||
winstd::com_obj<ADOCommand> m_comTranslation; ///< ADO Command for SelectTranslations subquery
|
||||
winstd::com_obj<ADOParameter> m_pTranslation1; ///< \c m_comTranslations parameter
|
||||
|
||||
std::set<std::wstring> m_terms_ignore; ///< Terms to ignore when comparing characters
|
||||
};
|
||||
|
@ -174,6 +174,8 @@ int _tmain(int argc, _TCHAR *argv[])
|
||||
// Open file ID.
|
||||
streamoff dst_start = idrec::open<ZRCola::recordid_t, ZRCola::recordsize_t>(dst, ZRCOLA_DB_ID);
|
||||
|
||||
ZRCola::translation_db db_trans;
|
||||
|
||||
{
|
||||
// Get translations.
|
||||
com_obj<ADORecordset> rs;
|
||||
@ -222,42 +224,33 @@ int _tmain(int argc, _TCHAR *argv[])
|
||||
}
|
||||
}
|
||||
|
||||
ZRCola::translation_db db;
|
||||
|
||||
// Preallocate memory.
|
||||
db.idxSrc.reserve(count);
|
||||
db.idxDst.reserve(count);
|
||||
db.data .reserve(count*5);
|
||||
db_trans.idxSrc.reserve(count);
|
||||
db_trans.idxDst.reserve(count);
|
||||
db_trans.data .reserve(count*5);
|
||||
|
||||
// Parse translations and build index and data.
|
||||
for (auto t = db_temp2.cbegin(), t_end = db_temp2.cend(); t != t_end; ++t) {
|
||||
// Add translation to index and data.
|
||||
for (auto d = t->second.cbegin(), d_end = t->second.cend(); d != d_end; ++d) {
|
||||
unsigned __int32 idx = db.data.size();
|
||||
db.data.push_back((unsigned __int16)0);
|
||||
unsigned __int32 idx = db_trans.data.size();
|
||||
db_trans.data.push_back((unsigned __int16)0);
|
||||
wxASSERT_MSG((int)0xffff8000 <= d->first && d->first <= (int)0x00007fff, wxT("destination character rank out of bounds"));
|
||||
db.data.push_back((unsigned __int16)d->first);
|
||||
db_trans.data.push_back((unsigned __int16)d->first);
|
||||
wxASSERT_MSG((int)0xffff8000 <= d->second.rank && d->second.rank <= (int)0x00007fff, wxT("source character rank out of bounds"));
|
||||
db.data.push_back((unsigned __int16)d->second.rank);
|
||||
db_trans.data.push_back((unsigned __int16)d->second.rank);
|
||||
wstring::size_type n = t->first.length();
|
||||
wxASSERT_MSG(n <= 0xffff, wxT("destination overflow"));
|
||||
db.data.push_back((unsigned __int16)n);
|
||||
db_trans.data.push_back((unsigned __int16)n);
|
||||
n += d->second.str.length();
|
||||
wxASSERT_MSG(n <= 0xffff, wxT("source overflow"));
|
||||
db.data.push_back((unsigned __int16)n);
|
||||
db.data.insert(db.data.end(), t->first .cbegin(), t->first .cend());
|
||||
db.data.insert(db.data.end(), d->second.str.cbegin(), d->second.str.cend());
|
||||
db.idxSrc.push_back(idx);
|
||||
db.idxDst.push_back(idx);
|
||||
db_trans.data.push_back((unsigned __int16)n);
|
||||
db_trans.data.insert(db_trans.data.end(), t->first .cbegin(), t->first .cend());
|
||||
db_trans.data.insert(db_trans.data.end(), d->second.str.cbegin(), d->second.str.cend());
|
||||
db_trans.idxSrc.push_back(idx);
|
||||
db_trans.idxDst.push_back(idx);
|
||||
}
|
||||
}
|
||||
|
||||
// Sort indices.
|
||||
db.idxSrc.sort();
|
||||
db.idxDst.sort();
|
||||
|
||||
// Write translations to file.
|
||||
dst << ZRCola::translation_rec(db);
|
||||
} else {
|
||||
_ftprintf(stderr, wxT("%s: error ZCC0004: Error getting translation count from database or too many translations.\n"), (LPCTSTR)filenameIn.c_str());
|
||||
has_errors = true;
|
||||
@ -268,6 +261,124 @@ int _tmain(int argc, _TCHAR *argv[])
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
// Get translation sets.
|
||||
com_obj<ADORecordset> rs;
|
||||
if (src.SelectTranlationSets(rs)) {
|
||||
size_t count = src.GetRecordsetCount(rs);
|
||||
if (count < 0xffffffff) { // 4G check (-1 is reserved for error condition)
|
||||
ZRCola::DBSource::transet ts;
|
||||
ZRCola::transet_db db;
|
||||
|
||||
// Preallocate memory.
|
||||
db.idxTranSet.reserve(count);
|
||||
db.data .reserve(count*4);
|
||||
|
||||
// Add (de)composing translation set to index and data.
|
||||
ts.id = 0;
|
||||
ts.src = L"ZRCola Decomposed";
|
||||
ts.dst = L"ZRCola Composed";
|
||||
unsigned __int32 idx = db.data.size();
|
||||
wxASSERT_MSG((int)0xffff8000 <= ts.id && ts.id <= (int)0x00007fff, wxT("translation set index out of bounds"));
|
||||
db.data.push_back((unsigned __int16)ts.id);
|
||||
wstring::size_type n = ts.src.length();
|
||||
wxASSERT_MSG(n <= 0xffff, wxT("translation set source name overflow"));
|
||||
db.data.push_back((unsigned __int16)n);
|
||||
n += ts.dst.length();
|
||||
wxASSERT_MSG(n <= 0xffff, wxT("translation set destination name overflow"));
|
||||
db.data.push_back((unsigned __int16)n);
|
||||
db.data.insert(db.data.end(), ts.src.cbegin(), ts.src.cend());
|
||||
db.data.insert(db.data.end(), ts.dst.cbegin(), ts.dst.cend());
|
||||
db.idxTranSet.push_back(idx);
|
||||
|
||||
// Parse translation sets and build index and data.
|
||||
for (; !ZRCola::DBSource::IsEOF(rs); rs->MoveNext()) {
|
||||
// Read translation set from the database.
|
||||
if (src.GetTranslationSet(rs, ts)) {
|
||||
if (build_pot) {
|
||||
pot.insert(ts.src);
|
||||
pot.insert(ts.dst);
|
||||
}
|
||||
|
||||
// Add translation set to index and data.
|
||||
unsigned __int32 idx = db.data.size();
|
||||
wxASSERT_MSG((int)0xffff8000 <= ts.id && ts.id <= (int)0x00007fff, wxT("translation set index out of bounds"));
|
||||
db.data.push_back((unsigned __int16)ts.id);
|
||||
wstring::size_type n = ts.src.length();
|
||||
wxASSERT_MSG(n <= 0xffff, wxT("translation set source name overflow"));
|
||||
db.data.push_back((unsigned __int16)n);
|
||||
n += ts.dst.length();
|
||||
wxASSERT_MSG(n <= 0xffff, wxT("translation set destination name overflow"));
|
||||
db.data.push_back((unsigned __int16)n);
|
||||
db.data.insert(db.data.end(), ts.src.cbegin(), ts.src.cend());
|
||||
db.data.insert(db.data.end(), ts.dst.cbegin(), ts.dst.cend());
|
||||
db.idxTranSet.push_back(idx);
|
||||
|
||||
// Get translations.
|
||||
com_obj<ADORecordset> rs_tran;
|
||||
if (src.SelectTranslations(ts.id, rs_tran)) {
|
||||
size_t count = src.GetRecordsetCount(rs_tran);
|
||||
if (count < 0xffffffff) { // 4G check (-1 is reserved for error condition)
|
||||
// Parse translations and build temporary database.
|
||||
for (; !ZRCola::DBSource::IsEOF(rs_tran); rs_tran->MoveNext()) {
|
||||
// Read translation from the database.
|
||||
ZRCola::DBSource::translation trans;
|
||||
if (src.GetTranslation(rs_tran, trans)) {
|
||||
// Add translation to index and data.
|
||||
unsigned __int32 idx = db_trans.data.size();
|
||||
wxASSERT_MSG((int)0xffff8000 <= ts.id && ts.id <= (int)0x00007fff, wxT("translation set index out of bounds"));
|
||||
db_trans.data.push_back((unsigned __int16)ts.id);
|
||||
wxASSERT_MSG((int)0xffff8000 <= trans.dst.rank && trans.dst.rank <= (int)0x00007fff, wxT("destination character rank out of bounds"));
|
||||
db_trans.data.push_back((unsigned __int16)trans.dst.rank);
|
||||
wxASSERT_MSG((int)0xffff8000 <= trans.src.rank && trans.src.rank <= (int)0x00007fff, wxT("source character rank out of bounds"));
|
||||
db_trans.data.push_back((unsigned __int16)trans.src.rank);
|
||||
wstring::size_type n = trans.dst.str.length();
|
||||
wxASSERT_MSG(n <= 0xffff, wxT("destination overflow"));
|
||||
db_trans.data.push_back((unsigned __int16)n);
|
||||
n += trans.src.str.length();
|
||||
wxASSERT_MSG(n <= 0xffff, wxT("source overflow"));
|
||||
db_trans.data.push_back((unsigned __int16)n);
|
||||
db_trans.data.insert(db_trans.data.end(), trans.dst.str.cbegin(), trans.dst.str.cend());
|
||||
db_trans.data.insert(db_trans.data.end(), trans.src.str.cbegin(), trans.src.str.cend());
|
||||
db_trans.idxSrc.push_back(idx);
|
||||
db_trans.idxDst.push_back(idx);
|
||||
} else
|
||||
has_errors = true;
|
||||
}
|
||||
} else {
|
||||
_ftprintf(stderr, wxT("%s: error ZCC0004: Error getting translation count from database or too many translations.\n"), (LPCTSTR)filenameIn.c_str());
|
||||
has_errors = true;
|
||||
}
|
||||
} else {
|
||||
_ftprintf(stderr, wxT("%s: error ZCC0003: Error getting translations from database. Please make sure the file is ZRCola.zrc compatible.\n"), (LPCTSTR)filenameIn.c_str());
|
||||
has_errors = true;
|
||||
}
|
||||
} else
|
||||
has_errors = true;
|
||||
}
|
||||
|
||||
// Sort indices.
|
||||
db.idxTranSet.sort();
|
||||
|
||||
// Write translation sets to file.
|
||||
dst << ZRCola::transet_rec(db);
|
||||
} else {
|
||||
_ftprintf(stderr, wxT("%s: error ZCC0009: Error getting translation set count from database or too many translation sets.\n"), (LPCTSTR)filenameIn.c_str());
|
||||
has_errors = true;
|
||||
}
|
||||
} else {
|
||||
_ftprintf(stderr, wxT("%s: error ZCC0008: Error getting translation sets from database. Please make sure the file is ZRCola.zrc compatible.\n"), (LPCTSTR)filenameIn.c_str());
|
||||
has_errors = true;
|
||||
}
|
||||
}
|
||||
|
||||
// Sort indices.
|
||||
db_trans.idxSrc.sort();
|
||||
db_trans.idxDst.sort();
|
||||
|
||||
// Write translations to file.
|
||||
dst << ZRCola::translation_rec(db_trans);
|
||||
|
||||
{
|
||||
// Get key sequences.
|
||||
com_obj<ADORecordset> rs;
|
||||
|
@ -326,8 +326,9 @@ namespace ZRCola {
|
||||
transetid_t set; ///< Translation set ID
|
||||
|
||||
protected:
|
||||
unsigned __int16 name_to; ///< Translation set name end in \c data
|
||||
wchar_t data[]; ///< Translation set name
|
||||
unsigned __int16 src_to; ///< Source name end in \c data
|
||||
unsigned __int16 dst_to; ///< Sestination name end in \c data
|
||||
wchar_t data[]; ///< Source and destination names
|
||||
|
||||
private:
|
||||
inline transet(_In_ const transet &other);
|
||||
@ -337,25 +338,37 @@ namespace ZRCola {
|
||||
///
|
||||
/// Constructs the translation set
|
||||
///
|
||||
/// \param[in] set Translation set ID
|
||||
/// \param[in] name Translation set name
|
||||
/// \param[in] name_len Number of UTF-16 characters in \p name
|
||||
/// \param[in] set Translation set ID
|
||||
/// \param[in] src Translation set source
|
||||
/// \param[in] src_len Number of UTF-16 characters in \p src
|
||||
/// \param[in] dst Translation set destination
|
||||
/// \param[in] dst_len Number of UTF-16 characters in \p dst
|
||||
///
|
||||
inline transet(
|
||||
_In_opt_ transetid_t set = 0,
|
||||
_In_opt_z_count_(name_len) const wchar_t *name = NULL,
|
||||
_In_opt_ size_t name_len = 0)
|
||||
_In_opt_ transetid_t set = 0,
|
||||
_In_opt_z_count_(src_len) const wchar_t *src = NULL,
|
||||
_In_opt_ size_t src_len = 0,
|
||||
_In_opt_z_count_(dst_len) const wchar_t *dst = NULL,
|
||||
_In_opt_ size_t dst_len = 0)
|
||||
{
|
||||
this->set = set;
|
||||
this->name_to = static_cast<unsigned __int16>(name_len);
|
||||
if (name_len) memcpy(this->data, name, sizeof(wchar_t)*name_len);
|
||||
this->src_to = static_cast<unsigned __int16>(src_len);
|
||||
if (src_len) memcpy(this->data, src, sizeof(wchar_t)*src_len);
|
||||
this->dst_to = static_cast<unsigned __int16>(this->src_to + dst_len);
|
||||
if (dst_len) memcpy(this->data + this->src_to, dst, sizeof(wchar_t)*dst_len);
|
||||
}
|
||||
|
||||
inline const wchar_t* name () const { return data; };
|
||||
inline wchar_t* name () { return data; };
|
||||
inline const wchar_t* name_end() const { return data + name_to; };
|
||||
inline wchar_t* name_end() { return data + name_to; };
|
||||
inline unsigned __int16 name_len() const { return name_to; };
|
||||
inline const wchar_t* src () const { return data; };
|
||||
inline wchar_t* src () { return data; };
|
||||
inline const wchar_t* src_end() const { return data + src_to; };
|
||||
inline wchar_t* src_end() { return data + src_to; };
|
||||
inline unsigned __int16 src_len() const { return src_to; };
|
||||
|
||||
inline const wchar_t* dst () const { return data + src_to; };
|
||||
inline wchar_t* dst () { return data + src_to; };
|
||||
inline const wchar_t* dst_end() const { return data + dst_to; };
|
||||
inline wchar_t* dst_end() { return data + dst_to; };
|
||||
inline unsigned __int16 dst_len() const { return dst_to - src_to; };
|
||||
};
|
||||
#pragma pack(pop)
|
||||
|
||||
|
Binary file not shown.
@ -10,6 +10,12 @@ msgstr ""
|
||||
msgid "Albanian"
|
||||
msgstr ""
|
||||
|
||||
msgid "Apostrophes 1"
|
||||
msgstr ""
|
||||
|
||||
msgid "Apostrophes 2"
|
||||
msgstr ""
|
||||
|
||||
msgid "Arabic"
|
||||
msgstr ""
|
||||
|
||||
@ -25,6 +31,9 @@ msgstr ""
|
||||
msgid "Bosnian – Latinic"
|
||||
msgstr ""
|
||||
|
||||
msgid "CAPITAL Case"
|
||||
msgstr ""
|
||||
|
||||
msgid "Combine"
|
||||
msgstr ""
|
||||
|
||||
@ -49,6 +58,27 @@ msgstr ""
|
||||
msgid "Cyrillic"
|
||||
msgstr ""
|
||||
|
||||
msgid "Cyrillic (Belarusian)"
|
||||
msgstr ""
|
||||
|
||||
msgid "Cyrillic (Bulgarian)"
|
||||
msgstr ""
|
||||
|
||||
msgid "Cyrillic (Macedonian)"
|
||||
msgstr ""
|
||||
|
||||
msgid "Cyrillic (Russian)"
|
||||
msgstr ""
|
||||
|
||||
msgid "Cyrillic (Serbian)"
|
||||
msgstr ""
|
||||
|
||||
msgid "Cyrillic (Ukrainian)"
|
||||
msgstr ""
|
||||
|
||||
msgid "Cyrillic BdC"
|
||||
msgstr ""
|
||||
|
||||
msgid "Czech"
|
||||
msgstr ""
|
||||
|
||||
@ -88,6 +118,12 @@ msgstr ""
|
||||
msgid "Greek"
|
||||
msgstr ""
|
||||
|
||||
msgid "Greek (Modern)"
|
||||
msgstr ""
|
||||
|
||||
msgid "Greek (Old)"
|
||||
msgstr ""
|
||||
|
||||
msgid "Hebrew"
|
||||
msgstr ""
|
||||
|
||||
@ -199,6 +235,12 @@ msgstr ""
|
||||
msgid "Latin"
|
||||
msgstr ""
|
||||
|
||||
msgid "Latin ALE"
|
||||
msgstr ""
|
||||
|
||||
msgid "Latin BdC"
|
||||
msgstr ""
|
||||
|
||||
msgid "Latvian"
|
||||
msgstr ""
|
||||
|
||||
@ -463,6 +505,12 @@ msgstr ""
|
||||
msgid "Serbian – Latinic"
|
||||
msgstr ""
|
||||
|
||||
msgid "Sigma Final"
|
||||
msgstr ""
|
||||
|
||||
msgid "Sigma Nav"
|
||||
msgstr ""
|
||||
|
||||
msgid "Slovak"
|
||||
msgstr ""
|
||||
|
||||
@ -550,6 +598,9 @@ msgstr ""
|
||||
msgid "Technical Characters"
|
||||
msgstr ""
|
||||
|
||||
msgid "Title Case"
|
||||
msgstr ""
|
||||
|
||||
msgid "Transliterated"
|
||||
msgstr ""
|
||||
|
||||
@ -564,3 +615,12 @@ msgstr ""
|
||||
|
||||
msgid "Units"
|
||||
msgstr ""
|
||||
|
||||
msgid "l+j l|j"
|
||||
msgstr ""
|
||||
|
||||
msgid "no + |"
|
||||
msgstr ""
|
||||
|
||||
msgid "small Case"
|
||||
msgstr ""
|
||||
|
@ -9,13 +9,19 @@ msgstr ""
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"X-Generator: Poedit 1.8.8\n"
|
||||
"X-Generator: Poedit 1.8.11\n"
|
||||
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
||||
"X-Poedit-SourceCharset: UTF-8\n"
|
||||
|
||||
msgid "Albanian"
|
||||
msgstr ""
|
||||
|
||||
msgid "Apostrophes 1"
|
||||
msgstr ""
|
||||
|
||||
msgid "Apostrophes 2"
|
||||
msgstr ""
|
||||
|
||||
#, fuzzy
|
||||
msgid "Arabic"
|
||||
msgstr "Arabisch"
|
||||
@ -32,6 +38,9 @@ msgstr ""
|
||||
msgid "Bosnian – Latinic"
|
||||
msgstr ""
|
||||
|
||||
msgid "CAPITAL Case"
|
||||
msgstr ""
|
||||
|
||||
msgid "Combine"
|
||||
msgstr ""
|
||||
|
||||
@ -57,6 +66,30 @@ msgstr ""
|
||||
msgid "Cyrillic"
|
||||
msgstr "Windows Kyrillisch (CP 1251)"
|
||||
|
||||
msgid "Cyrillic (Belarusian)"
|
||||
msgstr ""
|
||||
|
||||
msgid "Cyrillic (Bulgarian)"
|
||||
msgstr ""
|
||||
|
||||
msgid "Cyrillic (Macedonian)"
|
||||
msgstr ""
|
||||
|
||||
#, fuzzy
|
||||
msgid "Cyrillic (Russian)"
|
||||
msgstr "Windows Kyrillisch (CP 1251)"
|
||||
|
||||
#, fuzzy
|
||||
msgid "Cyrillic (Serbian)"
|
||||
msgstr "Windows Kyrillisch (CP 1251)"
|
||||
|
||||
msgid "Cyrillic (Ukrainian)"
|
||||
msgstr ""
|
||||
|
||||
#, fuzzy
|
||||
msgid "Cyrillic BdC"
|
||||
msgstr "Windows Kyrillisch (CP 1251)"
|
||||
|
||||
msgid "Czech"
|
||||
msgstr ""
|
||||
|
||||
@ -97,6 +130,13 @@ msgstr ""
|
||||
msgid "Greek"
|
||||
msgstr "Windows Griechisch (CP 1253)"
|
||||
|
||||
msgid "Greek (Modern)"
|
||||
msgstr ""
|
||||
|
||||
#, fuzzy
|
||||
msgid "Greek (Old)"
|
||||
msgstr "Windows Griechisch (CP 1253)"
|
||||
|
||||
#, fuzzy
|
||||
msgid "Hebrew"
|
||||
msgstr "Windows Hebräisch (CP 1255)"
|
||||
@ -209,6 +249,12 @@ msgstr ""
|
||||
msgid "Latin"
|
||||
msgstr ""
|
||||
|
||||
msgid "Latin ALE"
|
||||
msgstr ""
|
||||
|
||||
msgid "Latin BdC"
|
||||
msgstr ""
|
||||
|
||||
msgid "Latvian"
|
||||
msgstr ""
|
||||
|
||||
@ -477,6 +523,12 @@ msgstr ""
|
||||
msgid "Serbian – Latinic"
|
||||
msgstr ""
|
||||
|
||||
msgid "Sigma Final"
|
||||
msgstr ""
|
||||
|
||||
msgid "Sigma Nav"
|
||||
msgstr ""
|
||||
|
||||
msgid "Slovak"
|
||||
msgstr ""
|
||||
|
||||
@ -576,6 +628,9 @@ msgstr ""
|
||||
msgid "Technical Characters"
|
||||
msgstr ""
|
||||
|
||||
msgid "Title Case"
|
||||
msgstr ""
|
||||
|
||||
msgid "Transliterated"
|
||||
msgstr ""
|
||||
|
||||
@ -591,3 +646,20 @@ msgstr ""
|
||||
|
||||
msgid "Units"
|
||||
msgstr ""
|
||||
|
||||
msgid "l+j l|j"
|
||||
msgstr ""
|
||||
|
||||
msgid "no + |"
|
||||
msgstr ""
|
||||
|
||||
msgid "small Case"
|
||||
msgstr ""
|
||||
|
||||
#, fuzzy
|
||||
#~ msgid "Modified Greek"
|
||||
#~ msgstr "Geändert"
|
||||
|
||||
#, fuzzy
|
||||
#~ msgid "Old Greek"
|
||||
#~ msgstr "Windows Griechisch (CP 1253)"
|
||||
|
@ -9,14 +9,19 @@ msgstr ""
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"X-Generator: Poedit 1.8.9\n"
|
||||
"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n"
|
||||
"%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n"
|
||||
"X-Generator: Poedit 1.8.11\n"
|
||||
"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n"
|
||||
"X-Poedit-SourceCharset: UTF-8\n"
|
||||
|
||||
msgid "Albanian"
|
||||
msgstr "албанский"
|
||||
|
||||
msgid "Apostrophes 1"
|
||||
msgstr ""
|
||||
|
||||
msgid "Apostrophes 2"
|
||||
msgstr ""
|
||||
|
||||
msgid "Arabic"
|
||||
msgstr "Арабские знаки"
|
||||
|
||||
@ -32,6 +37,9 @@ msgstr "боснийский – кириллица"
|
||||
msgid "Bosnian – Latinic"
|
||||
msgstr "боснийский – латиница"
|
||||
|
||||
msgid "CAPITAL Case"
|
||||
msgstr ""
|
||||
|
||||
msgid "Combine"
|
||||
msgstr "Средние замещающие знаки"
|
||||
|
||||
@ -56,6 +64,33 @@ msgstr "Валюты"
|
||||
msgid "Cyrillic"
|
||||
msgstr "Кириллические знаки"
|
||||
|
||||
#, fuzzy
|
||||
msgid "Cyrillic (Belarusian)"
|
||||
msgstr "белорусский"
|
||||
|
||||
msgid "Cyrillic (Bulgarian)"
|
||||
msgstr ""
|
||||
|
||||
#, fuzzy
|
||||
msgid "Cyrillic (Macedonian)"
|
||||
msgstr "македонский"
|
||||
|
||||
#, fuzzy
|
||||
msgid "Cyrillic (Russian)"
|
||||
msgstr "Кириллические знаки"
|
||||
|
||||
#, fuzzy
|
||||
msgid "Cyrillic (Serbian)"
|
||||
msgstr "Кириллические знаки"
|
||||
|
||||
#, fuzzy
|
||||
msgid "Cyrillic (Ukrainian)"
|
||||
msgstr "украинский"
|
||||
|
||||
#, fuzzy
|
||||
msgid "Cyrillic BdC"
|
||||
msgstr "Кириллические знаки"
|
||||
|
||||
msgid "Czech"
|
||||
msgstr "чешский"
|
||||
|
||||
@ -95,6 +130,13 @@ msgstr "Глаголические знаки"
|
||||
msgid "Greek"
|
||||
msgstr "Греческие знаки"
|
||||
|
||||
msgid "Greek (Modern)"
|
||||
msgstr ""
|
||||
|
||||
#, fuzzy
|
||||
msgid "Greek (Old)"
|
||||
msgstr "Греческие знаки"
|
||||
|
||||
msgid "Hebrew"
|
||||
msgstr "Еврейские знаки"
|
||||
|
||||
@ -206,6 +248,14 @@ msgstr "кашубский"
|
||||
msgid "Latin"
|
||||
msgstr "латинский"
|
||||
|
||||
#, fuzzy
|
||||
msgid "Latin ALE"
|
||||
msgstr "латинский"
|
||||
|
||||
#, fuzzy
|
||||
msgid "Latin BdC"
|
||||
msgstr "латинский"
|
||||
|
||||
msgid "Latvian"
|
||||
msgstr "латышский"
|
||||
|
||||
@ -470,6 +520,12 @@ msgstr "сербский – кириллица"
|
||||
msgid "Serbian – Latinic"
|
||||
msgstr "сербский – латиница"
|
||||
|
||||
msgid "Sigma Final"
|
||||
msgstr ""
|
||||
|
||||
msgid "Sigma Nav"
|
||||
msgstr ""
|
||||
|
||||
msgid "Slovak"
|
||||
msgstr "словацкий"
|
||||
|
||||
@ -558,6 +614,9 @@ msgstr "Симбол, остальное"
|
||||
msgid "Technical Characters"
|
||||
msgstr "Технические символы"
|
||||
|
||||
msgid "Title Case"
|
||||
msgstr ""
|
||||
|
||||
msgid "Transliterated"
|
||||
msgstr "Транслитерированные знаки"
|
||||
|
||||
@ -572,3 +631,20 @@ msgstr "украинский"
|
||||
|
||||
msgid "Units"
|
||||
msgstr "Единицы"
|
||||
|
||||
msgid "l+j l|j"
|
||||
msgstr ""
|
||||
|
||||
msgid "no + |"
|
||||
msgstr ""
|
||||
|
||||
msgid "small Case"
|
||||
msgstr ""
|
||||
|
||||
#, fuzzy
|
||||
#~ msgid "Modified Greek"
|
||||
#~ msgstr "Изменяющие знаки"
|
||||
|
||||
#, fuzzy
|
||||
#~ msgid "Old Greek"
|
||||
#~ msgstr "Греческие знаки"
|
||||
|
@ -9,14 +9,19 @@ msgstr ""
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"X-Generator: Poedit 1.8.8\n"
|
||||
"Plural-Forms: nplurals=4; plural=(n%100==1 ? 0 : n%100==2 ? 1 : n%100==3 || n"
|
||||
"%100==4 ? 2 : 3);\n"
|
||||
"X-Generator: Poedit 1.8.11\n"
|
||||
"Plural-Forms: nplurals=4; plural=(n%100==1 ? 0 : n%100==2 ? 1 : n%100==3 || n%100==4 ? 2 : 3);\n"
|
||||
"X-Poedit-SourceCharset: UTF-8\n"
|
||||
|
||||
msgid "Albanian"
|
||||
msgstr "albanščina"
|
||||
|
||||
msgid "Apostrophes 1"
|
||||
msgstr "apostrofi 1"
|
||||
|
||||
msgid "Apostrophes 2"
|
||||
msgstr "apostrofi 2"
|
||||
|
||||
msgid "Arabic"
|
||||
msgstr "Arabski znaki"
|
||||
|
||||
@ -32,6 +37,9 @@ msgstr "bosanščina – cirilica"
|
||||
msgid "Bosnian – Latinic"
|
||||
msgstr "bosanščina – latinica"
|
||||
|
||||
msgid "CAPITAL Case"
|
||||
msgstr "VELIKE črke"
|
||||
|
||||
msgid "Combine"
|
||||
msgstr "Srednji nadomestni znaki"
|
||||
|
||||
@ -56,6 +64,27 @@ msgstr "Valute"
|
||||
msgid "Cyrillic"
|
||||
msgstr "Cirilski znaki"
|
||||
|
||||
msgid "Cyrillic (Belarusian)"
|
||||
msgstr "cirilica (beloruščina)"
|
||||
|
||||
msgid "Cyrillic (Bulgarian)"
|
||||
msgstr "cirilica (bolgarščina)"
|
||||
|
||||
msgid "Cyrillic (Macedonian)"
|
||||
msgstr "cirilica (makedonščina)"
|
||||
|
||||
msgid "Cyrillic (Russian)"
|
||||
msgstr "cirilica (ruščina)"
|
||||
|
||||
msgid "Cyrillic (Serbian)"
|
||||
msgstr "cirilica (srbščina)"
|
||||
|
||||
msgid "Cyrillic (Ukrainian)"
|
||||
msgstr "cirilica (ukrajinščina)"
|
||||
|
||||
msgid "Cyrillic BdC"
|
||||
msgstr "cirilica BdC"
|
||||
|
||||
msgid "Czech"
|
||||
msgstr "češčina"
|
||||
|
||||
@ -95,6 +124,12 @@ msgstr "Glagolski znaki"
|
||||
msgid "Greek"
|
||||
msgstr "Grški znaki"
|
||||
|
||||
msgid "Greek (Modern)"
|
||||
msgstr "grščina (sodobna)"
|
||||
|
||||
msgid "Greek (Old)"
|
||||
msgstr "grščina (stara)"
|
||||
|
||||
msgid "Hebrew"
|
||||
msgstr "Hebrejski znaki"
|
||||
|
||||
@ -206,6 +241,12 @@ msgstr "kašubščina"
|
||||
msgid "Latin"
|
||||
msgstr "latinščina"
|
||||
|
||||
msgid "Latin ALE"
|
||||
msgstr "latinščina ALE"
|
||||
|
||||
msgid "Latin BdC"
|
||||
msgstr "latinščina BdC"
|
||||
|
||||
msgid "Latvian"
|
||||
msgstr "letonščina"
|
||||
|
||||
@ -470,6 +511,12 @@ msgstr "srbščina – cirilica"
|
||||
msgid "Serbian – Latinic"
|
||||
msgstr "srbščina – latinica"
|
||||
|
||||
msgid "Sigma Final"
|
||||
msgstr "Sigma končni"
|
||||
|
||||
msgid "Sigma Nav"
|
||||
msgstr "Sigma nav"
|
||||
|
||||
msgid "Slovak"
|
||||
msgstr "slovaščina"
|
||||
|
||||
@ -557,6 +604,9 @@ msgstr "Simbol, drugo"
|
||||
msgid "Technical Characters"
|
||||
msgstr "Tehnični znaki"
|
||||
|
||||
msgid "Title Case"
|
||||
msgstr "Velike začetnice"
|
||||
|
||||
msgid "Transliterated"
|
||||
msgstr "Prečrkovano"
|
||||
|
||||
@ -572,6 +622,15 @@ msgstr "ukrajinščina"
|
||||
msgid "Units"
|
||||
msgstr "Enote"
|
||||
|
||||
msgid "l+j l|j"
|
||||
msgstr "l+j l|j"
|
||||
|
||||
msgid "no + |"
|
||||
msgstr "brez + |"
|
||||
|
||||
msgid "small Case"
|
||||
msgstr "male črke"
|
||||
|
||||
#~ msgid "Letter b"
|
||||
#~ msgstr "Črka b"
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user