Skip to content

Commit 76c28b5

Browse files
Fix apply with or without lng setting, changing files updates lang
1 parent 8e5b276 commit 76c28b5

File tree

7 files changed

+62
-30
lines changed

7 files changed

+62
-30
lines changed

CHANGELOG.adoc

+5-2
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,10 @@ and this project adheres to http://semver.org/spec/v2.0.0.html[Semantic Versioni
99
== https://github.com/robotframework/RIDE[Unreleased]
1010

1111
=== Added
12-
13-
- Added support for language configured test suites, with installed Robot Framework version 6.0 or higher.
12+
- Added UI localization prepared for all the languages from installed Robot Framework version 6.1, or
13+
higher. Major translations are: Dutch, Portuguese and Brazilian Portuguese. Language is selected from
14+
Tools->Preferences->General.
15+
- Added support for language configured test suites, with installed Robot Framework version 6.1 or higher.
1416
- Fields are shown in the language of the files in Grid Editor (will be configurable if future versions).
1517
- Tooltips for the fields are always shown in English.
1618
- Colorization for language configured files is working in Text Editor.
@@ -21,6 +23,7 @@ and this project adheres to http://semver.org/spec/v2.0.0.html[Semantic Versioni
2123

2224
=== Removed
2325

26+
- Removed support for HTML file format (obsolete since Robot Framework 3.2)
2427
- Removed support for old Python versions, 3.6 nd 3.7.
2528

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

src/robotide/application/CHANGELOG.html

+7-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Changelog</title><link rel="stylesheet" type="text/css" href="docbook-xsl.css" /><meta name="generator" content="DocBook XSL Stylesheets Vsnapshot" /></head><body><div xml:lang="en" class="article" lang="en"><div class="titlepage"><div><div><h2 class="title"><a id="id1337"></a>Changelog</h2></div></div><hr /></div><p>All notable changes to this project will be documented in this file.</p><p>The format is based on <a class="ulink" href="http://keepachangelog.com/en/1.0.0/" target="_top">Keep a Changelog</a>
33
and this project adheres to <a class="ulink" href="http://semver.org/spec/v2.0.0.html" target="_top">Semantic Versioning</a>.</p><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="_ulink_url_https_github_com_robotframework_ride_unreleased_ulink"></a>1. <a class="ulink" href="https://github.com/robotframework/RIDE" target="_top">Unreleased</a></h2></div></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="_added"></a>1.1. Added</h3></div></div></div><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">
4-
Added support for language configured test suites, with installed Robot Framework version 6.0 or higher.
4+
Added UI localization prepared for all the languages from installed Robot Framework version 6.1, or
5+
higher. Major translations are: Dutch, Portuguese and Brazilian Portuguese. Language is selected from
6+
Tools→Preferences→General.
7+
</li><li class="listitem">
8+
Added support for language configured test suites, with installed Robot Framework version 6.1 or higher.
59
</li><li class="listitem">
610
Fields are shown in the language of the files in Grid Editor (will be configurable if future versions).
711
</li><li class="listitem">
@@ -11,6 +15,8 @@
1115
</li></ul></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="_fixed"></a>1.2. Fixed</h3></div></div></div><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">
1216
Fixed New User Keyword dialog not allowing empty Arguments field
1317
</li></ul></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="_removed"></a>1.3. Removed</h3></div></div></div><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">
18+
Removed support for HTML file format (obsolete since Robot Framework 3.2)
19+
</li><li class="listitem">
1420
Removed support for old Python versions, 3.6 nd 3.7.
1521
</li></ul></div></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="_ulink_url_https_github_com_robotframework_ride_blob_master_doc_releasenotes_ride_2_0_8_1_rst_2_0_8_1_ulink_2023_11_01"></a>2. <a class="ulink" href="https://github.com/robotframework/RIDE/blob/master/doc/releasenotes/ride-2.0.8.1.rst" target="_top">2.0.8.1</a> - 2023-11-01</h2></div></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="_added_2"></a>2.1. Added</h3></div></div></div><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">
1622
Added auto update check when development version is installed

src/robotide/application/releasenotes.py

+10-5
Original file line numberDiff line numberDiff line change
@@ -150,15 +150,17 @@ def set_content(self, html_win, content):
150150
151151
152152
<p><a class="reference external" href="https://github.com/robotframework/RIDE/">RIDE (Robot Framework IDE)</a>
153-
{VERSION} is a new release with minor enhancements and bug fixes. The reference for valid arguments is
153+
{VERSION} is a new release with important enhancements and bug fixes. The reference for valid arguments is
154154
<a class="reference external" href="https://robotframework.org/">Robot Framework</a> installed version, which is at this
155-
moment 6.1.1. However, internal library is based on version 3.1.2, to keep compatibility with old formats.</p>
155+
moment 7.0. However, internal library code is originally based on version 3.1.2, but adapted for new versions.</p>
156156
<p></p>
157157
<ul class="simple">
158-
<li>This version supports Python 3.8 up to 3.11.</li>
158+
<li>This version supports Python 3.8 up to 3.12.</li>
159159
<li>There are some changes, or known issues:<ul>
160160
<li>Removed support for Python 3.6 and 3.7</li>
161-
<li>Added support for language configured test suites, with languages from installed Robot Framework version 6.0, or
161+
<li>Added UI localization prepared for all the languages from installed Robot Framework version 6.1, or
162+
higher. Major translations are: Dutch, Portuguese and Brazilian Portuguese.</li>
163+
<li>Added support for language configured test suites, with languages from installed Robot Framework version 6.1, or
162164
higher.</li>
163165
<li>On Text Editor, pressing <b>Ctrl</b> when the caret/cursor is near a Keyword will show a detachable window with the
164166
documentation, at Mouse Pointer position.</li>
@@ -179,6 +181,9 @@ def set_content(self, html_win, content):
179181
</ul>
180182
<p><strong>New Features and Fixes Highlights</strong></p>
181183
<ul class="simple">
184+
<li>Added UI localization prepared for all the languages from installed Robot Framework version 6.1, or
185+
higher. Language is selected from Tools->Preferences->General.</li>
186+
<li>Removed support for HTML file format (obsolete since Robot Framework 3.2)</li>
182187
<li>Added support for language configured test suites. Fields are shown in the language of the files in Grid Editor.
183188
Tooltips are always shown in English. Colorization for language configured files is working in Text Editor.</li>
184189
<li>Fixed New User Keyword dialog not allowing empty Arguments field</li>
@@ -270,6 +275,6 @@ def set_content(self, html_win, content):
270275
<pre class="literal-block">
271276
python -m robotide.postinstall -install
272277
</pre>
273-
<p>RIDE {VERSION} was released on 24/Dec/2023.</p>
278+
<p>RIDE {VERSION} was released on 04/Feb/2024.</p>
274279
</div>
275280
"""

src/robotide/editor/texteditor.py

+35-17
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ def _open(self):
141141
self._doc_language = self._editor.language = datafile_controller.language
142142
else:
143143
self._doc_language = self._editor.language = ['en']
144-
print(f"DEBUG: texteditor _open language={self._doc_language}")
144+
# print(f"DEBUG: texteditor _open language={self._doc_language}")
145145
self._open_data_for_controller(datafile_controller)
146146
self._editor.store_position()
147147

@@ -310,13 +310,13 @@ def obtain_language(existing, content):
310310
except AttributeError: # Unittests fails here
311311
set_lang = []
312312
doc_lang = read_language(content)
313-
print(f"DEBUG: textedit.py validate_and_update obtain_language={doc_lang}")
313+
# print(f"DEBUG: textedit.py validate_and_update obtain_language={doc_lang}")
314314
if doc_lang is not None:
315315
mlang = Language.from_name(doc_lang)
316-
set_lang = [mlang.code]
316+
set_lang[0] = mlang.code
317317
else:
318-
set_lang[0] = existing if existing is not None else 'en'
319-
return set_lang
318+
set_lang[0] = existing[0] if existing is not None else 'en'
319+
return [set_lang[0]]
320320

321321

322322
class DataValidationHandler(object):
@@ -326,21 +326,27 @@ def __init__(self, plugin, lang=None):
326326
self._last_answer = None
327327
self._last_answer_time = 0
328328
self._editor = None
329-
self._doc_language = lang
329+
try:
330+
set_lang = shared_memory.ShareableList(name="language")
331+
except AttributeError: # Unittests fails here
332+
set_lang = []
333+
if set_lang is not None:
334+
self._doc_language = set_lang[0]
335+
elif lang is not None:
336+
self._doc_language = lang
337+
else:
338+
self._doc_language = 'en'
330339

331340
def set_editor(self, editor):
332341
self._editor = editor
333342

334343
def validate_and_update(self, data, text, lang='en'):
335344
m_text = text.decode("utf-8")
336345
if "Language: " in m_text:
337-
print(f"DEBUG: textedit.py validate_and_update Content has Language setting is {lang}\n"
338-
f"Calling obtain_language: ")
339-
doc_lang = obtain_language(lang, text)
340-
self._doc_language = doc_lang
341-
print(f"DEBUG: textedit.py validate_and_update AFTER obtain_language={doc_lang}")
346+
self._doc_language = obtain_language(lang, text)
342347
else:
343348
self._doc_language = lang if lang is not None else 'en'
349+
self._editor.language = self._doc_language
344350

345351
result = self._sanity_check(data, m_text)
346352
if isinstance(result, tuple):
@@ -376,7 +382,7 @@ def _sanity_check(self, data, text):
376382
validator.visit(model)
377383
except DataError as err:
378384
result = (err.message, err.details)
379-
model.save("/tmp/model_saved_from_RIDE.robot")
385+
# model.save("/tmp/model_saved_from_RIDE.robot")
380386
# print(f"DEBUG: textedit.py _sanity_check after calling validator {validator}\n"
381387
# f"Save model in /tmp/model_saved_from_RIDE.robot"
382388
# f" result={result}")
@@ -422,7 +428,10 @@ def __init__(self, data, settings, language=None):
422428
self.wrapper_data = data
423429
self._settings = settings
424430
self._tab_size = self._settings.get(TXT_NUM_SPACES, 2) if self._settings else 2
425-
self._doc_language = language
431+
if language is not None:
432+
self._doc_language = language
433+
else:
434+
self._doc_language = ['en']
426435

427436
def __eq__(self, other):
428437
if other is None:
@@ -434,7 +443,7 @@ def update_from(self, content):
434443

435444
def _create_target_from(self, content):
436445
src = BytesIO(content.encode("utf-8"))
437-
target = self._create_target()
446+
target = self._create_target(content.encode("utf-8"))
438447
FromStringIOPopulator(target, lang=self._doc_language).populate(src, self._tab_size)
439448
return target
440449

@@ -449,9 +458,11 @@ def mark_data_pristine(self):
449458
if self.wrapper_data.is_dirty:
450459
self.wrapper_data.unmark_dirty()
451460

452-
def _create_target(self):
461+
def _create_target(self, content=None):
453462
data = self.wrapper_data.data
454463
target_class = type(data)
464+
self._doc_language = obtain_language(self._doc_language, content=content)
465+
# print(f"DEBUG: textedit.py DataFileWrapper _create_target self._doc_language={self._doc_language}")
455466
if isinstance(data, robotapi.TestDataDirectory):
456467
target = robotapi.TestDataDirectory(parent=None, source=self.wrapper_data.directory,
457468
settings=self._settings, language=self._doc_language)
@@ -494,6 +505,13 @@ def __init__(self, plugin, parent, title, data_validator):
494505
self.tab_size = self.source_editor_parent.app.settings.get(TXT_NUM_SPACES, 4)
495506
self.reformat = self.source_editor_parent.app.settings.get('reformat', False)
496507
self._doc_language = None
508+
try:
509+
set_lang = shared_memory.ShareableList(name="language")
510+
except AttributeError: # Unittests fails here
511+
set_lang = []
512+
if not set_lang:
513+
set_lang[0] = ['en']
514+
self._doc_language = set_lang[0]
497515
self._create_ui(title)
498516
self._data = None
499517
self._position = 0 # Start at 0 if first time access
@@ -794,8 +812,8 @@ def open(self, data):
794812
self._suggestions = SuggestionSource(None, self._controller_for_context)
795813
if hasattr(self.plugin, 'datafile') and self.plugin.datafile:
796814
self.datafile = self.plugin.datafile
797-
else:
798-
print(f"DEBUG: Text Editor open NOT DATAFILE path={self.datafile_controller.source}")
815+
# else:
816+
# print(f"DEBUG: Text Editor open NOT DATAFILE path={self.datafile_controller.source}")
799817
if not self.source_editor:
800818
self._stored_text = self._data.content
801819
self._create_editor_text_control(text=self._stored_text, language=self.language)

src/robotide/lib/robot/parsing/model.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,9 @@ def start_table(self, header_row, lineno: int, llang: list):
106106
# print(f"DEBUG: model _TestData start_table table={table} header_row={header_row}")
107107
if table is None or not self._table_is_allowed(table):
108108
return None
109+
if table.type == 'setting':
110+
self.setting_table = table = TestCaseFileSettingTable(self, self.language)
111+
self.tables.append(self.setting_table)
109112
if table.type == 'test case':
110113
self.testcase_table = table = TestCaseTable(self, self.language)
111114
self.tables.append(self.testcase_table)
@@ -265,9 +268,6 @@ def save(self, **options):
265268
266269
See also :py:class:`robot.writer.datafilewriter.DataFileWriter`
267270
"""
268-
options['language'] = self.language
269-
print(f"DEBUG: model.py save Call DataFileWriter options={options}\n"
270-
f"self.language={self.language} set language={options['language']}")
271271
return DataFileWriter(**options).write(self)
272272

273273

src/robotide/ui/mainframe.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -476,7 +476,7 @@ def open_suite(self, path):
476476
# print(f"DEBUG: project.py Project load_data file_language = {self.controller.file_language}\n"
477477
# f"sharedmem={set_lang}")
478478
else:
479-
set_lang = ['en']
479+
set_lang[0] = 'en'
480480
try:
481481
err = self.controller.load_datafile(path, LoadProgressObserver(self))
482482
if isinstance(err, UserWarning):

src/robotide/version.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@
1414
# limitations under the License.
1515
#
1616
# Automatically generated by `tasks.py`.
17-
VERSION = 'v2.1dev14'
17+
VERSION = 'v2.1dev15'

0 commit comments

Comments
 (0)