Skip to content

Commit 86d7c88

Browse files
Add support for localized test suites and UI (#2678)
* Improve reader. DEBUG * Improve reader. * Add check_file_language. Working in project.load_data, but not when opening files. * Add condition fro lang in model * First success opening laang_pt and lang_fr tests * Make unit tests pass * Improve lang headers, pt and fr * Add unit tests. All lnguages tests can be opened. Missing lib lang fixes * Identify where language can be checked from TextEditor * More tables using language * Working opening with lang set. Tests for multiple langs * Working opening directories with different lang files * Make __init__.robot open with language set. WIP, copy _aliases to _settings * OK Opens from directories. * Fixed open test suites directories. Need utests and fix comments * Fix opening directly __init__.robot * Cleanup code * Improve opening of Resource files * Open pt folder, fail en folder. Failed comment blocks at formatter level * Add order of sections. Still broken en directories, and missing memory clear on open * Fix some utests * Fix unit tests * Remove inner comments from the en test directory * Success in multiple Comments sections. Missing isolated comments * Fix # isolated comments and Comments section * Settings Dialogs OK. Need localizaation. Variables is debug * Adjust buttons in table settings to open dialogs for Tests and Tasks * Fix all settings Edit buttons * Fix continuation lines in Documentation other than En * Improve setting of language in TextEditor * Fix Library translated labels * I18n colorization (#143) * Initial modification of pygments. Missing Gerkin * Remove nolower * Almost done. Missing Gherkin and Documentation setting color not OK * Fixed Gherkin calls. Still to fix TestTableSettings Setup/Teardown/Template keywords * Final fixes for colorization * Fix error when opening directories with log or report html files * Update docs and version * Add validator from RF 6.1.1 to Text Edit. WIP fails to save language files * Add new validator * Fix saving modified files with language setting * Fix help dialog for Pygments * Add protection to shared_memory language setting * Remove extra spaces from lines in Comments sections * Remove support for HTML test files. WIP * Make own pygments a module * Fix broken sincronization of changes in Text Editor * Add minimal protection to RF lower than 6.0 * Add tooltip to settings fields localized names * Notes about tooltips * Add language selector to Preferences->General * Initial structure for localization change * Add first example de localized strings * Add test from W2 * Add more debugging for localization * Fix pause translated commands * Update translations for TestRunner * Fix some unit tests * Fix import failed XML * Fix unit test * Fix more translations in in Tests and in Unudrd Keywords * Fix default ui language, Variables and Metadata editors * Improvement in language save or RIDE start * Add pt_BR translation * DEBUG Save from Text Editor
1 parent 410e9f9 commit 86d7c88

File tree

148 files changed

+9205
-996
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

148 files changed

+9205
-996
lines changed

CHANGELOG.adoc

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,20 @@ and this project adheres to http://semver.org/spec/v2.0.0.html[Semantic Versioni
88

99
== https://github.com/robotframework/RIDE[Unreleased]
1010

11+
=== Added
12+
13+
- Added support for language configured test suites, with installed Robot Framework version 6.0 or higher.
14+
- Fields are shown in the language of the files in Grid Editor (will be configurable if future versions).
15+
- Tooltips for the fields are always shown in English.
16+
- Colorization for language configured files is working in Text Editor.
17+
1118
=== Fixed
1219

1320
- Fixed New User Keyword dialog not allowing empty Arguments field
1421

22+
=== Removed
23+
24+
- Removed support for old Python versions, 3.6 nd 3.7.
1525

1626
== https://github.com/robotframework/RIDE/blob/master/doc/releasenotes/ride-2.0.8.1.rst[2.0.8.1] - 2023-11-01
1727

README.adoc

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,12 @@ If you are looking for the latest released version, you can get the source code
2020

2121
See the https://github.com/robotframework/RIDE/blob/master/doc/releasenotes/ride-2.0.8.1.rst[release notes] for latest release version 2.0.8.1
2222

23+
**Version https://github.com/robotframework/RIDE/tree/release/2.0.8.1[2.0.8.1] was the last release supporting Python 3.6 and 3.7**
24+
2325
**Version https://github.com/robotframework/RIDE/tree/release/1.7.4.2[1.7.4.2] was the last release supporting Python 2.7**
2426

2527

26-
**The current development version is based on 2.0.8.1, supports Python from 3.6 up to 3.11 (1st November 2023).**
28+
**The current development version is based on 2.0.8.1, supports Python from 3.8 up to 3.11 (20th December 2023).**
2729

2830
Currently the unit tests are tested on Python 3.10, and 3.11 (which is the recommended version).
2931
Likewise, the current version of wxPython, is 4.2.1, but RIDE is known to work with 4.0.7 and 4.1.1 versions.
@@ -32,7 +34,7 @@ Likewise, the current version of wxPython, is 4.2.1, but RIDE is known to work w
3234

3335
`pip install -U robotframework-ride`
3436

35-
Install current development version (**2.0.9dev#**) with:
37+
(3.8 < python <= 3.11) Install current development version (**2.1a1**) with:
3638

3739
`pip install -U https://github.com/robotframework/RIDE/archive/master.zip`
3840

setup.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,6 @@
5050
Development Status :: 5 - Production/Stable
5151
License :: OSI Approved :: Apache Software License
5252
Operating System :: OS Independent
53-
Programming Language :: Python :: 3.6
54-
Programming Language :: Python :: 3.7
5553
Programming Language :: Python :: 3.8
5654
Programming Language :: Python :: 3.9
5755
Programming Language :: Python :: 3.10
@@ -94,7 +92,7 @@ def run(self):
9492
package_dir={'': SOURCE_DIR},
9593
packages=find_packages(SOURCE_DIR),
9694
package_data=PACKAGE_DATA,
97-
python_requires='>=3.6',
95+
python_requires='>=3.8, <3.12',
9896
# Robot Framework package data is not included, but RIDE does not need it.
9997
# Always install everything, since we may be switching between versions
10098
options={'install': {'force': True}},

src/robotide/action/actioninfo.py

Lines changed: 28 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,19 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515

16+
import builtins
1617
import re
1718

1819
import wx
1920

2021
from ..widgets import ImageProvider
2122
from .shortcut import Shortcut
2223

24+
_ = wx.GetTranslation # To keep linter/code analyser happy
25+
builtins.__dict__['_'] = wx.GetTranslation
2326

24-
def action_info_collection(data, event_handler, container=None):
27+
28+
def action_info_collection(data, event_handler, data_nt=None, container=None):
2529
"""Parses the ``data`` into a list of `ActionInfo` and `SeparatorInfo` objects.
2630
2731
The data is parsed based on the simple DSL documented below.
@@ -32,6 +36,9 @@ def action_info_collection(data, event_handler, container=None):
3236
event_handler
3337
The event handler that implements the actions. See `finding handlers`_
3438
for more information.
39+
data_nt
40+
Since RIDE 2.1, this is the original English menudata, or None which will be a copy of data
41+
This is due to the way menu is created for translations, which will not build the correct handler names.
3542
container
3643
the wxPython element containing the UI components associated with
3744
the `ActionInfo`.
@@ -91,7 +98,7 @@ def action_info_collection(data, event_handler, container=None):
9198
Specifying container
9299
--------------------
93100
94-
By default the given ``container`` is passed to the `ActionInfo.__init__`
101+
By default, the given ``container`` is passed to the `ActionInfo.__init__`
95102
method directly. This can be altered by prefixing the ``name`` with an
96103
exclamation mark (e.g. ``!Save`` or ``!My Action``) to make that action
97104
global. With these actions the container given to the `ActionInfo.__init__`
@@ -114,30 +121,41 @@ def action_info_collection(data, event_handler, container=None):
114121
Content Assist (Ctrl-Space or Ctrl-Alt-Space) | Has two shortcuts.
115122
"""
116123

124+
if not data_nt:
125+
data_nt = data
117126
menu = None
118127
actions = []
119-
for row in data.splitlines():
128+
for row, row_nt in zip(data.splitlines(), data_nt.splitlines()):
120129
row = row.strip()
121-
if not row:
130+
row_nt = row_nt.strip()
131+
print(f"DEBUG: actioninfo.py action_info_collection in loop row={row}\noriginal={row_nt} ")
132+
if not row and not row_nt:
122133
continue
123134
elif row.startswith('[') and row.endswith(']'):
124135
menu = row[1:-1].strip()
136+
# print(f"DEBUG: actioninfo.py action_info_collection menu={menu}")
125137
else:
126-
actions.append(_create_action_info(event_handler, menu, container, row))
138+
actions.append(_create_action_info(event_handler, menu, container, row, row_nt))
127139
return actions
128140

129141

130-
def _create_action_info(eventhandler, menu, container, row):
142+
def _create_action_info(eventhandler, menu, container, row, row_nt):
131143
if row.startswith('---'):
132144
return SeparatorInfo(menu)
133145
tokens = [t.strip() for t in row.split('|')]
134146
tokens += [''] * (5-len(tokens))
135147
name, doc, shortcut, icon, position = tokens
136-
if name.startswith('!'):
148+
tokens_nt = [t.strip() for t in row_nt.split('|')]
149+
tokens_nt += [''] * (5-len(tokens_nt))
150+
name_nt, __, __, __, __ = tokens_nt
151+
if name_nt.startswith('!'):
137152
name = name[1:]
153+
name_nt = name_nt[1:]
138154
container = None
139-
eventhandler_name, name = get_eventhandler_name_and_parsed_name(name)
155+
eventhandler_name, name_nt = get_eventhandler_name_and_parsed_name(name_nt)
140156
action = getattr(eventhandler, eventhandler_name)
157+
print(f"DEBUG: actioninfo.py _create_action_info menu={menu} eventhandler_name={eventhandler_name},"
158+
f" name_nt={name_nt}")
141159
return ActionInfo(menu, name, action, container, shortcut, icon, doc, position)
142160

143161

@@ -152,8 +170,7 @@ def _parse_shortcuts_from_name(name):
152170
eventhandler_name, shortcuts = name.split('(', 1)
153171
shortcuts = shortcuts.split(')')[0]
154172
elements = shortcuts.split(' or ')
155-
name = '%s (%s)' % (eventhandler_name, ' or '.join(Shortcut(e).printable for e in
156-
elements))
173+
name = '%s (%s)' % (eventhandler_name, ' or '.join(Shortcut(e).printable for e in elements))
157174
return eventhandler_name, name
158175
return name, name
159176

@@ -187,7 +204,7 @@ class ActionInfo(MenuInfo):
187204

188205
def __init__(self, menu_name, name, action=None, container=None,
189206
shortcut=None, icon=None, doc='', position=-1):
190-
"""Initializes information needed to create actions..
207+
"""Initializes information needed to create actions...
191208
192209
:Parameters:
193210
menu_name

0 commit comments

Comments
 (0)