Skip to content

Commit eff39f1

Browse files
committed
Fix unit tests
1 parent f793715 commit eff39f1

2 files changed

Lines changed: 42 additions & 0 deletions

File tree

utest/test/api/approved_files/PluginDocumentation.test_many_plugins.approved.txt

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -487,6 +487,46 @@ documentation for further details.
487487

488488
Plugin API is new SeleniumLibrary 4.0
489489

490+
= Language =
491+
492+
SeleniumLibrary offers possibility to translte keyword names and documentation to new language. If language
493+
is defined, SeleniumLibrary will search from
494+
[https://robotframework.org/robotframework/latest/RobotFrameworkUserGuide.html#module-search-path | module search path]
495+
Python packages starting with `robotframework_seleniumlibrary_translation` by using
496+
[https://packaging.python.org/en/latest/guides/creating-and-discovering-plugins/ | Python pluging API]. Library
497+
is using naming convention to find Python plugins.
498+
499+
The package must implement single API call, ``get_language`` without any arguments. Method must return a
500+
dictionary containing two keys: ``language`` and ``path``. The language key value defines which language
501+
the package contains. Also value should match (case insentive) the library ``language`` import parameter.
502+
The path parameter value should be full path to the translation file.
503+
504+
== Translation file ==
505+
506+
The file name or extension is not important, but data must be in [https://www.json.org/json-en.html | json]
507+
format. The keys of json are the methods names, not the keyword names, which implements keywords. Value of
508+
key is json object which contains two keys: ``name`` and ``doc``. The ``name`` key contains the keyword
509+
translated name and `doc` contains translated documentation. Providing doc and name are optional, example
510+
translation json file can only provide translations to keyword names or only to documentatin. But it is
511+
always recomended to provide translation to both name and doc. Special key ``__intro__`` is for class level
512+
documentation and ``__init__`` is for init level documentation. These special values ``name`` can not be
513+
translated, instead ``name`` should be kept the same.
514+
515+
== Generating template translation file ==
516+
517+
Template translation file, with English language can be created by running:
518+
`rfselib translation /path/to/translation.json` command. Command does not provide translations to other
519+
languages, it only provides easy way to create full list keywords and their documentation in correct
520+
format. It is also possible to add keywords from library plugins by providing `--plugings` arguments
521+
to command. Example: `rfselib translation --plugings myplugin.SomePlugin /path/to/translation.json` The
522+
genered json file contains `sha256` key, which constains the sha256 sum of the library documentation,
523+
the sha256 sum is used by `rfselib translation --compare /path/to/translation.json` command, which compares
524+
transation to to library and prints outs a table which tell if there are changes needed for translation file.
525+
526+
Example project for translation can be found from
527+
[https://github.com/MarketSquare/robotframework-seleniumlibrary-translation-fi | robotframework-seleniumlibrary-translation-fi]
528+
repository.
529+
490530
= Plugin: my_lib =
491531

492532
Some dummy documentation.

utest/test/api/approved_files/PluginDocumentation.test_parse_plugin_init_doc.approved.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,5 @@ SeleniumLibrary can be imported with several optional arguments.
1919
Default value to wait for page load to complete until a timeout exception is raised.
2020
- ``action_chain_delay``:
2121
Default value for `ActionChains` delay to wait in between actions.
22+
- ``language``:
23+
Defines language which is used to translate keyword names and documentation.

0 commit comments

Comments
 (0)