Remove translations from transpositions

Signed-off-by: Simon Rozman <simon@rozman.si>
This commit is contained in:
Simon Rozman 2021-12-17 14:36:55 +01:00
parent 0b68cdedda
commit 454b02181e
9 changed files with 53 additions and 77 deletions

View File

@ -95,10 +95,10 @@ void wxZRColaComposerPanel::SynchronizePanels()
if (app->m_mainWnd->m_composition) { if (app->m_mainWnd->m_composition) {
// ZRCola decompose first, then re-compose. // ZRCola decompose first, then re-compose.
app->m_t_db.TranslateInv(ZRCOLA_TRANSEQID_DEFAULT, dst.data(), dst.size(), dst2, &map); app->m_t_db.TranslateInv(ZRCOLA_TRANSETID_DEFAULT, dst.data(), dst.size(), dst2, &map);
m_mapping.push_back(std::move(map)); m_mapping.push_back(std::move(map));
app->m_t_db.Translate(ZRCOLA_TRANSEQID_DEFAULT, dst2.data(), dst2.size(), dst, &map); app->m_t_db.Translate(ZRCOLA_TRANSETID_DEFAULT, dst2.data(), dst2.size(), dst, &map);
m_mapping.push_back(std::move(map)); m_mapping.push_back(std::move(map));
} }
@ -150,7 +150,7 @@ void wxZRColaComposerPanel::SynchronizePanels()
if (app->m_mainWnd->m_composition) { if (app->m_mainWnd->m_composition) {
// ZRCola decompose. // ZRCola decompose.
app->m_t_db.TranslateInv(ZRCOLA_TRANSEQID_DEFAULT, dst.data(), dst.size(), &app->m_lc_db, app->m_mainWnd->m_settings->m_lang, dst2, &map); app->m_t_db.TranslateInv(ZRCOLA_TRANSETID_DEFAULT, dst.data(), dst.size(), &app->m_lc_db, app->m_mainWnd->m_settings->m_lang, dst2, &map);
dst = std::move(dst2); dst = std::move(dst2);
map.invert(); map.invert();

View File

@ -118,7 +118,7 @@ namespace ZRCola {
std::string norm; ///< Normalization footprint std::string norm; ///< Normalization footprint
charseq dst; ///< Destination sequence charseq dst; ///< Destination sequence
inline translation() : set((int)ZRCOLA_TRANSEQID_DEFAULT) {} inline translation() : set((int)ZRCOLA_TRANSETID_DEFAULT) {}
}; };
@ -131,7 +131,7 @@ namespace ZRCola {
std::wstring src; ///< Source name std::wstring src; ///< Source name
std::wstring dst; ///< Destination name std::wstring dst; ///< Destination name
inline transet() : set((int)ZRCOLA_TRANSEQID_DEFAULT) {} inline transet() : set((int)ZRCOLA_TRANSETID_DEFAULT) {}
}; };

View File

@ -384,13 +384,13 @@ int _tmain(int argc, _TCHAR *argv[])
// Add translation to index and data. // Add translation to index and data.
trans.dst.str = t->first; trans.dst.str = t->first;
for (auto d = t->second.cbegin(), d_end = t->second.cend(); d != d_end; ++d) { for (auto d = t->second.cbegin(), d_end = t->second.cend(); d != d_end; ++d) {
trans.set = (int)ZRCOLA_TRANSEQID_DEFAULT; trans.set = (int)ZRCOLA_TRANSETID_DEFAULT;
trans.dst.rank = d->second.rank_dst; trans.dst.rank = d->second.rank_dst;
trans.src.rank = d->second.rank_src; trans.src.rank = d->second.rank_src;
trans.src.str = d->first; trans.src.str = d->first;
db_trans << trans; db_trans << trans;
// If destination contains no PUA characters, add it to the ZRCola >> Unicode transliteration too. // If destination contains no PUA characters, add it to the ZRCola » Unicode transliteration too.
bool has_pua = false; bool has_pua = false;
for (auto ch = trans.dst.str.cbegin(), ch_end = trans.dst.str.cend(); ch != ch_end; ++ch) for (auto ch = trans.dst.str.cbegin(), ch_end = trans.dst.str.cend(); ch != ch_end; ++ch)
if (ZRCola::ispua(*ch)) { if (ZRCola::ispua(*ch)) {
@ -398,7 +398,7 @@ int _tmain(int argc, _TCHAR *argv[])
break; break;
} }
if (!has_pua) { if (!has_pua) {
trans.set = (int)ZRCOLA_TRANSEQID_UNICODE; trans.set = (int)ZRCOLA_TRANSETID_UNICODE;
db_trans << trans; db_trans << trans;
} }
} }
@ -428,11 +428,8 @@ int _tmain(int argc, _TCHAR *argv[])
// Read translation set from the database. // Read translation set from the database.
ZRCola::DBSource::transet ts; ZRCola::DBSource::transet ts;
if (src.GetTranslationSet(rs, ts)) { if (src.GetTranslationSet(rs, ts)) {
if (ts.set <= (int)ZRCOLA_TRANSEQID_DEFAULT) { if (ts.set <= (int)ZRCOLA_TRANSETID_DEFAULT)
_ftprintf(stderr, wxT("%s: error ZCC0008: Translation set is using reserved ID %i.\n"), (LPCTSTR)filenameIn.c_str(), ts.set);
has_errors = true;
continue; continue;
}
if (build_pot) { if (build_pot) {
pot.insert(ts.src); pot.insert(ts.src);

View File

@ -20,6 +20,11 @@
#pragma warning(disable: 4251) #pragma warning(disable: 4251)
#pragma warning(disable: 4512) #pragma warning(disable: 4512)
///
/// ZRCola (De)Composition
///
#define ZRCOLA_TRANSETID_DEFAULT ((ZRCola::transetid_t)0x0000)
/// ///
/// Translation disabled/ZRCola (De)Composition /// Translation disabled/ZRCola (De)Composition
/// ///
@ -30,11 +35,6 @@
/// ///
#define ZRCOLA_TRANSEQID_CUSTOM ((ZRCola::transeqid_t)0xffff) #define ZRCOLA_TRANSEQID_CUSTOM ((ZRCola::transeqid_t)0xffff)
///
/// ZRCola to Unicode translation sequence ID
///
#define ZRCOLA_TRANSEQID_UNICODE ((ZRCola::transeqid_t)32)
namespace ZRCola { namespace ZRCola {
/// ///

Binary file not shown.

View File

@ -694,24 +694,9 @@ msgstr ""
msgid "Ukrainian" msgid "Ukrainian"
msgstr "" msgstr ""
msgid "Unicode"
msgstr ""
msgid "Unicode Combining"
msgstr ""
msgid "Units" msgid "Units"
msgstr "" msgstr ""
msgid "ZRCola"
msgstr ""
msgid "ZRCola Composed"
msgstr ""
msgid "ZRCola » Unicode"
msgstr ""
msgid "l+j l|j" msgid "l+j l|j"
msgstr "" msgstr ""

View File

@ -700,24 +700,9 @@ msgstr ""
msgid "Ukrainian" msgid "Ukrainian"
msgstr "" msgstr ""
msgid "Unicode"
msgstr "Unicode"
msgid "Unicode Combining"
msgstr ""
msgid "Units" msgid "Units"
msgstr "" msgstr ""
msgid "ZRCola"
msgstr "ZRCola"
msgid "ZRCola Composed"
msgstr ""
msgid "ZRCola » Unicode"
msgstr "ZRCola » Unicode"
msgid "l+j l|j" msgid "l+j l|j"
msgstr "" msgstr ""
@ -726,3 +711,12 @@ msgstr ""
msgid "small Case" msgid "small Case"
msgstr "" msgstr ""
#~ msgid "Unicode"
#~ msgstr "Unicode"
#~ msgid "ZRCola"
#~ msgstr "ZRCola"
#~ msgid "ZRCola » Unicode"
#~ msgstr "ZRCola » Unicode"

View File

@ -702,24 +702,9 @@ msgstr "турецкий"
msgid "Ukrainian" msgid "Ukrainian"
msgstr "украинский" msgstr "украинский"
msgid "Unicode"
msgstr "Юникод"
msgid "Unicode Combining"
msgstr "комбинируемые символы в Юникоде"
msgid "Units" msgid "Units"
msgstr "Единицы" msgstr "Единицы"
msgid "ZRCola"
msgstr "ZRCola"
msgid "ZRCola Composed"
msgstr "ZRCola составленное"
msgid "ZRCola » Unicode"
msgstr "ZRCola » Юникод"
msgid "l+j l|j" msgid "l+j l|j"
msgstr "l+j l|j" msgstr "l+j l|j"
@ -729,6 +714,21 @@ msgstr "без + |"
msgid "small Case" msgid "small Case"
msgstr "строчние буквы" msgstr "строчние буквы"
#~ msgid "Unicode"
#~ msgstr "Юникод"
#~ msgid "Unicode Combining"
#~ msgstr "комбинируемые символы в Юникоде"
#~ msgid "ZRCola"
#~ msgstr "ZRCola"
#~ msgid "ZRCola Composed"
#~ msgstr "ZRCola составленное"
#~ msgid "ZRCola » Unicode"
#~ msgstr "ZRCola » Юникод"
#~ msgid "ZRCola Composed » Unicode Combining" #~ msgid "ZRCola Composed » Unicode Combining"
#~ msgstr "ZRCola составленное » комбинируемые символы в Юникоде" #~ msgstr "ZRCola составленное » комбинируемые символы в Юникоде"

View File

@ -702,24 +702,9 @@ msgstr "turščina"
msgid "Ukrainian" msgid "Ukrainian"
msgstr "ukrajinščina" msgstr "ukrajinščina"
msgid "Unicode"
msgstr "Unicode"
msgid "Unicode Combining"
msgstr "sestavljivi Unicode"
msgid "Units" msgid "Units"
msgstr "Enote" msgstr "Enote"
msgid "ZRCola"
msgstr "ZRCola"
msgid "ZRCola Composed"
msgstr "ZRCola-sestavljeno"
msgid "ZRCola » Unicode"
msgstr "ZRCola » Unicode"
msgid "l+j l|j" msgid "l+j l|j"
msgstr "l+j l|j" msgstr "l+j l|j"
@ -729,6 +714,21 @@ msgstr "brez + |"
msgid "small Case" msgid "small Case"
msgstr "male črke" msgstr "male črke"
#~ msgid "Unicode"
#~ msgstr "Unicode"
#~ msgid "Unicode Combining"
#~ msgstr "sestavljivi Unicode"
#~ msgid "ZRCola"
#~ msgstr "ZRCola"
#~ msgid "ZRCola Composed"
#~ msgstr "ZRCola-sestavljeno"
#~ msgid "ZRCola » Unicode"
#~ msgstr "ZRCola » Unicode"
#~ msgid "ZRCola Composed » Unicode Combining" #~ msgid "ZRCola Composed » Unicode Combining"
#~ msgstr "ZRCola-sestavljeno » sestavljivi Unicode" #~ msgstr "ZRCola-sestavljeno » sestavljivi Unicode"