Skip to content

Commit

Permalink
Fix Edit menu translations. (#2686)
Browse files Browse the repository at this point in the history
  • Loading branch information
HelioGuilherme66 authored Jan 13, 2024
1 parent 44f1821 commit 069316b
Show file tree
Hide file tree
Showing 10 changed files with 168 additions and 268 deletions.
60 changes: 33 additions & 27 deletions src/robotide/editor/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,37 @@
_ = wx.GetTranslation # To keep linter/code analyser happy
builtins.__dict__['_'] = wx.GetTranslation


def get_menudata():
# Menus to translate
edit_0 = _("[Edit]\n")
edit_1 = _("&Undo | Undo last modification | Ctrlcmd-Z\n")
edit_2 = _("&Redo | Redo modification | Ctrlcmd-Y\n")
SEPARATOR = "---\n"
edit_3 = _("Cu&t | Cut | Ctrlcmd-X\n")
edit_4 = _("&Copy | Copy | Ctrlcmd-C\n")
edit_5 = _("&Paste | Paste | Ctrlcmd-V\n")
edit_6 = _("&Insert | Insert | Shift-Ctrl-V\n")
edit_7 = _("&Delete | Delete | Del\n")
edit_8 = _("Comment Rows | Comment selected rows | Ctrlcmd-3\n")
edit_9 = _("Comment Cells | Comment cells with # | Ctrlcmd-Shift-3\n")
edit_10 = _("Uncomment Rows | Uncomment selected rows | Ctrlcmd-4\n")
edit_11 = _("Uncomment Cells | Uncomment cells with # | Ctrlcmd-Shift-4\n")
edit_12 = _("Insert Cells | Insert Cells | Ctrlcmd-Shift-I\n")
edit_13 = _("Delete Cells | Delete Cells | Ctrlcmd-Shift-D\n")
edit_14 = _("Insert Rows | Insert Rows | Ctrlcmd-I\n")
edit_15 = _("Delete Rows | Delete Rows | Ctrlcmd-D\n")
edit_16 = _("Move Rows Up | Move Rows Up | Alt-Up\n")
edit_17 = _("Move Rows Down | Move Rows Down | Alt-Down\n")
tools_0 = _("[Tools]\n")
tools_1 = _("Content Assistance (Ctrl-Space or Ctrl-Alt-Space) | Show possible keyword and variable completions"
" | | | POSITION-70\n")

return (edit_0 + edit_1 + edit_2 + SEPARATOR + edit_3 + edit_4 + edit_5 + edit_6 + edit_7 + SEPARATOR +
edit_8 + edit_9 + edit_10 + edit_11 + SEPARATOR + edit_12 + edit_13 + edit_14 + edit_15 + edit_16 +
edit_17 + tools_0 + tools_1)


_EDIT_nt = """[Edit]
&Undo | Undo last modification | Ctrlcmd-Z
&Redo | Redo modification | Ctrlcmd-Y
Expand Down Expand Up @@ -57,32 +88,6 @@ class EditorPlugin(Plugin, TreeAwarePluginMixin):
This plugin implements editors for the various items of Robot Framework
test data.
"""
# Menus to translate
edit_0 = _("[Edit]\n")
edit_1 = _("&Undo | Undo last modification | Ctrlcmd-Z\n")
edit_2 = _("&Redo | Redo modification | Ctrlcmd-Y\n")
SEPARATOR = "---\n"
edit_3 = _("Cu&t | Cut | Ctrlcmd-X\n")
edit_4 = _("&Copy | Copy | Ctrlcmd-C\n")
edit_5 = _("&Paste | Paste | Ctrlcmd-V\n")
edit_6 = _("&Insert | Insert | Shift-Ctrl-V\n")
edit_7 = _("&Delete | Delete | Del\n")
edit_8 = _("Comment Rows | Comment selected rows | Ctrlcmd-3\n")
edit_9 = _("Comment Cells | Comment cells with # | Ctrlcmd-Shift-3\n")
edit_10 = _("Uncomment Rows | Uncomment selected rows | Ctrlcmd-4\n")
edit_11 = _("Uncomment Cells | Uncomment cells with # | Ctrlcmd-Shift-4\n")
edit_12 = _("Insert Cells | Insert Cells | Ctrlcmd-Shift-I\n")
edit_13 = _("Delete Cells | Delete Cells | Ctrlcmd-Shift-D\n")
edit_14 = _("Insert Rows | Insert Rows | Ctrlcmd-I\n")
edit_15 = _("Delete Rows | Delete Rows | Ctrlcmd-D\n")
edit_16 = _("Move Rows Up | Move Rows Up | Alt-Up\n")
edit_17 = _("Move Rows Down | Move Rows Down | Alt-Down\n")
tools_0 = _("[Tools]\n")
tools_1 = _("Content Assistance (Ctrl-Space or Ctrl-Alt-Space) | Show possible keyword and variable completions | | | POSITION-70\n")

_EDIT = (edit_0 + edit_1 + edit_2 + SEPARATOR + edit_3 + edit_4 + edit_5 + edit_6 + edit_7 + SEPARATOR +
edit_8 + edit_9 + edit_10 + edit_11 + SEPARATOR + edit_12 + edit_13 + edit_14 + edit_15 + edit_16 +
edit_17 + tools_0 + tools_1)

def __init__(self, application):
Plugin.__init__(self, application)
Expand All @@ -94,7 +99,8 @@ def __init__(self, application):
def enable(self):
self._creator.register_editors()
self._show_editor()
self.register_actions(action_info_collection(self._EDIT, self._tab, data_nt=_EDIT_nt, container=self._tab))
_menudata = get_menudata()
self.register_actions(action_info_collection(_menudata, self._tab, data_nt=_EDIT_nt, container=self._tab))
self.subscribe(self.on_tree_item_selected, RideTreeSelection)
self.subscribe(self.on_tab_changed, RideNotebookTabChanged)
self.subscribe(self.on_tab_changing, RideNotebookTabChanging)
Expand Down
32 changes: 3 additions & 29 deletions src/robotide/editor/texteditor.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
from wx.adv import HyperlinkCtrl, EVT_HYPERLINK
from multiprocessing import shared_memory
from .popupwindow import HtmlPopupWindow
from . import _EDIT_nt
from . import _EDIT_nt, get_menudata
from .. import robotapi
from ..context import IS_WINDOWS, IS_MAC
from ..controller.ctrlcommands import SetDataFile, INDENTED_START
Expand Down Expand Up @@ -63,33 +63,6 @@
class TextEditorPlugin(Plugin, TreeAwarePluginMixin):
title = PLUGIN_NAME

# Menus to translate
edit_0 = _("[Edit]\n")
edit_1 = _("&Undo | Undo last modification | Ctrlcmd-Z\n")
edit_2 = _("&Redo | Redo modification | Ctrlcmd-Y\n")
SEPARATOR = "---\n"
edit_3 = _("Cu&t | Cut | Ctrlcmd-X\n")
edit_4 = _("&Copy | Copy | Ctrlcmd-C\n")
edit_5 = _("&Paste | Paste | Ctrlcmd-V\n")
edit_6 = _("&Insert | Insert | Shift-Ctrl-V\n")
edit_7 = _("&Delete | Delete | Del\n")
edit_8 = _("Comment Rows | Comment selected rows | Ctrlcmd-3\n")
edit_9 = _("Comment Cells | Comment cells with # | Ctrlcmd-Shift-3\n")
edit_10 = _("Uncomment Rows | Uncomment selected rows | Ctrlcmd-4\n")
edit_11 = _("Uncomment Cells | Uncomment cells with # | Ctrlcmd-Shift-4\n")
edit_12 = _("Insert Cells | Insert Cells | Ctrlcmd-Shift-I\n")
edit_13 = _("Delete Cells | Delete Cells | Ctrlcmd-Shift-D\n")
edit_14 = _("Insert Rows | Insert Rows | Ctrlcmd-I\n")
edit_15 = _("Delete Rows | Delete Rows | Ctrlcmd-D\n")
edit_16 = _("Move Rows Up | Move Rows Up | Alt-Up\n")
edit_17 = _("Move Rows Down | Move Rows Down | Alt-Down\n")
tools_0 = _("[Tools]\n")
tools_1 = _("Content Assistance (Ctrl-Space or Ctrl-Alt-Space) | Show possible keyword and variable completions | | | POSITION-70\n")

_EDIT = (edit_0 + edit_1 + edit_2 + SEPARATOR + edit_3 + edit_4 + edit_5 + edit_6 + edit_7 + SEPARATOR +
edit_8 + edit_9 + edit_10 + edit_11 + SEPARATOR + edit_12 + edit_13 + edit_14 + edit_15 + edit_16 +
edit_17 + tools_0 + tools_1)

def __init__(self, application):
Plugin.__init__(self, application)
self._editor_component = None
Expand All @@ -111,7 +84,8 @@ def _editor(self):

def enable(self):
self._tab = self._editor
self.register_actions(action_info_collection(self._EDIT, self._tab, data_nt=_EDIT_nt, container=self._tab))
_menudata = get_menudata()
self.register_actions(action_info_collection(_menudata, self._tab, data_nt=_EDIT_nt, container=self._tab))
self.subscribe(self.on_tree_selection, RideTreeSelection)
self.subscribe(self.on_data_changed, RideMessage)
self.subscribe(self.on_tab_change, RideNotebookTabChanging)
Expand Down
84 changes: 32 additions & 52 deletions src/robotide/locale/RIDE.pot
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"POT-Creation-Date: 2024-01-12 23:51+0000\n"
"POT-Creation-Date: 2024-01-13 02:31+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <[email protected]>\n"
Expand Down Expand Up @@ -553,123 +553,103 @@ msgstr ""
msgid "Enter Tag Name"
msgstr ""

#: /home2/helio/github/RIDE/tools/../src/robotide/editor/__init__.py:61
#: /home2/helio/github/RIDE/tools/../src/robotide/editor/texteditor.py:67
#: /home2/helio/github/RIDE/tools/../src/robotide/editor/__init__.py:31
msgid ""
"[Edit]\n"
msgstr ""

#: /home2/helio/github/RIDE/tools/../src/robotide/editor/__init__.py:62
#: /home2/helio/github/RIDE/tools/../src/robotide/editor/texteditor.py:68
#: /home2/helio/github/RIDE/tools/../src/robotide/editor/__init__.py:32
msgid ""
"&Undo | Undo last modification | Ctrlcmd-Z\n"
msgstr ""

#: /home2/helio/github/RIDE/tools/../src/robotide/editor/__init__.py:63
#: /home2/helio/github/RIDE/tools/../src/robotide/editor/texteditor.py:69
#: /home2/helio/github/RIDE/tools/../src/robotide/editor/__init__.py:33
msgid ""
"&Redo | Redo modification | Ctrlcmd-Y\n"
msgstr ""

#: /home2/helio/github/RIDE/tools/../src/robotide/editor/__init__.py:65
#: /home2/helio/github/RIDE/tools/../src/robotide/editor/texteditor.py:71
#: /home2/helio/github/RIDE/tools/../src/robotide/editor/__init__.py:35
msgid ""
"Cu&t | Cut | Ctrlcmd-X\n"
msgstr ""

#: /home2/helio/github/RIDE/tools/../src/robotide/editor/__init__.py:66
#: /home2/helio/github/RIDE/tools/../src/robotide/editor/texteditor.py:72
#: /home2/helio/github/RIDE/tools/../src/robotide/editor/__init__.py:36
msgid ""
"&Copy | Copy | Ctrlcmd-C\n"
msgstr ""

#: /home2/helio/github/RIDE/tools/../src/robotide/editor/__init__.py:67
#: /home2/helio/github/RIDE/tools/../src/robotide/editor/texteditor.py:73
#: /home2/helio/github/RIDE/tools/../src/robotide/editor/__init__.py:37
msgid ""
"&Paste | Paste | Ctrlcmd-V\n"
msgstr ""

#: /home2/helio/github/RIDE/tools/../src/robotide/editor/__init__.py:68
#: /home2/helio/github/RIDE/tools/../src/robotide/editor/texteditor.py:74
#: /home2/helio/github/RIDE/tools/../src/robotide/editor/__init__.py:38
msgid ""
"&Insert | Insert | Shift-Ctrl-V\n"
msgstr ""

#: /home2/helio/github/RIDE/tools/../src/robotide/editor/__init__.py:69
#: /home2/helio/github/RIDE/tools/../src/robotide/editor/texteditor.py:75
#: /home2/helio/github/RIDE/tools/../src/robotide/editor/__init__.py:39
msgid ""
"&Delete | Delete | Del\n"
msgstr ""

#: /home2/helio/github/RIDE/tools/../src/robotide/editor/__init__.py:70
#: /home2/helio/github/RIDE/tools/../src/robotide/editor/texteditor.py:76
#: /home2/helio/github/RIDE/tools/../src/robotide/editor/__init__.py:40
msgid ""
"Comment Rows | Comment selected rows | Ctrlcmd-3\n"
msgstr ""

#: /home2/helio/github/RIDE/tools/../src/robotide/editor/__init__.py:71
#: /home2/helio/github/RIDE/tools/../src/robotide/editor/texteditor.py:77
#: /home2/helio/github/RIDE/tools/../src/robotide/editor/__init__.py:41
msgid ""
"Comment Cells | Comment cells with # | Ctrlcmd-Shift-3\n"
msgstr ""

#: /home2/helio/github/RIDE/tools/../src/robotide/editor/__init__.py:72
#: /home2/helio/github/RIDE/tools/../src/robotide/editor/texteditor.py:78
#: /home2/helio/github/RIDE/tools/../src/robotide/editor/__init__.py:42
msgid ""
"Uncomment Rows | Uncomment selected rows | Ctrlcmd-4\n"
msgstr ""

#: /home2/helio/github/RIDE/tools/../src/robotide/editor/__init__.py:73
#: /home2/helio/github/RIDE/tools/../src/robotide/editor/texteditor.py:79
#: /home2/helio/github/RIDE/tools/../src/robotide/editor/__init__.py:43
msgid ""
"Uncomment Cells | Uncomment cells with # | Ctrlcmd-Shift-4\n"
msgstr ""

#: /home2/helio/github/RIDE/tools/../src/robotide/editor/__init__.py:74
#: /home2/helio/github/RIDE/tools/../src/robotide/editor/texteditor.py:80
#: /home2/helio/github/RIDE/tools/../src/robotide/editor/__init__.py:44
msgid ""
"Insert Cells | Insert Cells | Ctrlcmd-Shift-I\n"
msgstr ""

#: /home2/helio/github/RIDE/tools/../src/robotide/editor/__init__.py:75
#: /home2/helio/github/RIDE/tools/../src/robotide/editor/texteditor.py:81
#: /home2/helio/github/RIDE/tools/../src/robotide/editor/__init__.py:45
msgid ""
"Delete Cells | Delete Cells | Ctrlcmd-Shift-D\n"
msgstr ""

#: /home2/helio/github/RIDE/tools/../src/robotide/editor/__init__.py:76
#: /home2/helio/github/RIDE/tools/../src/robotide/editor/texteditor.py:82
#: /home2/helio/github/RIDE/tools/../src/robotide/editor/__init__.py:46
msgid ""
"Insert Rows | Insert Rows | Ctrlcmd-I\n"
msgstr ""

#: /home2/helio/github/RIDE/tools/../src/robotide/editor/__init__.py:77
#: /home2/helio/github/RIDE/tools/../src/robotide/editor/texteditor.py:83
#: /home2/helio/github/RIDE/tools/../src/robotide/editor/__init__.py:47
msgid ""
"Delete Rows | Delete Rows | Ctrlcmd-D\n"
msgstr ""

#: /home2/helio/github/RIDE/tools/../src/robotide/editor/__init__.py:78
#: /home2/helio/github/RIDE/tools/../src/robotide/editor/texteditor.py:84
#: /home2/helio/github/RIDE/tools/../src/robotide/editor/__init__.py:48
msgid ""
"Move Rows Up | Move Rows Up | Alt-Up\n"
msgstr ""

#: /home2/helio/github/RIDE/tools/../src/robotide/editor/__init__.py:79
#: /home2/helio/github/RIDE/tools/../src/robotide/editor/texteditor.py:85
#: /home2/helio/github/RIDE/tools/../src/robotide/editor/__init__.py:49
msgid ""
"Move Rows Down | Move Rows Down | Alt-Down\n"
msgstr ""

#: /home2/helio/github/RIDE/tools/../src/robotide/editor/__init__.py:80
#: /home2/helio/github/RIDE/tools/../src/robotide/editor/texteditor.py:86
#: /home2/helio/github/RIDE/tools/../src/robotide/editor/__init__.py:50
#: /home2/helio/github/RIDE/tools/../src/robotide/ui/mainframe.py:66
msgid ""
"[Tools]\n"
msgstr ""

#: /home2/helio/github/RIDE/tools/../src/robotide/editor/__init__.py:81
#: /home2/helio/github/RIDE/tools/../src/robotide/editor/texteditor.py:87
#: /home2/helio/github/RIDE/tools/../src/robotide/editor/__init__.py:51
msgid ""
"Content Assistance (Ctrl-Space or Ctrl-Alt-Space) | Show possible keyword and variable completions | | | POSITION-70\n"
msgstr ""
Expand Down Expand Up @@ -844,7 +824,7 @@ msgid "Variable "
msgstr ""

#: /home2/helio/github/RIDE/tools/../src/robotide/editor/kweditor.py:1180
#: /home2/helio/github/RIDE/tools/../src/robotide/editor/texteditor.py:542
#: /home2/helio/github/RIDE/tools/../src/robotide/editor/texteditor.py:516
#: /home2/helio/github/RIDE/tools/../src/robotide/searchtests/dialogsearchtests.py:49
#: /home2/helio/github/RIDE/tools/../src/robotide/searchtests/dialogsearchtests.py:127
#: /home2/helio/github/RIDE/tools/../src/robotide/searchtests/dialogsearchtests.py:184
Expand Down Expand Up @@ -963,35 +943,35 @@ msgstr ""
msgid "Add Metadata"
msgstr ""

#: /home2/helio/github/RIDE/tools/../src/robotide/editor/texteditor.py:396
#: /home2/helio/github/RIDE/tools/../src/robotide/editor/texteditor.py:370
msgid "ERROR: Data sanity check failed!"
msgstr ""

#: /home2/helio/github/RIDE/tools/../src/robotide/editor/texteditor.py:396
#: /home2/helio/github/RIDE/tools/../src/robotide/editor/texteditor.py:370
msgid "Error at line"
msgstr ""

#: /home2/helio/github/RIDE/tools/../src/robotide/editor/texteditor.py:397
#: /home2/helio/github/RIDE/tools/../src/robotide/editor/texteditor.py:371
msgid "Reset changes?"
msgstr ""

#: /home2/helio/github/RIDE/tools/../src/robotide/editor/texteditor.py:398
#: /home2/helio/github/RIDE/tools/../src/robotide/editor/texteditor.py:372
msgid "Can not apply changes from Text Editor"
msgstr ""

#: /home2/helio/github/RIDE/tools/../src/robotide/editor/texteditor.py:526
#: /home2/helio/github/RIDE/tools/../src/robotide/editor/texteditor.py:500
msgid "Apply Changes"
msgstr ""

#: /home2/helio/github/RIDE/tools/../src/robotide/editor/texteditor.py:552
#: /home2/helio/github/RIDE/tools/../src/robotide/editor/texteditor.py:526
msgid "Syntax colorization disabled due to missing requirements."
msgstr ""

#: /home2/helio/github/RIDE/tools/../src/robotide/editor/texteditor.py:553
#: /home2/helio/github/RIDE/tools/../src/robotide/editor/texteditor.py:527
msgid "Get help"
msgstr ""

#: /home2/helio/github/RIDE/tools/../src/robotide/editor/texteditor.py:568
#: /home2/helio/github/RIDE/tools/../src/robotide/editor/texteditor.py:542
msgid ""
"<h1>Syntax colorization</h1>\n"
" <p>\n"
Expand Down Expand Up @@ -1020,11 +1000,11 @@ msgid ""
" "
msgstr ""

#: /home2/helio/github/RIDE/tools/../src/robotide/editor/texteditor.py:593
#: /home2/helio/github/RIDE/tools/../src/robotide/editor/texteditor.py:567
msgid "Getting syntax colorization"
msgstr ""

#: /home2/helio/github/RIDE/tools/../src/robotide/editor/texteditor.py:691
#: /home2/helio/github/RIDE/tools/../src/robotide/editor/texteditor.py:665
msgid "No matches found."
msgstr ""

Expand Down
Binary file modified src/robotide/locale/nl/LC_MESSAGES/RIDE.mo
Binary file not shown.
Loading

0 comments on commit 069316b

Please sign in to comment.