Internationalize the context menu.

pull/106/head
whitequark 2017-01-05 12:35:50 +00:00
parent 27ac3c7b5f
commit 00dda08917
5 changed files with 205 additions and 26 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 12:25+0000\n"
"POT-Creation-Date: 2017-01-05 12:33+0000\n"
"PO-Revision-Date: 2017-01-05 10:30+0000\n"
"Last-Translator: Automatically generated\n"
"Language-Team: none\n"
@ -425,6 +425,94 @@ msgstr "&Language"
msgid "&About"
msgstr "&About"
#: /home/whitequark/Work/solvespace/src/mouse.cpp:495
msgid "No Style"
msgstr "No Style"
#: /home/whitequark/Work/solvespace/src/mouse.cpp:496
msgid "Newly Created Custom Style..."
msgstr "Newly Created Custom Style..."
#: /home/whitequark/Work/solvespace/src/mouse.cpp:544
msgid "Assign to Style"
msgstr "Assign to Style"
#: /home/whitequark/Work/solvespace/src/mouse.cpp:547
msgid "Group Info"
msgstr "Group Info"
#: /home/whitequark/Work/solvespace/src/mouse.cpp:550
msgid "Style Info"
msgstr "Style Info"
#: /home/whitequark/Work/solvespace/src/mouse.cpp:553
msgid "Select Edge Chain"
msgstr "Select Edge Chain"
#: /home/whitequark/Work/solvespace/src/mouse.cpp:558
msgid "Toggle Reference Dimension"
msgstr "Toggle Reference Dimension"
#: /home/whitequark/Work/solvespace/src/mouse.cpp:564
msgid "Other Supplementary Angle"
msgstr "Other Supplementary Angle"
#: /home/whitequark/Work/solvespace/src/mouse.cpp:569
msgid "Snap to Grid"
msgstr "Snap to Grid"
#: /home/whitequark/Work/solvespace/src/mouse.cpp:577
msgid "Remove Spline Point"
msgstr "Remove Spline Point"
#: /home/whitequark/Work/solvespace/src/mouse.cpp:588
msgid "Add Spline Point"
msgstr "Add Spline Point"
#: /home/whitequark/Work/solvespace/src/mouse.cpp:592
msgid "Toggle Construction"
msgstr "Toggle Construction"
#: /home/whitequark/Work/solvespace/src/mouse.cpp:606
msgid "Delete Point-Coincident Constraint"
msgstr "Delete Point-Coincident Constraint"
#: /home/whitequark/Work/solvespace/src/mouse.cpp:612
msgid "Cut"
msgstr "Cut"
#: /home/whitequark/Work/solvespace/src/mouse.cpp:613
msgid "Copy"
msgstr "Copy"
#: /home/whitequark/Work/solvespace/src/mouse.cpp:616
msgid "Select All"
msgstr "Select All"
#: /home/whitequark/Work/solvespace/src/mouse.cpp:620
msgid "Paste"
msgstr "Paste"
#: /home/whitequark/Work/solvespace/src/mouse.cpp:621
msgid "Paste Transformed..."
msgstr "Paste Transformed..."
#: /home/whitequark/Work/solvespace/src/mouse.cpp:625
msgid "Delete"
msgstr "Delete"
#: /home/whitequark/Work/solvespace/src/mouse.cpp:627
msgid "Unselect All"
msgstr "Unselect All"
#: /home/whitequark/Work/solvespace/src/mouse.cpp:633
msgid "Unselect Hovered"
msgstr "Unselect Hovered"
#: /home/whitequark/Work/solvespace/src/mouse.cpp:638
msgid "Zoom to Fit"
msgstr "Zoom to Fit"
#: /home/whitequark/Work/solvespace/src/toolbar.cpp:18
msgid "Sketch line segment"
msgstr "Sketch line segment"

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 12:25+0000\n"
"POT-Creation-Date: 2017-01-05 12:33+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"
@ -425,6 +425,94 @@ msgstr ""
msgid "&About"
msgstr ""
#: /home/whitequark/Work/solvespace/src/mouse.cpp:495
msgid "No Style"
msgstr ""
#: /home/whitequark/Work/solvespace/src/mouse.cpp:496
msgid "Newly Created Custom Style..."
msgstr ""
#: /home/whitequark/Work/solvespace/src/mouse.cpp:544
msgid "Assign to Style"
msgstr ""
#: /home/whitequark/Work/solvespace/src/mouse.cpp:547
msgid "Group Info"
msgstr ""
#: /home/whitequark/Work/solvespace/src/mouse.cpp:550
msgid "Style Info"
msgstr ""
#: /home/whitequark/Work/solvespace/src/mouse.cpp:553
msgid "Select Edge Chain"
msgstr ""
#: /home/whitequark/Work/solvespace/src/mouse.cpp:558
msgid "Toggle Reference Dimension"
msgstr ""
#: /home/whitequark/Work/solvespace/src/mouse.cpp:564
msgid "Other Supplementary Angle"
msgstr ""
#: /home/whitequark/Work/solvespace/src/mouse.cpp:569
msgid "Snap to Grid"
msgstr ""
#: /home/whitequark/Work/solvespace/src/mouse.cpp:577
msgid "Remove Spline Point"
msgstr ""
#: /home/whitequark/Work/solvespace/src/mouse.cpp:588
msgid "Add Spline Point"
msgstr ""
#: /home/whitequark/Work/solvespace/src/mouse.cpp:592
msgid "Toggle Construction"
msgstr ""
#: /home/whitequark/Work/solvespace/src/mouse.cpp:606
msgid "Delete Point-Coincident Constraint"
msgstr ""
#: /home/whitequark/Work/solvespace/src/mouse.cpp:612
msgid "Cut"
msgstr ""
#: /home/whitequark/Work/solvespace/src/mouse.cpp:613
msgid "Copy"
msgstr ""
#: /home/whitequark/Work/solvespace/src/mouse.cpp:616
msgid "Select All"
msgstr ""
#: /home/whitequark/Work/solvespace/src/mouse.cpp:620
msgid "Paste"
msgstr ""
#: /home/whitequark/Work/solvespace/src/mouse.cpp:621
msgid "Paste Transformed..."
msgstr ""
#: /home/whitequark/Work/solvespace/src/mouse.cpp:625
msgid "Delete"
msgstr ""
#: /home/whitequark/Work/solvespace/src/mouse.cpp:627
msgid "Unselect All"
msgstr ""
#: /home/whitequark/Work/solvespace/src/mouse.cpp:633
msgid "Unselect Hovered"
msgstr ""
#: /home/whitequark/Work/solvespace/src/mouse.cpp:638
msgid "Zoom to Fit"
msgstr ""
#: /home/whitequark/Work/solvespace/src/toolbar.cpp:18
msgid "Sketch line segment"
msgstr ""

View File

@ -220,7 +220,8 @@ if(HAVE_GETTEXT)
add_custom_command(
OUTPUT ${output_pot}
COMMAND ${XGETTEXT}
--keyword --keyword=N_ --width=100 --sort-by-file --force-po
--keyword --keyword=_ --keyword=N_
--force-po --width=100 --sort-by-file
--package-name=SolveSpace --package-version=3.0
"--copyright-holder=the PACKAGE authors"
--msgid-bugs-address=whitequark@whitequark.org

View File

@ -485,14 +485,15 @@ void GraphicsWindow::ContextMenuListStyles() {
for(s = SK.style.First(); s; s = SK.style.NextAfter(s)) {
if(s->h.v < Style::FIRST_CUSTOM) continue;
AddContextMenuItem(s->DescriptionString().c_str(), (ContextCommand)((uint32_t)ContextCommand::FIRST_STYLE + s->h.v));
AddContextMenuItem(s->DescriptionString().c_str(),
(ContextCommand)((uint32_t)ContextCommand::FIRST_STYLE + s->h.v));
empty = false;
}
if(!empty) AddContextMenuItem(NULL, ContextCommand::SEPARATOR);
AddContextMenuItem("No Style", ContextCommand::NO_STYLE);
AddContextMenuItem("Newly Created Custom Style...", ContextCommand::NEW_CUSTOM_STYLE);
AddContextMenuItem(_("No Style"), ContextCommand::NO_STYLE);
AddContextMenuItem(_("Newly Created Custom Style..."), ContextCommand::NEW_CUSTOM_STYLE);
}
void GraphicsWindow::MouseRightUp(double x, double y) {
@ -540,32 +541,32 @@ void GraphicsWindow::MouseRightUp(double x, double y) {
if(itemsSelected) {
if(gs.stylables > 0) {
ContextMenuListStyles();
AddContextMenuItem("Assign to Style", ContextCommand::SUBMENU);
AddContextMenuItem(_("Assign to Style"), ContextCommand::SUBMENU);
}
if(gs.n + gs.constraints == 1) {
AddContextMenuItem("Group Info", ContextCommand::GROUP_INFO);
AddContextMenuItem(_("Group Info"), ContextCommand::GROUP_INFO);
}
if(gs.n + gs.constraints == 1 && gs.stylables == 1) {
AddContextMenuItem("Style Info", ContextCommand::STYLE_INFO);
AddContextMenuItem(_("Style Info"), ContextCommand::STYLE_INFO);
}
if(gs.withEndpoints > 0) {
AddContextMenuItem("Select Edge Chain", ContextCommand::SELECT_CHAIN);
AddContextMenuItem(_("Select Edge Chain"), ContextCommand::SELECT_CHAIN);
}
if(gs.constraints == 1 && gs.n == 0) {
Constraint *c = SK.GetConstraint(gs.constraint[0]);
if(c->HasLabel() && c->type != Constraint::Type::COMMENT) {
AddContextMenuItem("Toggle Reference Dimension",
AddContextMenuItem(_("Toggle Reference Dimension"),
ContextCommand::REFERENCE_DIM);
}
if(c->type == Constraint::Type::ANGLE ||
c->type == Constraint::Type::EQUAL_ANGLE)
{
AddContextMenuItem("Other Supplementary Angle",
AddContextMenuItem(_("Other Supplementary Angle"),
ContextCommand::OTHER_ANGLE);
}
}
if(gs.constraintLabels > 0 || gs.points > 0) {
AddContextMenuItem("Snap to Grid", ContextCommand::SNAP_TO_GRID);
AddContextMenuItem(_("Snap to Grid"), ContextCommand::SNAP_TO_GRID);
}
if(gs.points == 1 && gs.point[0].isFromRequest()) {
@ -573,7 +574,7 @@ void GraphicsWindow::MouseRightUp(double x, double y) {
int index = r->IndexOfPoint(gs.point[0]);
if((r->type == Request::Type::CUBIC && (index > 1 && index < r->extraPoints + 2)) ||
r->type == Request::Type::CUBIC_PERIODIC) {
AddContextMenuItem("Remove Spline Point", ContextCommand::REMOVE_SPLINE_PT);
AddContextMenuItem(_("Remove Spline Point"), ContextCommand::REMOVE_SPLINE_PT);
}
}
if(gs.entities == 1 && gs.entity[0].isFromRequest()) {
@ -584,11 +585,11 @@ void GraphicsWindow::MouseRightUp(double x, double y) {
ssassert(addAfterPoint != -1, "Expected a nearest bezier point to be located");
// Skip derivative point.
if(r->type == Request::Type::CUBIC) addAfterPoint++;
AddContextMenuItem("Add Spline Point", ContextCommand::ADD_SPLINE_PT);
AddContextMenuItem(_("Add Spline Point"), ContextCommand::ADD_SPLINE_PT);
}
}
if(gs.entities == gs.n) {
AddContextMenuItem("Toggle Construction", ContextCommand::CONSTRUCTION);
AddContextMenuItem(_("Toggle Construction"), ContextCommand::CONSTRUCTION);
}
if(gs.points == 1) {
@ -602,39 +603,39 @@ void GraphicsWindow::MouseRightUp(double x, double y) {
}
}
if(c) {
AddContextMenuItem("Delete Point-Coincident Constraint",
AddContextMenuItem(_("Delete Point-Coincident Constraint"),
ContextCommand::DEL_COINCIDENT);
}
}
AddContextMenuItem(NULL, ContextCommand::SEPARATOR);
if(LockedInWorkplane()) {
AddContextMenuItem("Cut", ContextCommand::CUT_SEL);
AddContextMenuItem("Copy", ContextCommand::COPY_SEL);
AddContextMenuItem(_("Cut"), ContextCommand::CUT_SEL);
AddContextMenuItem(_("Copy"), ContextCommand::COPY_SEL);
}
} else {
AddContextMenuItem("Select All", ContextCommand::SELECT_ALL);
AddContextMenuItem(_("Select All"), ContextCommand::SELECT_ALL);
}
if((SS.clipboard.r.n > 0 || SS.clipboard.c.n > 0) && LockedInWorkplane()) {
AddContextMenuItem("Paste", ContextCommand::PASTE);
AddContextMenuItem("Paste Transformed...", ContextCommand::PASTE_XFRM);
AddContextMenuItem(_("Paste"), ContextCommand::PASTE);
AddContextMenuItem(_("Paste Transformed..."), ContextCommand::PASTE_XFRM);
}
if(itemsSelected) {
AddContextMenuItem("Delete", ContextCommand::DELETE_SEL);
AddContextMenuItem(_("Delete"), ContextCommand::DELETE_SEL);
AddContextMenuItem(NULL, ContextCommand::SEPARATOR);
AddContextMenuItem("Unselect All", ContextCommand::UNSELECT_ALL);
AddContextMenuItem(_("Unselect All"), ContextCommand::UNSELECT_ALL);
}
// If only one item is selected, then it must be the one that we just
// selected from the hovered item; in which case unselect all and hovered
// are equivalent.
if(!hover.IsEmpty() && selection.n > 1) {
AddContextMenuItem("Unselect Hovered", ContextCommand::UNSELECT_HOVERED);
AddContextMenuItem(_("Unselect Hovered"), ContextCommand::UNSELECT_HOVERED);
}
if(itemsSelected) {
AddContextMenuItem(NULL, ContextCommand::SEPARATOR);
AddContextMenuItem("Zoom to Fit", ContextCommand::ZOOM_TO_FIT);
AddContextMenuItem(_("Zoom to Fit"), ContextCommand::ZOOM_TO_FIT);
}
ContextCommand ret = ShowContextMenu();

View File

@ -35,6 +35,7 @@ const std::string &Translate(const char *msgid);
const std::string &TranslatePlural(const char *msgid, unsigned n);
inline const char *N_(const char *msgid) { return msgid; }
inline const char *_(const char *msgid) { return Translate(msgid).c_str(); }
// This table describes the top-level menus in the graphics winodw.
enum class Command : uint32_t {