Make templates localizable (Closes #100)

This commit is contained in:
Twan van Laarhoven
2020-10-03 14:38:39 +02:00
parent f2ae3ae43b
commit c7377303cf
23 changed files with 155 additions and 63 deletions
+1 -1
View File
@@ -355,7 +355,7 @@ void DataEditor::onMotion(wxMouseEvent& ev) {
// set status text
wxFrame* frame = dynamic_cast<wxFrame*>( wxGetTopLevelParent(this) );
if (frame) {
frame->SetStatusText(hovered_viewer ? hovered_viewer->getField()->description : String());
frame->SetStatusText(hovered_viewer ? hovered_viewer->getField()->description.get() : String());
}
}
}
+1 -3
View File
@@ -225,9 +225,7 @@ void CardListBase::rebuild() {
if (f.second->card_list_align & ALIGN_RIGHT) align = wxLIST_FORMAT_RIGHT;
else if (f.second->card_list_align & ALIGN_CENTER) align = wxLIST_FORMAT_CENTRE;
else align = wxLIST_FORMAT_LEFT;
InsertColumn((long)column_fields.size(),
tr(*set->game, f.second->card_list_name, identity),
align, cs.width);
InsertColumn((long)column_fields.size(), f.second->card_list_name.get(), align, cs.width);
column_fields.push_back(f.second);
}
// determine sort settings
+2 -2
View File
@@ -67,7 +67,7 @@ void CardListColumnSelectDialog::initList() {
// Init items
Color window_color = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW);
FOR_EACH(c, columns) {
list->Append(tr(*game, c.field->card_list_name, identity));
list->Append(c.field->card_list_name.get());
// check
int i = list->GetCount() - 1;
list->Check(i, c.settings.visible);
@@ -80,7 +80,7 @@ void CardListColumnSelectDialog::initList() {
void CardListColumnSelectDialog::refreshItem(int i) {
list->Check (i, columns[i].settings.visible);
list->SetString(i, tr(*game, columns[i].field->card_list_name, identity) );
list->SetString(i, columns[i].field->card_list_name.get());
}
// ----------------------------------------------------------------------------- : Events
+2 -5
View File
@@ -39,9 +39,7 @@ void NativeLookEditor::drawViewer(RotatedDC& dc, ValueViewer& v) {
// draw label
dc.SetFont(*wxNORMAL_FONT);
dc.SetTextForeground(wxSystemSettings::GetColour(wxSYS_COLOUR_BTNTEXT));
// TODO : tr using stylesheet or using game?
dc.DrawText(tr(getStylePackage(), v.getField()->caption, identity),
RealPoint(margin_left - v.bounding_box.x, 1));
dc.DrawText(v.getField()->caption.get(), RealPoint(margin_left - v.bounding_box.x, 1));
}
// draw viewer
v.draw(dc);
@@ -64,8 +62,7 @@ void NativeLookEditor::resizeViewers() {
// width of the label string
int w;
Style& s = *v->getStyle();
String text = tr(getStylePackage(), s.fieldP->caption, identity);
dc.GetTextExtent(text,&w,nullptr);
dc.GetTextExtent(s.fieldP->caption.get(), &w, nullptr);
label_width = max(label_width, w + label_margin);
}
}