Language localization optimization

This commit is contained in:
Simon Rozman 2016-05-04 15:52:47 +02:00
parent 6e4cd60152
commit 9a2bc6b743

View File

@ -80,21 +80,24 @@ wxZRColaFrame::wxZRColaFrame() :
SetIcon(wxICON(00_zrcola.ico));
#endif
{
// Populate language lists.
memcpy(m_lang, ZRCOLA_LANG_VOID, sizeof(m_lang));
ZRColaApp *app = ((ZRColaApp*)wxTheApp);
m_toolDecompLanguage->Clear();
wxString label1_tran(_("Select %s language for decomposition"));
for (size_t i = 0, n = app->m_lang_db.idxLng.size(); i < n; i++) {
const ZRCola::language_db::language &lang = app->m_lang_db.idxLng[i];
wxString
label(lang.name, lang.name_len),
label_tran(wxGetTranslation(label));
label_tran2(wxGetTranslation(label, wxT("ZRCola-zrcdb")));
if (i < wxID_DECOMP_LANGUAGE_END - wxID_DECOMP_LANGUAGE_START + 1)
m_menuDecompLanguage->AppendRadioItem(wxID_DECOMP_LANGUAGE_START + i, label_tran, wxString::Format(_("Select %s language for decomposition"), (const wxStringCharType*)label_tran));
m_toolDecompLanguage->Insert(label_tran, i);
m_menuDecompLanguage->AppendRadioItem(wxID_DECOMP_LANGUAGE_START + i, label_tran2, wxString::Format(label1_tran, (const wxStringCharType*)label_tran2));
m_toolDecompLanguage->Insert(label_tran2, i);
if (memcmp(m_lang, lang.id, sizeof(m_lang)) == 0)
m_toolDecompLanguage->Select(i);
}
}
// Set focus.
m_panel->m_decomposed->SetFocus();