Internationalize the toolbar.

pull/106/head
whitequark 2017-01-05 12:27:28 +00:00
parent 529e1bfd63
commit 27ac3c7b5f
4 changed files with 325 additions and 50 deletions

View File

@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: SolveSpace 3.0\n"
"Report-Msgid-Bugs-To: whitequark@whitequark.org\n"
"POT-Creation-Date: 2017-01-05 10:37+0000\n"
"POT-Creation-Date: 2017-01-05 12:25+0000\n"
"PO-Revision-Date: 2017-01-05 10:30+0000\n"
"Last-Translator: Automatically generated\n"
"Language-Team: none\n"
@ -424,3 +424,127 @@ msgstr "&Language"
#: /home/whitequark/Work/solvespace/src/graphicswin.cpp:166
msgid "&About"
msgstr "&About"
#: /home/whitequark/Work/solvespace/src/toolbar.cpp:18
msgid "Sketch line segment"
msgstr "Sketch line segment"
#: /home/whitequark/Work/solvespace/src/toolbar.cpp:20
msgid "Sketch rectangle"
msgstr "Sketch rectangle"
#: /home/whitequark/Work/solvespace/src/toolbar.cpp:22
msgid "Sketch circle"
msgstr "Sketch circle"
#: /home/whitequark/Work/solvespace/src/toolbar.cpp:24
msgid "Sketch arc of a circle"
msgstr "Sketch arc of a circle"
#: /home/whitequark/Work/solvespace/src/toolbar.cpp:26
msgid "Sketch curves from text in a TrueType font"
msgstr "Sketch curves from text in a TrueType font"
#: /home/whitequark/Work/solvespace/src/toolbar.cpp:28
msgid "Create tangent arc at selected point"
msgstr "Create tangent arc at selected point"
#: /home/whitequark/Work/solvespace/src/toolbar.cpp:30
msgid "Sketch cubic Bezier spline"
msgstr "Sketch cubic Bezier spline"
#: /home/whitequark/Work/solvespace/src/toolbar.cpp:32
msgid "Sketch datum point"
msgstr "Sketch datum point"
#: /home/whitequark/Work/solvespace/src/toolbar.cpp:34
msgid "Toggle construction"
msgstr "Toggle construction"
#: /home/whitequark/Work/solvespace/src/toolbar.cpp:36
msgid "Split lines / curves where they intersect"
msgstr "Split lines / curves where they intersect"
#: /home/whitequark/Work/solvespace/src/toolbar.cpp:40
msgid "Constrain distance / diameter / length"
msgstr "Constrain distance / diameter / length"
#: /home/whitequark/Work/solvespace/src/toolbar.cpp:42
msgid "Constrain angle"
msgstr "Constrain angle"
#: /home/whitequark/Work/solvespace/src/toolbar.cpp:44
msgid "Constrain to be horizontal"
msgstr "Constrain to be horizontal"
#: /home/whitequark/Work/solvespace/src/toolbar.cpp:46
msgid "Constrain to be vertical"
msgstr "Constrain to be vertical"
#: /home/whitequark/Work/solvespace/src/toolbar.cpp:48
msgid "Constrain to be parallel or tangent"
msgstr "Constrain to be parallel or tangent"
#: /home/whitequark/Work/solvespace/src/toolbar.cpp:50
msgid "Constrain to be perpendicular"
msgstr "Constrain to be perpendicular"
#: /home/whitequark/Work/solvespace/src/toolbar.cpp:52
msgid "Constrain point on line / curve / plane / point"
msgstr "Constrain point on line / curve / plane / point"
#: /home/whitequark/Work/solvespace/src/toolbar.cpp:54
msgid "Constrain symmetric"
msgstr "Constrain symmetric"
#: /home/whitequark/Work/solvespace/src/toolbar.cpp:56
msgid "Constrain equal length / radius / angle"
msgstr "Constrain equal length / radius / angle"
#: /home/whitequark/Work/solvespace/src/toolbar.cpp:58
msgid "Constrain normals in same orientation"
msgstr "Constrain normals in same orientation"
#: /home/whitequark/Work/solvespace/src/toolbar.cpp:60
msgid "Other supplementary angle"
msgstr "Other supplementary angle"
#: /home/whitequark/Work/solvespace/src/toolbar.cpp:62
msgid "Toggle reference dimension"
msgstr "Toggle reference dimension"
#: /home/whitequark/Work/solvespace/src/toolbar.cpp:66
msgid "New group extruding active sketch"
msgstr "New group extruding active sketch"
#: /home/whitequark/Work/solvespace/src/toolbar.cpp:68
msgid "New group rotating active sketch"
msgstr "New group rotating active sketch"
#: /home/whitequark/Work/solvespace/src/toolbar.cpp:70
msgid "New group step and repeat rotating"
msgstr "New group step and repeat rotating"
#: /home/whitequark/Work/solvespace/src/toolbar.cpp:72
msgid "New group step and repeat translating"
msgstr "New group step and repeat translating"
#: /home/whitequark/Work/solvespace/src/toolbar.cpp:74
msgid "New group in new workplane (thru given entities)"
msgstr "New group in new workplane (thru given entities)"
#: /home/whitequark/Work/solvespace/src/toolbar.cpp:76
msgid "New group in 3d"
msgstr "New group in 3d"
#: /home/whitequark/Work/solvespace/src/toolbar.cpp:78
msgid "New group linking / assembling file"
msgstr "New group linking / assembling file"
#: /home/whitequark/Work/solvespace/src/toolbar.cpp:82
msgid "Nearest isometric view"
msgstr "Nearest isometric view"
#: /home/whitequark/Work/solvespace/src/toolbar.cpp:84
msgid "Align view to active workplane"
msgstr "Align view to active workplane"

View File

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: SolveSpace 3.0\n"
"Report-Msgid-Bugs-To: whitequark@whitequark.org\n"
"POT-Creation-Date: 2017-01-05 10:37+0000\n"
"POT-Creation-Date: 2017-01-05 12:25+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@ -424,3 +424,127 @@ msgstr ""
#: /home/whitequark/Work/solvespace/src/graphicswin.cpp:166
msgid "&About"
msgstr ""
#: /home/whitequark/Work/solvespace/src/toolbar.cpp:18
msgid "Sketch line segment"
msgstr ""
#: /home/whitequark/Work/solvespace/src/toolbar.cpp:20
msgid "Sketch rectangle"
msgstr ""
#: /home/whitequark/Work/solvespace/src/toolbar.cpp:22
msgid "Sketch circle"
msgstr ""
#: /home/whitequark/Work/solvespace/src/toolbar.cpp:24
msgid "Sketch arc of a circle"
msgstr ""
#: /home/whitequark/Work/solvespace/src/toolbar.cpp:26
msgid "Sketch curves from text in a TrueType font"
msgstr ""
#: /home/whitequark/Work/solvespace/src/toolbar.cpp:28
msgid "Create tangent arc at selected point"
msgstr ""
#: /home/whitequark/Work/solvespace/src/toolbar.cpp:30
msgid "Sketch cubic Bezier spline"
msgstr ""
#: /home/whitequark/Work/solvespace/src/toolbar.cpp:32
msgid "Sketch datum point"
msgstr ""
#: /home/whitequark/Work/solvespace/src/toolbar.cpp:34
msgid "Toggle construction"
msgstr ""
#: /home/whitequark/Work/solvespace/src/toolbar.cpp:36
msgid "Split lines / curves where they intersect"
msgstr ""
#: /home/whitequark/Work/solvespace/src/toolbar.cpp:40
msgid "Constrain distance / diameter / length"
msgstr ""
#: /home/whitequark/Work/solvespace/src/toolbar.cpp:42
msgid "Constrain angle"
msgstr ""
#: /home/whitequark/Work/solvespace/src/toolbar.cpp:44
msgid "Constrain to be horizontal"
msgstr ""
#: /home/whitequark/Work/solvespace/src/toolbar.cpp:46
msgid "Constrain to be vertical"
msgstr ""
#: /home/whitequark/Work/solvespace/src/toolbar.cpp:48
msgid "Constrain to be parallel or tangent"
msgstr ""
#: /home/whitequark/Work/solvespace/src/toolbar.cpp:50
msgid "Constrain to be perpendicular"
msgstr ""
#: /home/whitequark/Work/solvespace/src/toolbar.cpp:52
msgid "Constrain point on line / curve / plane / point"
msgstr ""
#: /home/whitequark/Work/solvespace/src/toolbar.cpp:54
msgid "Constrain symmetric"
msgstr ""
#: /home/whitequark/Work/solvespace/src/toolbar.cpp:56
msgid "Constrain equal length / radius / angle"
msgstr ""
#: /home/whitequark/Work/solvespace/src/toolbar.cpp:58
msgid "Constrain normals in same orientation"
msgstr ""
#: /home/whitequark/Work/solvespace/src/toolbar.cpp:60
msgid "Other supplementary angle"
msgstr ""
#: /home/whitequark/Work/solvespace/src/toolbar.cpp:62
msgid "Toggle reference dimension"
msgstr ""
#: /home/whitequark/Work/solvespace/src/toolbar.cpp:66
msgid "New group extruding active sketch"
msgstr ""
#: /home/whitequark/Work/solvespace/src/toolbar.cpp:68
msgid "New group rotating active sketch"
msgstr ""
#: /home/whitequark/Work/solvespace/src/toolbar.cpp:70
msgid "New group step and repeat rotating"
msgstr ""
#: /home/whitequark/Work/solvespace/src/toolbar.cpp:72
msgid "New group step and repeat translating"
msgstr ""
#: /home/whitequark/Work/solvespace/src/toolbar.cpp:74
msgid "New group in new workplane (thru given entities)"
msgstr ""
#: /home/whitequark/Work/solvespace/src/toolbar.cpp:76
msgid "New group in 3d"
msgstr ""
#: /home/whitequark/Work/solvespace/src/toolbar.cpp:78
msgid "New group linking / assembling file"
msgstr ""
#: /home/whitequark/Work/solvespace/src/toolbar.cpp:82
msgid "Nearest isometric view"
msgstr ""
#: /home/whitequark/Work/solvespace/src/toolbar.cpp:84
msgid "Align view to active workplane"
msgstr ""

View File

@ -234,7 +234,7 @@ if(HAVE_GETTEXT)
--locale=en_US --no-translator
--output=${templ_po} --input=${output_pot}
COMMAND ${MSGMERGE}
--force-po
--force-po --no-fuzzy-matching
--output=${output_po} ${output_po} ${templ_po}
DEPENDS ${output_pot}
COMMENT "Updating English translations"

View File

@ -10,47 +10,78 @@
struct ToolIcon {
std::string name;
Command command;
std::string tooltip;
const char *tooltip;
std::shared_ptr<Pixmap> pixmap;
};
static ToolIcon Toolbar[] = {
{ "line", Command::LINE_SEGMENT, "Sketch line segment", {} },
{ "rectangle", Command::RECTANGLE, "Sketch rectangle", {} },
{ "circle", Command::CIRCLE, "Sketch circle", {} },
{ "arc", Command::ARC, "Sketch arc of a circle", {} },
{ "text", Command::TTF_TEXT, "Sketch curves from text in a TrueType font", {} },
{ "tangent-arc", Command::TANGENT_ARC, "Create tangent arc at selected point", {} },
{ "bezier", Command::CUBIC, "Sketch cubic Bezier spline", {} },
{ "point", Command::DATUM_POINT, "Sketch datum point", {} },
{ "construction", Command::CONSTRUCTION, "Toggle construction", {} },
{ "trim", Command::SPLIT_CURVES, "Split lines / curves where they intersect", {} },
{ "line", Command::LINE_SEGMENT,
N_("Sketch line segment"), {} },
{ "rectangle", Command::RECTANGLE,
N_("Sketch rectangle"), {} },
{ "circle", Command::CIRCLE,
N_("Sketch circle"), {} },
{ "arc", Command::ARC,
N_("Sketch arc of a circle"), {} },
{ "text", Command::TTF_TEXT,
N_("Sketch curves from text in a TrueType font"), {} },
{ "tangent-arc", Command::TANGENT_ARC,
N_("Create tangent arc at selected point"), {} },
{ "bezier", Command::CUBIC,
N_("Sketch cubic Bezier spline"), {} },
{ "point", Command::DATUM_POINT,
N_("Sketch datum point"), {} },
{ "construction", Command::CONSTRUCTION,
N_("Toggle construction"), {} },
{ "trim", Command::SPLIT_CURVES,
N_("Split lines / curves where they intersect"), {} },
{ "", Command::NONE, "", {} },
{ "length", Command::DISTANCE_DIA, "Constrain distance / diameter / length", {} },
{ "angle", Command::ANGLE, "Constrain angle", {} },
{ "horiz", Command::HORIZONTAL, "Constrain to be horizontal", {} },
{ "vert", Command::VERTICAL, "Constrain to be vertical", {} },
{ "parallel", Command::PARALLEL, "Constrain to be parallel or tangent", {} },
{ "perpendicular", Command::PERPENDICULAR, "Constrain to be perpendicular", {} },
{ "pointonx", Command::ON_ENTITY, "Constrain point on line / curve / plane / point", {} },
{ "symmetric", Command::SYMMETRIC, "Constrain symmetric", {} },
{ "equal", Command::EQUAL, "Constrain equal length / radius / angle", {} },
{ "same-orientation",Command::ORIENTED_SAME, "Constrain normals in same orientation", {} },
{ "other-supp", Command::OTHER_ANGLE, "Other supplementary angle", {} },
{ "ref", Command::REFERENCE, "Toggle reference dimension", {} },
{ "length", Command::DISTANCE_DIA,
N_("Constrain distance / diameter / length"), {} },
{ "angle", Command::ANGLE,
N_("Constrain angle"), {} },
{ "horiz", Command::HORIZONTAL,
N_("Constrain to be horizontal"), {} },
{ "vert", Command::VERTICAL,
N_("Constrain to be vertical"), {} },
{ "parallel", Command::PARALLEL,
N_("Constrain to be parallel or tangent"), {} },
{ "perpendicular", Command::PERPENDICULAR,
N_("Constrain to be perpendicular"), {} },
{ "pointonx", Command::ON_ENTITY,
N_("Constrain point on line / curve / plane / point"), {} },
{ "symmetric", Command::SYMMETRIC,
N_("Constrain symmetric"), {} },
{ "equal", Command::EQUAL,
N_("Constrain equal length / radius / angle"), {} },
{ "same-orientation",Command::ORIENTED_SAME,
N_("Constrain normals in same orientation"), {} },
{ "other-supp", Command::OTHER_ANGLE,
N_("Other supplementary angle"), {} },
{ "ref", Command::REFERENCE,
N_("Toggle reference dimension"), {} },
{ "", Command::NONE, "", {} },
{ "extrude", Command::GROUP_EXTRUDE, "New group extruding active sketch", {} },
{ "lathe", Command::GROUP_LATHE, "New group rotating active sketch", {} },
{ "step-rotate", Command::GROUP_ROT, "New group step and repeat rotating", {} },
{ "step-translate", Command::GROUP_TRANS, "New group step and repeat translating", {} },
{ "sketch-in-plane", Command::GROUP_WRKPL, "New group in new workplane (thru given entities)", {} },
{ "sketch-in-3d", Command::GROUP_3D, "New group in 3d", {} },
{ "assemble", Command::GROUP_LINK, "New group linking / assembling file", {} },
{ "extrude", Command::GROUP_EXTRUDE,
N_("New group extruding active sketch"), {} },
{ "lathe", Command::GROUP_LATHE,
N_("New group rotating active sketch"), {} },
{ "step-rotate", Command::GROUP_ROT,
N_("New group step and repeat rotating"), {} },
{ "step-translate", Command::GROUP_TRANS,
N_("New group step and repeat translating"), {} },
{ "sketch-in-plane", Command::GROUP_WRKPL,
N_("New group in new workplane (thru given entities)"), {} },
{ "sketch-in-3d", Command::GROUP_3D,
N_("New group in 3d"), {} },
{ "assemble", Command::GROUP_LINK,
N_("New group linking / assembling file"), {} },
{ "", Command::NONE, "", {} },
{ "in3d", Command::NEAREST_ISO, "Nearest isometric view", {} },
{ "ontoworkplane", Command::ONTO_WORKPLANE, "Align view to active workplane", {} },
{ "in3d", Command::NEAREST_ISO,
N_("Nearest isometric view"), {} },
{ "ontoworkplane", Command::ONTO_WORKPLANE,
N_("Align view to active workplane"), {} },
};
void GraphicsWindow::ToolbarDraw(UiCanvas *canvas) {
@ -126,10 +157,8 @@ bool GraphicsWindow::ToolbarDrawOrHitTest(int mx, int my,
/*outlineColor=*/{});
}
struct {
bool show;
const char *str;
} toolTip = { false, NULL };
bool showTooltip;
std::string tooltip;
bool leftpos = true;
for(ToolIcon &icon : Toolbar) {
@ -175,8 +204,8 @@ bool GraphicsWindow::ToolbarDrawOrHitTest(int mx, int my,
// Display the tool tip for this item; postpone till later
// so that no one draws over us. Don't need position since
// that's just wherever the mouse is.
toolTip.show = true;
toolTip.str = icon.tooltip.c_str();
showTooltip = true;
tooltip = Translate(icon.tooltip);
}
} else {
int boxhw = 16;
@ -199,27 +228,25 @@ bool GraphicsWindow::ToolbarDrawOrHitTest(int mx, int my,
if(canvas) {
// Do this last so that nothing can draw over it.
if(toolTip.show) {
std::string str = toolTip.str;
if(showTooltip) {
for(i = 0; SS.GW.menu[i].level >= 0; i++) {
if(toolbarTooltipped == SS.GW.menu[i].id) {
std::string accel = MakeAcceleratorLabel(SS.GW.menu[i].accel);
if(!accel.empty()) {
str += ssprintf(" (%s)", accel.c_str());
tooltip += ssprintf(" (%s)", accel.c_str());
}
break;
}
}
int tw = BitmapFont::Builtin()->GetWidth(str) * 8 + 10,
int tw = BitmapFont::Builtin()->GetWidth(tooltip) * 8 + 10,
th = SS.TW.LINE_HEIGHT + 2;
int ox = toolbarMouseX + 3, oy = toolbarMouseY + 3;
canvas->DrawRect(ox, ox+tw, oy, oy+th,
/*fillColor=*/{ 255, 255, 150, 255 },
/*outlineColor=*/{ 0, 0, 0, 255 });
canvas->DrawBitmapText(str, ox+5, oy+4, { 0, 0, 0, 255 });
canvas->DrawBitmapText(tooltip, ox+5, oy+4, { 0, 0, 0, 255 });
}
}