From 21781a559a1ba7155288d93891ac3f422598fba8 Mon Sep 17 00:00:00 2001 From: twanvl Date: Thu, 22 Mar 2007 14:27:55 +0000 Subject: [PATCH] localization of symbol editor git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@227 0fc631ac-6414-0410-93d0-97cfa31319b6 --- data/en.mse-locale/locale | 191 ++++++++++++++++++++------ src/data/locale.cpp | 21 +-- src/gui/set/cards_panel.cpp | 14 +- src/gui/set/set_info_panel.cpp | 6 +- src/gui/set/window.cpp | 40 +++--- src/gui/symbol/basic_shape_editor.cpp | 45 +++--- src/gui/symbol/point_editor.cpp | 22 +-- src/gui/symbol/select_editor.cpp | 19 +-- src/gui/symbol/window.cpp | 24 ++-- src/util/locale.hpp | 34 +++-- 10 files changed, 271 insertions(+), 145 deletions(-) diff --git a/data/en.mse-locale/locale b/data/en.mse-locale/locale index 79c70f30..97302823 100644 --- a/data/en.mse-locale/locale +++ b/data/en.mse-locale/locale @@ -50,11 +50,11 @@ menu: window: &Window new window: &New Window - cards window: &Cards F5 - set info window: &Set Information F6 - style window: St&yle F7 - keywords window: &Keywords F8 - stats window: S&tatistics F8 + cards tab: &Cards F5 + set info tab: &Set Information F6 + style tab: St&yle F7 + keywords tab: &Keywords F8 + stats tab: S&tatistics F8 help: &Help index: &Index... F1 @@ -81,6 +81,8 @@ menu: ############################################################## Menu help texts help: + welcome: Welcome to Magic Set Editor + file: new set: Create a new set open set: Open an existing set @@ -111,6 +113,7 @@ help: add cards: Add multiple cards to the set remove card: Delete the selected card from this set orientation: Orientation of the displayed card + rotate card: Rotate the card display 90° clockwise rotate 0: Display the card with the right side up rotate 270: Display the card rotated clockwise rotate 90: Display the card rotated counter-clockwise (anti-clockwise for the British) @@ -125,16 +128,11 @@ help: window: new window: Creates another window to edit the same set - cards window: Edit the cards in the set - set info window: Edit information about the set, its creator, etc. - style window: Change the style of cards - keywords window: Define extra keywords for this set - stats window: Show statistics about the cards in the set - cards tab: - set info tab: Set Information - style tab: Card Style - keywords tab: - stats tab: + cards tab: Edit the cards in the set + set info tab: Edit information about the set, its creator, etc. + style tab: Change the style of cards + keywords tab: Define extra keywords for this set + stats tab: Show statistics about the cards in the set help: index: @@ -148,8 +146,7 @@ help: (When off, the cards are exported and copied at 100% size and normal rotation) - # symbol editor - + # Symbol editor new symbol: Create a new symbol open symbol: Open a symbol save symbol: Save the symbol @@ -159,36 +156,52 @@ help: duplicate: Duplicates the selected shapes + grid: Show gridlines + snap: Snap shapes and points to gridlines + tool: select: Select and move shapes rotate: Rotate and shear shapes points: Edit control points for a shape in the symbol basic shapes: Draw basic shapes, such as rectangles and circles paint: Paint on the shape using a paintbrush + + select editor: + merge: Merges this shape with those below it + subtract: Subtracts this shape from shapes below it, leaves only the area in that shape that is not in this shape + intersect: Intersects this shape with shapes below it, leaves only the area in both shapes + overlap: Place this shape, and its border above shapes below it + border: Draws this shape as a border + + drag to shear: Drag to shear selected shape + drag to rotate: Drag to rotate selected %s, Ctrl constrains angle to multiples of 15 degrees + drag to resize: Drag to resize selected %s, Ctrl constrains size + click to select shape: Click to select shape, drag to move shape, double click to edit shape + + ellipse: Draw circles and ellipses + rectangle: Draw squares and rectangles + polygon: Draw triangles, pentagons and other regular polygons + star: Draw stars + sides: The number of sides of the polygon or points of the star + drag to draw shape: Drag to resize shape, Ctrl constrains shape, Shift centers shape + draw ellipse: Click and drag to draw a ellipse, hold Ctrl for a circle + draw rectangle: Click and drag to draw a rectangle, hold Ctrl for a square + draw polygon: Click and drag to draw a polygon + draw star: Click and drag to draw a star + + line segment: Makes the selected line segment straight + curve segment: Makes the selected line segment curved + free point: Allows the two control points of the point to be moved freely + smooth point: Makes the selected point smooth by placing the two control points opposite each other + symmetric point: Makes the selected point symetric + drag to move curve: Drag to move curve + drag to move line: Alt + drag to move curve; double click to add a point on this line + drag to move point: Click and drag to move control point; double click to remove the point ############################################################## Toolbar tool: - cards tab: Cards - set info tab: Set info - - new set: New set - open set: Open set - save set: Save set - - cut: Cut - copy: Copy - paste: Paste - undo: Undo%s - redo: Redo%s - - add card: Add card - remove card: Remove selected card - rotate card: Rotate card - - bold: Bold - italic: Italic - symbols: Symbols - reminder text: Reminder Text + undo: Undo + redo: Redo cards tab: Cards set info tab: Set info @@ -196,14 +209,96 @@ tool: keywords tab: Keywords stats tab: Statistics + # symbol editor + store symbol: Store + + grid: Grid + snap: Snap + + select: Select + rotate: Rotate + points: Points + basic shapes: Basic Shapes + paint: Paint + + merge: Merge + subtract: Subtract + intersect: Intersect + overlap: Overlap + border: Border + + ellipse: Ellipse + rectangle: Rectangle + polygon: Polygon + star: Star + + line segment: Line + curve segment: Curve + free point: Free + smooth point: Smooth + symmetric point: Symmetric + +############################################################## Toolbar help text +tooltip: + cards tab: + set info tab: Set information + style tab: + keywords tab: + stats tab: + + new set: New set + open set: Open set + save set: Save set + + cut: Cut + copy: Copy + paste: Paste + undo: Undo%s + redo: Redo%s + + add card: Add card + remove card: Remove selected card + rotate card: Rotate card + + bold: Bold + italic: Italic + symbols: Symbols + reminder text: Reminder Text + + cards tab: + set info tab: Set Information + style tab: Card Style + keywords tab: + stats tab: + # symbol editor store symbol: Store symbol in set + grid: Show grid + snap: Snap to grid + select: Select (F5) rotate: Rotate (F6) points: Points (F7) basic shapes: Basic Shapes (F8) paint: Paint on Shape (F9) + + merge: Merge with shapes below + subtract: Subtract from shapes below + intersect: Intersect with shapes below + overlap: Place above other shapes + border: Draw as a border + + ellipse: Circle / Ellipse + rectangle: Square / Rectangle + polygon: Polygon + star: Star + + line segment: To straigt line + curve segment: To curve + free point: Unlock point + smooth point: Make point smooth + symmetric point: Make point symmetric ############################################################## Labels in the GUI label: @@ -239,6 +334,9 @@ label: selection: Selection zoom: Zoom filter: Filter + + # Symbol editor + sides: sides ############################################################## Buttons/checkboxes/choices in the GUI button: @@ -359,7 +457,7 @@ error: checking updates failed: Checking updates failed. no updates: There are no available updates. -############################################################## Types used in scripts +############################################################## Types used in scripts / shape names type: function: function collection: collection @@ -370,6 +468,21 @@ type: boolean: boolean color: color nil: nothing + + # Symbol editor shapes + shape: shape + shapes: shapes + circle: circle + ellipse: ellipse + square: square + rectangle: rectangle + triangle: triangle + rhombus: rhombus + pentagon: pentagon + hexagon: hexagon + polygon: polygon + star: star + ############################################################## Magic game: diff --git a/src/data/locale.cpp b/src/data/locale.cpp index cc5dd32f..f4b155f5 100644 --- a/src/data/locale.cpp +++ b/src/data/locale.cpp @@ -25,16 +25,17 @@ LocaleP Locale::byName(const String& name) { IMPLEMENT_REFLECTION(Locale) { REFLECT_BASE(Packaged); - REFLECT_N("menu", translations[LOCALE_CAT_MENU]); - REFLECT_N("help", translations[LOCALE_CAT_HELP]); - REFLECT_N("tool", translations[LOCALE_CAT_TOOL]); - REFLECT_N("label", translations[LOCALE_CAT_LABEL]); - REFLECT_N("button", translations[LOCALE_CAT_BUTTON]); - REFLECT_N("title", translations[LOCALE_CAT_TITLE]); - REFLECT_N("action", translations[LOCALE_CAT_ACTION]); - REFLECT_N("error", translations[LOCALE_CAT_ERROR]); - REFLECT_N("type", translations[LOCALE_CAT_TYPE]); - REFLECT_N("game", game_translations); + REFLECT_N("menu", translations[LOCALE_CAT_MENU]); + REFLECT_N("help", translations[LOCALE_CAT_HELP]); + REFLECT_N("tool", translations[LOCALE_CAT_TOOL]); + REFLECT_N("tooltip", translations[LOCALE_CAT_TOOLTIP]); + REFLECT_N("label", translations[LOCALE_CAT_LABEL]); + REFLECT_N("button", translations[LOCALE_CAT_BUTTON]); + REFLECT_N("title", translations[LOCALE_CAT_TITLE]); + REFLECT_N("action", translations[LOCALE_CAT_ACTION]); + REFLECT_N("error", translations[LOCALE_CAT_ERROR]); + REFLECT_N("type", translations[LOCALE_CAT_TYPE]); + REFLECT_N("game", game_translations); REFLECT_N("stylesheet", stylesheet_translations); REFLECT_N("symbol font", symbol_font_translations); } diff --git a/src/gui/set/cards_panel.cpp b/src/gui/set/cards_panel.cpp index 68983d6c..689464e9 100644 --- a/src/gui/set/cards_panel.cpp +++ b/src/gui/set/cards_panel.cpp @@ -111,15 +111,15 @@ void CardsPanel::onChangeSet() { void CardsPanel::initUI(wxToolBar* tb, wxMenuBar* mb) { // Toolbar - tb->AddTool(ID_FORMAT_BOLD, _(""), load_resource_tool_image(_("bold")), wxNullBitmap, wxITEM_CHECK, _TOOL_("bold")); - tb->AddTool(ID_FORMAT_ITALIC, _(""), load_resource_tool_image(_("italic")), wxNullBitmap, wxITEM_CHECK, _TOOL_("italic")); - tb->AddTool(ID_FORMAT_SYMBOL, _(""), load_resource_tool_image(_("symbol")), wxNullBitmap, wxITEM_CHECK, _TOOL_("symbols")); - tb->AddTool(ID_FORMAT_REMINDER, _(""), load_resource_tool_image(_("reminder")), wxNullBitmap, wxITEM_CHECK, _TOOL_("reminder text")); + tb->AddTool(ID_FORMAT_BOLD, _(""), load_resource_tool_image(_("bold")), wxNullBitmap, wxITEM_CHECK, _TOOLTIP_("bold"), _HELP_("bold")); + tb->AddTool(ID_FORMAT_ITALIC, _(""), load_resource_tool_image(_("italic")), wxNullBitmap, wxITEM_CHECK, _TOOLTIP_("italic"), _HELP_("italic")); + tb->AddTool(ID_FORMAT_SYMBOL, _(""), load_resource_tool_image(_("symbol")), wxNullBitmap, wxITEM_CHECK, _TOOLTIP_("symbols"), _HELP_("symbols")); + tb->AddTool(ID_FORMAT_REMINDER, _(""), load_resource_tool_image(_("reminder")), wxNullBitmap, wxITEM_CHECK, _TOOLTIP_("reminder text"), _HELP_("reminder text")); tb->AddSeparator(); - tb->AddTool(ID_CARD_ADD, _(""), load_resource_tool_image(_("card_add")), wxNullBitmap, wxITEM_NORMAL,_TOOL_("add card")); - tb->AddTool(ID_CARD_REMOVE, _(""), load_resource_tool_image(_("card_del")), wxNullBitmap, wxITEM_NORMAL,_TOOL_("remove card")); + tb->AddTool(ID_CARD_ADD, _(""), load_resource_tool_image(_("card_add")), wxNullBitmap, wxITEM_NORMAL,_TOOLTIP_("add card"), _HELP_("add card")); + tb->AddTool(ID_CARD_REMOVE, _(""), load_resource_tool_image(_("card_del")), wxNullBitmap, wxITEM_NORMAL,_TOOLTIP_("remove card"), _HELP_("remove card")); tb->AddSeparator(); - tb->AddTool(ID_CARD_ROTATE, _(""), load_resource_tool_image(_("card_rotate")), wxNullBitmap,wxITEM_NORMAL, _TOOL_("rotate card")); + tb->AddTool(ID_CARD_ROTATE, _(""), load_resource_tool_image(_("card_rotate")), wxNullBitmap,wxITEM_NORMAL, _TOOLTIP_("rotate card"), _HELP_("rotate card")); tb->Realize(); // Menus mb->Insert(2, menuCard, _MENU_("cards")); diff --git a/src/gui/set/set_info_panel.cpp b/src/gui/set/set_info_panel.cpp index 11ab0db4..d6743005 100644 --- a/src/gui/set/set_info_panel.cpp +++ b/src/gui/set/set_info_panel.cpp @@ -34,9 +34,9 @@ void SetInfoPanel::onChangeSet() { void SetInfoPanel::initUI(wxToolBar* tb, wxMenuBar* mb) { // Toolbar - tb->AddTool(ID_FORMAT_BOLD, _(""), load_resource_tool_image(_("bold")), wxNullBitmap, wxITEM_CHECK, _TOOL_("bold")); - tb->AddTool(ID_FORMAT_ITALIC, _(""), load_resource_tool_image(_("italic")), wxNullBitmap, wxITEM_CHECK, _TOOL_("italic")); - tb->AddTool(ID_FORMAT_SYMBOL, _(""), load_resource_tool_image(_("symbol")), wxNullBitmap, wxITEM_CHECK, _TOOL_("symbols")); + tb->AddTool(ID_FORMAT_BOLD, _(""), load_resource_tool_image(_("bold")), wxNullBitmap, wxITEM_CHECK, _TOOLTIP_("bold"), _HELP_("bold")); + tb->AddTool(ID_FORMAT_ITALIC, _(""), load_resource_tool_image(_("italic")), wxNullBitmap, wxITEM_CHECK, _TOOLTIP_("italic"), _HELP_("italic")); + tb->AddTool(ID_FORMAT_SYMBOL, _(""), load_resource_tool_image(_("symbol")), wxNullBitmap, wxITEM_CHECK, _TOOLTIP_("symbols"), _HELP_("symbols")); tb->Realize(); // Menus IconMenu* menuFormat = new IconMenu(); diff --git a/src/gui/set/window.cpp b/src/gui/set/window.cpp index 203ff340..d6f75b58 100644 --- a/src/gui/set/window.cpp +++ b/src/gui/set/window.cpp @@ -101,21 +101,21 @@ SetWindow::SetWindow(Window* parent, const SetP& set) // status bar CreateStatusBar(); - SetStatusText(_("Welcome to Magic Set Editor")); + SetStatusText(_HELP_("welcome")); // tool bar wxToolBar* tb = CreateToolBar(wxTB_FLAT | wxNO_BORDER | wxTB_HORIZONTAL); tb->SetToolBitmapSize(wxSize(18,18)); - tb->AddTool(ID_FILE_NEW, _(""), load_resource_tool_image(_("new")), wxNullBitmap, wxITEM_NORMAL, _TOOL_("new set"), _HELP_("new set")); - tb->AddTool(ID_FILE_OPEN, _(""), load_resource_tool_image(_("open")), wxNullBitmap, wxITEM_NORMAL, _TOOL_("open set"), _HELP_("open set")); - tb->AddTool(ID_FILE_SAVE, _(""), load_resource_tool_image(_("save")), wxNullBitmap, wxITEM_NORMAL, _TOOL_("save set"), _HELP_("save set")); + tb->AddTool(ID_FILE_NEW, _(""), load_resource_tool_image(_("new")), wxNullBitmap, wxITEM_NORMAL, _TOOLTIP_("new set"), _HELP_("new set")); + tb->AddTool(ID_FILE_OPEN, _(""), load_resource_tool_image(_("open")), wxNullBitmap, wxITEM_NORMAL, _TOOLTIP_("open set"), _HELP_("open set")); + tb->AddTool(ID_FILE_SAVE, _(""), load_resource_tool_image(_("save")), wxNullBitmap, wxITEM_NORMAL, _TOOLTIP_("save set"), _HELP_("save set")); tb->AddSeparator(); - tb->AddTool(ID_EDIT_CUT, _(""), load_resource_tool_image(_("cut")), wxNullBitmap, wxITEM_NORMAL, _TOOL_("cut"), _HELP_("cut")); - tb->AddTool(ID_EDIT_COPY, _(""), load_resource_tool_image(_("copy")), wxNullBitmap, wxITEM_NORMAL, _TOOL_("copy"), _HELP_("copy")); - tb->AddTool(ID_EDIT_PASTE, _(""), load_resource_tool_image(_("paste")), wxNullBitmap, wxITEM_NORMAL, _TOOL_("paste"), _HELP_("paste")); + tb->AddTool(ID_EDIT_CUT, _(""), load_resource_tool_image(_("cut")), wxNullBitmap, wxITEM_NORMAL, _TOOLTIP_("cut"), _HELP_("cut")); + tb->AddTool(ID_EDIT_COPY, _(""), load_resource_tool_image(_("copy")), wxNullBitmap, wxITEM_NORMAL, _TOOLTIP_("copy"), _HELP_("copy")); + tb->AddTool(ID_EDIT_PASTE, _(""), load_resource_tool_image(_("paste")), wxNullBitmap, wxITEM_NORMAL, _TOOLTIP_("paste"), _HELP_("paste")); tb->AddSeparator(); - tb->AddTool(ID_EDIT_UNDO, _(""), load_resource_tool_image(_("undo")), wxNullBitmap, wxITEM_NORMAL, _TOOL_1_("undo",wxEmptyString)); - tb->AddTool(ID_EDIT_REDO, _(""), load_resource_tool_image(_("redo")), wxNullBitmap, wxITEM_NORMAL, _TOOL_1_("redo",wxEmptyString)); + tb->AddTool(ID_EDIT_UNDO, _(""), load_resource_tool_image(_("undo")), wxNullBitmap, wxITEM_NORMAL, _TOOLTIP_1_("undo",wxEmptyString)); + tb->AddTool(ID_EDIT_REDO, _(""), load_resource_tool_image(_("redo")), wxNullBitmap, wxITEM_NORMAL, _TOOLTIP_1_("redo",wxEmptyString)); tb->AddSeparator(); tb->Realize(); @@ -129,11 +129,11 @@ SetWindow::SetWindow(Window* parent, const SetP& set) // NOTE: place the CardsPanel last in the panels list, // this way the card list is the last to be told of a set change // this way everyone else already uses the new set when it sends a CardSelectEvent - addPanel(menuWindow, tabBar, new CardsPanel (this, wxID_ANY), 4, _("cards")); - addPanel(menuWindow, tabBar, new SetInfoPanel (this, wxID_ANY), 0, _("set info")); - addPanel(menuWindow, tabBar, new StylePanel (this, wxID_ANY), 1, _("style")); - addPanel(menuWindow, tabBar, new KeywordsPanel(this, wxID_ANY), 2, _("keywords")); - addPanel(menuWindow, tabBar, new StatsPanel (this, wxID_ANY), 3, _("stats")); + addPanel(menuWindow, tabBar, new CardsPanel (this, wxID_ANY), 4, _("cards tab")); + addPanel(menuWindow, tabBar, new SetInfoPanel (this, wxID_ANY), 0, _("set info tab")); + addPanel(menuWindow, tabBar, new StylePanel (this, wxID_ANY), 1, _("style tab")); + addPanel(menuWindow, tabBar, new KeywordsPanel(this, wxID_ANY), 2, _("keywords tab")); + addPanel(menuWindow, tabBar, new StatsPanel (this, wxID_ANY), 3, _("stats tab")); // addPanel(*s, *menuWindow, *tabBar, new DraftPanel (&this, wxID_ANY), 4, _("F10")) selectPanel(ID_WINDOW_CARDS); // select cards panel @@ -179,10 +179,10 @@ void SetWindow::addPanel(wxMenu* windowMenu, wxToolBar* tabBar, SetWindowPanel* if (panels.size() <= pos) panels.resize(pos + 1); panels[pos] = panel; // names - String menu_name = tr(LOCALE_CAT_MENU, name + _(" window")); - String description = tr(LOCALE_CAT_HELP, name + _(" window")); - String tab_name = tr(LOCALE_CAT_TOOL, name + _(" tab")); - String tab_help = tr(LOCALE_CAT_HELP, name + _(" tab")); + String menu_name = tr(LOCALE_CAT_MENU, name); + String description = tr(LOCALE_CAT_HELP, name); + String tab_name = tr(LOCALE_CAT_TOOL, name); + String tab_help = tr(LOCALE_CAT_TOOLTIP, name); // add to tab bar int id = ID_WINDOW_MIN + pos; tabBar->AddTool(id, tab_name, wxNullBitmap, wxNullBitmap, wxITEM_CHECK, tab_help, description); @@ -338,13 +338,13 @@ void SetWindow::onUpdateUI(wxUpdateUIEvent& ev) { ev.Enable(set->actions.canUndo()); String label = set->actions.undoName(); ev.SetText(_MENU_1_("undo", label)); - GetToolBar()->SetToolShortHelp(ID_EDIT_UNDO, _TOOL_1_("undo", label)); + GetToolBar()->SetToolShortHelp(ID_EDIT_UNDO, _TOOLTIP_1_("undo", label)); break; } case ID_EDIT_REDO: { ev.Enable(set->actions.canRedo()); String label = set->actions.redoName(); ev.SetText(_MENU_1_("redo", label)); - GetToolBar()->SetToolShortHelp(ID_EDIT_REDO, _TOOL_1_("redo", label)); + GetToolBar()->SetToolShortHelp(ID_EDIT_REDO, _TOOLTIP_1_("redo", label)); break; } // copy & paste & find diff --git a/src/gui/symbol/basic_shape_editor.cpp b/src/gui/symbol/basic_shape_editor.cpp index 95947350..dc60f228 100644 --- a/src/gui/symbol/basic_shape_editor.cpp +++ b/src/gui/symbol/basic_shape_editor.cpp @@ -35,13 +35,14 @@ void SymbolBasicShapeEditor::draw(DC& dc) { void SymbolBasicShapeEditor::initUI(wxToolBar* tb, wxMenuBar* mb) { sides = new wxSpinCtrl( tb, ID_SIDES, _("3"), wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 3, 50, 3); - sidesL = new wxStaticText(tb, ID_SIDES, _(" sides: ")); + sidesL = new wxStaticText(tb, ID_SIDES, _(" ") + _LABEL_("sides") + _(": ")); + sides->SetHelpText(_HELP_("sides")); sides->SetSize(50, -1); tb->AddSeparator(); - tb->AddTool(ID_SHAPE_CIRCLE, _("Ellipse"), load_resource_tool_image(_("circle")), wxNullBitmap, wxITEM_CHECK, _("Circle / Ellipse"), _("Draw circles and ellipses")); - tb->AddTool(ID_SHAPE_RECTANGLE, _("Rectangle"), load_resource_tool_image(_("rectangle")), wxNullBitmap, wxITEM_CHECK, _("Square / Rectangle"), _("Draw squares and rectangles")); - tb->AddTool(ID_SHAPE_POLYGON, _("Polygon"), load_resource_tool_image(_("triangle")), wxNullBitmap, wxITEM_CHECK, _("Polygon"), _("Draw triangles, pentagons and other regular polygons")); - tb->AddTool(ID_SHAPE_STAR, _("Star"), load_resource_tool_image(_("star")), wxNullBitmap, wxITEM_CHECK, _("Star"), _("Draw stars")); + tb->AddTool(ID_SHAPE_CIRCLE, _TOOL_("ellipse"), load_resource_tool_image(_("circle")), wxNullBitmap, wxITEM_CHECK, _TOOLTIP_("ellipse"), _HELP_("ellipse")); + tb->AddTool(ID_SHAPE_RECTANGLE, _TOOL_("rectangle"), load_resource_tool_image(_("rectangle")), wxNullBitmap, wxITEM_CHECK, _TOOLTIP_("rectangle"), _HELP_("rectangle")); + tb->AddTool(ID_SHAPE_POLYGON, _TOOL_("polygon"), load_resource_tool_image(_("triangle")), wxNullBitmap, wxITEM_CHECK, _TOOLTIP_("polygon"), _HELP_("polygon")); + tb->AddTool(ID_SHAPE_STAR, _TOOL_("star"), load_resource_tool_image(_("star")), wxNullBitmap, wxITEM_CHECK, _TOOLTIP_("star"), _HELP_("star")); tb->AddControl(sidesL); tb->AddControl(sides); tb->Realize(); @@ -90,7 +91,7 @@ void SymbolBasicShapeEditor::onLeftDown (const Vector2D& pos, wxMouseEvent& ev // Start drawing drawing = true; start = end = pos; - SetStatusText(_("Drag to resize shape, Ctrl constrains shape, Shift centers shape")); + SetStatusText(_HELP_("drag to draw shape")); } void SymbolBasicShapeEditor::onLeftUp (const Vector2D& pos, wxMouseEvent& ev) { @@ -138,16 +139,16 @@ void SymbolBasicShapeEditor::stopActions() { drawing = false; switch (mode) { case ID_SHAPE_CIRCLE: - SetStatusText(_("Click and drag to draw a ellipse, hold Ctrl for a circle")); + SetStatusText(_HELP_("draw ellipse")); break; case ID_SHAPE_RECTANGLE: - SetStatusText(_("Click and drag to draw a rectangle, hold Ctrl for a square")); + SetStatusText(_HELP_("draw rectangle")); break; case ID_SHAPE_POLYGON: - SetStatusText(_("Click and drag to draw a polygon")); + SetStatusText(_HELP_("draw polygon")); break; case ID_SHAPE_STAR: - SetStatusText(_("Click and drag to draw a star")); + SetStatusText(_HELP_("draw star")); break; } control.Refresh(false); @@ -183,9 +184,9 @@ void SymbolBasicShapeEditor::makeCenteredShape(const Vector2D& c, Vector2D r, bo case ID_SHAPE_CIRCLE: { // A circle / ellipse if (constrained) { - shape->name = _("Circle"); + shape->name = capitalize(_TYPE_("circle")); } else { - shape->name = _("Ellipse"); + shape->name = capitalize(_TYPE_("ellipse")); } // a circle has 4 control points, the first is: (x+r, y) db(0, kr) da(0, -kr) // kr is a magic constant @@ -198,9 +199,9 @@ void SymbolBasicShapeEditor::makeCenteredShape(const Vector2D& c, Vector2D r, bo } case ID_SHAPE_RECTANGLE: { // A rectangle / square if (constrained) { - shape->name = _("Square"); + shape->name = capitalize(_TYPE_("square")); } else { - shape->name = _("Rectangle"); + shape->name = capitalize(_TYPE_("rectangle")); } // a rectangle just has four corners shape->points.push_back(new_shared2(c.x - r.x, c.y - r.y)); @@ -211,12 +212,16 @@ void SymbolBasicShapeEditor::makeCenteredShape(const Vector2D& c, Vector2D r, bo } default: { // A polygon or star int n = sides->GetValue(); // number of sides - switch (n) { - case 3: shape->name = _("Triangle"); - case 4: shape->name = _("Rhombus"); - case 5: shape->name = _("Pentagon"); - case 6: shape->name = _("Hexagon"); - default: shape->name = _("Polygon"); + if (mode == ID_SHAPE_POLYGON) { + switch (n) { + case 3: shape->name = capitalize(_TYPE_("triangle")); + case 4: shape->name = capitalize(_TYPE_("rhombus")); + case 5: shape->name = capitalize(_TYPE_("pentagon")); + case 6: shape->name = capitalize(_TYPE_("hexagon")); + default: shape->name = capitalize(_TYPE_("polygon")); + } + } else { // star + shape->name = capitalize(_TYPE_("star")); } // Example: n == 7 // a a..g = corners diff --git a/src/gui/symbol/point_editor.cpp b/src/gui/symbol/point_editor.cpp index ce8a9049..3e78068f 100644 --- a/src/gui/symbol/point_editor.cpp +++ b/src/gui/symbol/point_editor.cpp @@ -155,12 +155,12 @@ wxPen SymbolPointEditor::handlePen(WhichPen p, LockMode lock) { void SymbolPointEditor::initUI(wxToolBar* tb, wxMenuBar* mb) { // Initialize toolbar tb->AddSeparator(); - tb->AddTool(ID_SEGMENT_LINE, _("Line"), load_resource_tool_image(_("line")), wxNullBitmap, wxITEM_CHECK, _("To straigt line"), _("Makes the selected line straight")); - tb->AddTool(ID_SEGMENT_CURVE, _("Curve"), load_resource_tool_image(_("curve")), wxNullBitmap, wxITEM_CHECK, _("To curve"), _("Makes the selected line curved")); - tb->AddSeparator(); - tb->AddTool(ID_LOCK_FREE, _("Free"), load_resource_tool_image(_("lock_free")), wxNullBitmap, wxITEM_CHECK, _("Unlock node"), _("Allows the two control points on the node to be moved freely")); - tb->AddTool(ID_LOCK_DIR, _("Smooth"), load_resource_tool_image(_("lock_dir")), wxNullBitmap, wxITEM_CHECK, _("Make node smooth"), _("Makes the selected node smooth by placing the two control points opposite each other")); - tb->AddTool(ID_LOCK_SIZE, _("Symmetric"), load_resource_tool_image(_("lock_size")), wxNullBitmap, wxITEM_CHECK, _("Make node symmetric"), _("Makes the selected node symetric")); + tb->AddTool(ID_SEGMENT_LINE, _TOOL_("line segment"), load_resource_tool_image(_("line")), wxNullBitmap, wxITEM_CHECK, _TOOLTIP_("line segment"), _HELP_("line segment")); + tb->AddTool(ID_SEGMENT_CURVE, _TOOL_("curve segment"), load_resource_tool_image(_("curve")), wxNullBitmap, wxITEM_CHECK, _TOOLTIP_("curve segment"), _HELP_("curve segment")); + tb->AddSeparator(); + tb->AddTool(ID_LOCK_FREE, _TOOL_("free point"), load_resource_tool_image(_("lock_free")), wxNullBitmap, wxITEM_CHECK, _TOOLTIP_("free point"), _HELP_("free point")); + tb->AddTool(ID_LOCK_DIR, _TOOL_("smooth point"), load_resource_tool_image(_("lock_dir")), wxNullBitmap, wxITEM_CHECK, _TOOLTIP_("smooth point"), _HELP_("smooth point")); + tb->AddTool(ID_LOCK_SIZE, _TOOL_("symmetric point"), load_resource_tool_image(_("lock_size")), wxNullBitmap, wxITEM_CHECK, _TOOLTIP_("symmetric point"), _HELP_("symmetric point")); tb->Realize(); // TODO : menu bar //mb->Insert(2, curveMenu, _("&Curve")) @@ -325,11 +325,11 @@ void SymbolPointEditor::onKeyChange(wxKeyEvent& ev) { if (ev.AltDown()) { hovering = SELECTED_LINE; control.SetCursor(pointCurve); - SetStatusText(_("Drag to move curve")); + SetStatusText(_HELP_("drag to move curve")); } else { hovering = SELECTED_NEW_POINT; control.SetCursor(pointAdd); - SetStatusText(_("Alt + drag to move curve; double click to add control point on this line")); + SetStatusText(_HELP_("drag to move line")); } control.Refresh(false); } else if (ev.GetKeyCode() == WXK_CONTROL || ev.GetKeyCode() == WXK_SHIFT) { @@ -469,18 +469,18 @@ void SymbolPointEditor::findHoveredItem(const Vector2D& pos, bool altDown) { if (hover_handle.handle) { hovering = SELECTED_HANDLE; control.SetCursor(pointMove); - SetStatusText(_("Click and drag to move control point")); + SetStatusText(_HELP_("drag to move point")); } else { // Not on a point or handle, maybe the cursor is on a curve if (checkPosOnCurve(pos)) { if (altDown) { hovering = SELECTED_LINE; control.SetCursor(pointCurve); - SetStatusText(_("Drag to move curve")); + SetStatusText(_HELP_("drag to move curve")); } else { hovering = SELECTED_NEW_POINT; control.SetCursor(pointAdd); - SetStatusText(_("Alt + drag to move curve; double click to add control point on this line")); + SetStatusText(_HELP_("drag to move line")); } } else { hovering = SELECTED_NONE; diff --git a/src/gui/symbol/select_editor.cpp b/src/gui/symbol/select_editor.cpp index 8b5c742f..78ad9733 100644 --- a/src/gui/symbol/select_editor.cpp +++ b/src/gui/symbol/select_editor.cpp @@ -108,12 +108,12 @@ void SymbolSelectEditor::drawRotationCenter(DC& dc, const Vector2D& pos) { void SymbolSelectEditor::initUI(wxToolBar* tb, wxMenuBar* mb) { tb->AddSeparator(); - tb->AddTool(ID_PART_MERGE, _("Merge"), load_resource_image(_("combine_or")), wxNullBitmap, wxITEM_CHECK, _("Merge with shapes below"), _("Merges this shape with those below it")); - tb->AddTool(ID_PART_SUBTRACT, _("Subtract"), load_resource_image(_("combine_sub_dark")), wxNullBitmap, wxITEM_CHECK, _("Subtract from shapes below"), _("Subtracts this shape from shapes below it, leaves only the area in that shape that is not in this shape")); - tb->AddTool(ID_PART_INTERSECTION, _("Intersect"), load_resource_image(_("combine_and_dark")), wxNullBitmap, wxITEM_CHECK, _("Intersect with shapes below"), _("Intersects this shape with shapes below it, leaves only the area in both shapes")); + tb->AddTool(ID_PART_MERGE, _TOOL_("merge"), load_resource_image(_("combine_or")), wxNullBitmap, wxITEM_CHECK, _TOOLTIP_("merge"), _HELP_("merge")); + tb->AddTool(ID_PART_SUBTRACT, _TOOL_("subtract"), load_resource_image(_("combine_sub_dark")), wxNullBitmap, wxITEM_CHECK, _TOOLTIP_("subtract"), _HELP_("subtract")); + tb->AddTool(ID_PART_INTERSECTION, _TOOL_("intersect"),load_resource_image(_("combine_and_dark")), wxNullBitmap, wxITEM_CHECK, _TOOLTIP_("intersect"), _HELP_("intersect")); // note: difference doesn't work (yet) - tb->AddTool(ID_PART_OVERLAP, _("Overlap"), load_resource_image(_("combine_over")), wxNullBitmap, wxITEM_CHECK, _("Place above other shapes"), _("Place this shape, and its border above shapes below it")); - tb->AddTool(ID_PART_BORDER, _("Border"), load_resource_image(_("combine_border")), wxNullBitmap, wxITEM_CHECK, _("Draw as a border"), _("Draws this shape as a border")); + tb->AddTool(ID_PART_OVERLAP, _TOOL_("overlap"), load_resource_image(_("combine_over")), wxNullBitmap, wxITEM_CHECK, _TOOLTIP_("overlap"), _HELP_("overlap")); + tb->AddTool(ID_PART_BORDER, _TOOL_("border"), load_resource_image(_("combine_border")), wxNullBitmap, wxITEM_CHECK, _TOOLTIP_("border"), _HELP_("border")); tb->Realize(); } void SymbolSelectEditor::destroyUI(wxToolBar* tb, wxMenuBar* mb) { @@ -247,17 +247,18 @@ void SymbolSelectEditor::onMouseMove (const Vector2D& from, const Vector2D& to, if (!control.selected_parts.empty() && onAnyHandle(to, &dx, &dy)) { // we are on a handle, don't highlight highlightPart = SymbolPartP(); + String shapes = control.selected_parts.size() > 1 ? _TYPE_("shapes") : _TYPE_("shape"); if (rotate) { // shear or rotating? if (dx == 0 || dy == 0) { - SetStatusText(String(_("Drag to shear selected shape")) + (control.selected_parts.size() > 1 ? _("s") : _(""))); + SetStatusText(_HELP_1_("drag to shear", shapes)); control.SetCursor(dx == 0 ? cursorShearX : cursorShearY); } else { - SetStatusText(String(_("Drag to rotate selected shape")) + (control.selected_parts.size() > 1 ? _("s") : _("")) + _(", Ctrl constrains angle to multiples of 15 degrees")); + SetStatusText(_HELP_1_("drag to rotate", shapes)); control.SetCursor(cursorRotate); } } else { - SetStatusText(String(_("Drag to resize selected shape")) + (control.selected_parts.size() > 1 ? _("s") : _("")) + _(", Ctrl constrains size")); + SetStatusText(_HELP_1_("drag to resize", shapes)); // what cursor to use? if (dx == dy) control.SetCursor(wxCURSOR_SIZENWSE); else if (dx == -dy) control.SetCursor(wxCURSOR_SIZENESW); @@ -266,7 +267,7 @@ void SymbolSelectEditor::onMouseMove (const Vector2D& from, const Vector2D& to, } } else { if (highlightPart) { - SetStatusText(_("Click to select shape, drag to move shape, double click to edit shape")); + SetStatusText(_HELP_("click to select shape")); } else { SetStatusText(_("")); } diff --git a/src/gui/symbol/window.cpp b/src/gui/symbol/window.cpp index 68202046..2634b7b0 100644 --- a/src/gui/symbol/window.cpp +++ b/src/gui/symbol/window.cpp @@ -92,26 +92,26 @@ void SymbolWindow::init(Window* parent, SymbolP symbol) { // Toolbar wxToolBar* tb = CreateToolBar(wxTB_FLAT | wxNO_BORDER | wxTB_HORIZONTAL | wxTB_TEXT); - tb->AddTool(ID_FILE_STORE, _("Store"), load_resource_tool_image(_("apply")), wxNullBitmap, wxITEM_NORMAL, _TOOL_("store symbol"), _HELP_("store symbol")); + tb->AddTool(ID_FILE_STORE, _TOOL_("store symbol"), load_resource_tool_image(_("apply")), wxNullBitmap, wxITEM_NORMAL, _TOOLTIP_("store symbol"), _HELP_("store symbol")); tb->AddSeparator(); - tb->AddTool(ID_EDIT_UNDO, _("Undo"), load_resource_tool_image(_("undo")), wxNullBitmap, wxITEM_NORMAL, _TOOL_1_("undo",wxEmptyString)); - tb->AddTool(ID_EDIT_REDO, _("Redo"), load_resource_tool_image(_("redo")), wxNullBitmap, wxITEM_NORMAL, _TOOL_1_("redo",wxEmptyString)); + tb->AddTool(ID_EDIT_UNDO, _TOOL_("undo"), load_resource_tool_image(_("undo")), wxNullBitmap, wxITEM_NORMAL, _TOOLTIP_1_("undo",wxEmptyString)); + tb->AddTool(ID_EDIT_REDO, _TOOL_("redo"), load_resource_tool_image(_("redo")), wxNullBitmap, wxITEM_NORMAL, _TOOLTIP_1_("redo",wxEmptyString)); tb->AddSeparator(); - tb->AddTool(ID_VIEW_GRID, _("Grid"), load_resource_tool_image(_("grid")), wxNullBitmap, wxITEM_CHECK, _TOOL_("grid")); - tb->AddTool(ID_VIEW_GRID_SNAP,_("Snap"), load_resource_tool_image(_("grid_snap")), wxNullBitmap, wxITEM_CHECK, _TOOL_("snap")); + tb->AddTool(ID_VIEW_GRID, _TOOL_("grid"), load_resource_tool_image(_("grid")), wxNullBitmap, wxITEM_CHECK, _TOOLTIP_("grid"), _HELP_("grid")); + tb->AddTool(ID_VIEW_GRID_SNAP, _TOOL_("snap"), load_resource_tool_image(_("grid_snap")), wxNullBitmap, wxITEM_CHECK, _TOOLTIP_("snap"), _HELP_("snap")); tb->Realize(); // Edit mode toolbar wxPanel* emp = new wxPanel(this, wxID_ANY); wxToolBar* em = new wxToolBar(emp, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTB_FLAT | wxTB_VERTICAL | wxTB_TEXT | wxTB_HORZ_LAYOUT); - em->AddTool(ID_MODE_SELECT,_("Select"), load_resource_tool_image(_("mode_select")), wxNullBitmap, wxITEM_CHECK, _TOOL_("select"), _HELP_("select")); - em->AddTool(ID_MODE_ROTATE,_("Rotate"), load_resource_tool_image(_("mode_rotate")), wxNullBitmap, wxITEM_CHECK, _TOOL_("rotate"), _HELP_("rotate")); + em->AddTool(ID_MODE_SELECT, _TOOL_("select"), load_resource_tool_image(_("mode_select")), wxNullBitmap, wxITEM_CHECK, _TOOLTIP_("select"), _HELP_("select")); + em->AddTool(ID_MODE_ROTATE, _TOOL_("rotate"), load_resource_tool_image(_("mode_rotate")), wxNullBitmap, wxITEM_CHECK, _TOOLTIP_("rotate"), _HELP_("rotate")); em->AddSeparator(); - em->AddTool(ID_MODE_POINTS,_("Points"), load_resource_tool_image(_("mode_curve")), wxNullBitmap, wxITEM_CHECK, _TOOL_("points"), _HELP_("points")); + em->AddTool(ID_MODE_POINTS, _TOOL_("points"), load_resource_tool_image(_("mode_curve")), wxNullBitmap, wxITEM_CHECK, _TOOLTIP_("points"), _HELP_("points")); em->AddSeparator(); - em->AddTool(ID_MODE_SHAPES,_("Basic Shapes"), load_resource_tool_image(_("circle")), wxNullBitmap, wxITEM_CHECK, _TOOL_("basic shapes"), _HELP_("basic shapes")); + em->AddTool(ID_MODE_SHAPES, _TOOL_("basic shapes"), load_resource_tool_image(_("circle")), wxNullBitmap, wxITEM_CHECK, _TOOLTIP_("basic shapes"), _HELP_("basic shapes")); em->AddSeparator(); - em->AddTool(ID_MODE_PAINT, _("Paint"), load_resource_tool_image(_("mode_paint")), wxNullBitmap, wxITEM_CHECK, _TOOL_("paint"), _HELP_("paint")); + em->AddTool(ID_MODE_PAINT, _TOOL_("paint"), load_resource_tool_image(_("mode_paint")), wxNullBitmap, wxITEM_CHECK, _TOOLTIP_("paint"), _HELP_("paint")); em->AddSeparator(); em->Realize(); @@ -228,13 +228,13 @@ void SymbolWindow::onUpdateUI(wxUpdateUIEvent& ev) { ev.Enable(control->getSymbol()->actions.canUndo()); String label = control->getSymbol()->actions.undoName(); ev.SetText(_MENU_1_("undo", label)); - GetToolBar()->SetToolShortHelp(ID_EDIT_UNDO, _TOOL_1_("undo", label)); + GetToolBar()->SetToolShortHelp(ID_EDIT_UNDO, _TOOLTIP_1_("undo", label)); break; } case ID_EDIT_REDO: { ev.Enable(control->getSymbol()->actions.canRedo()); String label = control->getSymbol()->actions.redoName(); ev.SetText(_MENU_1_("redo", label)); - GetToolBar()->SetToolShortHelp(ID_EDIT_REDO, _TOOL_1_("redo", label)); + GetToolBar()->SetToolShortHelp(ID_EDIT_REDO, _TOOLTIP_1_("redo", label)); break; } default: { // items created by the editor control diff --git a/src/util/locale.hpp b/src/util/locale.hpp index 64ddd07a..8ad8fc07 100644 --- a/src/util/locale.hpp +++ b/src/util/locale.hpp @@ -29,6 +29,7 @@ enum LocaleCategory { LOCALE_CAT_MENU , LOCALE_CAT_HELP , LOCALE_CAT_TOOL +, LOCALE_CAT_TOOLTIP , LOCALE_CAT_LABEL , LOCALE_CAT_BUTTON , LOCALE_CAT_TITLE @@ -60,36 +61,41 @@ String tr(const SymbolFont&, const String& key, const String& def); /// A localized string for menus/toolbar buttons -#define _MENU_(s) tr(LOCALE_CAT_MENU, _(s)) +#define _MENU_(s) tr(LOCALE_CAT_MENU, _(s)) /// A localized string for help/statusbar text -#define _HELP_(s) tr(LOCALE_CAT_HELP, _(s)) +#define _HELP_(s) tr(LOCALE_CAT_HELP, _(s)) +/// A localized string for the text of toolbar buttons +#define _TOOL_(s) tr(LOCALE_CAT_TOOL, _(s)) /// A localized string for tooltip text for toolbar buttons -#define _TOOL_(s) tr(LOCALE_CAT_TOOL, _(s)) +#define _TOOLTIP_(s) tr(LOCALE_CAT_TOOLTIP, _(s)) /// A localized string for labels -#define _LABEL_(s) tr(LOCALE_CAT_LABEL, _(s)) +#define _LABEL_(s) tr(LOCALE_CAT_LABEL, _(s)) /// A localized string for buttons/checkboxes/etc. -#define _BUTTON_(s) tr(LOCALE_CAT_BUTTON,_(s)) +#define _BUTTON_(s) tr(LOCALE_CAT_BUTTON, _(s)) /// A localized string for window titles -#define _TITLE_(s) tr(LOCALE_CAT_TITLE, _(s)) +#define _TITLE_(s) tr(LOCALE_CAT_TITLE, _(s)) /// A localized string for type names in scripts -#define _TYPE_(s) tr(LOCALE_CAT_TYPE, _(s)) +#define _TYPE_(s) tr(LOCALE_CAT_TYPE, _(s)) /// A localized string for action names -#define _ACTION_(s) tr(LOCALE_CAT_ACTION, _(s)) +#define _ACTION_(s) tr(LOCALE_CAT_ACTION, _(s)) /// A localized string for error messages -#define _ERROR_(s) tr(LOCALE_CAT_ERROR, _(s)) +#define _ERROR_(s) tr(LOCALE_CAT_ERROR, _(s)) /// A localized string for menus/toolbar buttons, with 1 argument (printf style) -#define _MENU_1_(s,a) format_string(tr(LOCALE_CAT_MENU, _(s)), a) +#define _MENU_1_(s,a) format_string(tr(LOCALE_CAT_MENU, _(s)), a) /// A localized string for tooltip text, with 1 argument (printf style) -#define _TOOL_1_(s,a) format_string(tr(LOCALE_CAT_TOOL, _(s)), a) +#define _HELP_1_(s,a) format_string(tr(LOCALE_CAT_HELP, _(s)), a) + +/// A localized string for tooltip text, with 1 argument (printf style) +#define _TOOLTIP_1_(s,a) format_string(tr(LOCALE_CAT_TOOLTIP, _(s)), a) /// A localized string for error messages, with 1 argument (printf style) -#define _ERROR_1_(s,a) format_string(tr(LOCALE_CAT_ERROR, _(s)), a) +#define _ERROR_1_(s,a) format_string(tr(LOCALE_CAT_ERROR, _(s)), a) /// A localized string for error messages, with 2 argument (printf style) -#define _ERROR_2_(s,a,b) format_string(tr(LOCALE_CAT_ERROR, _(s)), a, b) +#define _ERROR_2_(s,a,b) format_string(tr(LOCALE_CAT_ERROR, _(s)), a, b) /// A localized string for error messages, with 3 argument (printf style) -#define _ERROR_3_(s,a,b,c) format_string(tr(LOCALE_CAT_ERROR, _(s)), a, b, c) +#define _ERROR_3_(s,a,b,c) format_string(tr(LOCALE_CAT_ERROR, _(s)), a, b, c) /// Format a string /** Equivalent to sprintf / String::Format, but allows strings to be passed as arguments (gcc)