Skip to main content

Robot Framework Internationalization

Project description

license

Robot Framework Localization Helper

A python library and CLI to help testers to internationalize and localize robot test cases.

Installation

robotLocalization can be installed with pip/pipenv:

pip install robotLocalization
pipenv install robotLocalization

Usage

robotLocalization can be used in two modes as a get_variables function or a CLI. The get_variables function can be used in the robot test case to load strings from properpties files by providing a language fallback mechanism. robotLocalization CLI provides functionalities to help testers to internationalize test cases.

# resources/sample.properties
msg = Hello, World!
# resources/sample_ja.properties
msg = みなさんこんにちは!
#   sample.robot
#
#   $ robot --variable language:en sample.robot
#   $ robot --variable language:ja sample.robot
#
*** Settings ***
Library     SeleniumLibrary
Variables   robotLocalization     ${LANGUAGE}    resources/sample.properties    verbose=True

*** Variables ***
${LANGUAGE}              en     # default LANGUAGE.  This can be replaced by --variable option.

*** Test Cases ***
Test Case 1
    [Documentation]    robotLocalization Sample
    Log To Console     ${msg}
    Log Variables

Getting variables from get_variables function

robotLocalization provides get_variabes function which can be specified in the robot Variables statement.

Syntax in robot test

Variables robotLocalization localeId path or file list pathOptions

localeId specifies the locale or language of the properties being used. It is used to load strings from properties files in the properties files in the specified path list or files. If specified locale is not available, English propereties will be used.

pathOptions

verbose= True or False filetype= file type

Examples

Variables robotLocalization en ${PROJECT_REPO_PATH}

Accessing variables from robot code.

Internationalization Helper CLI

The robotLocalization CLI helps tests to internationalize robot test cases.

robotLocalization operand file_patterns language-list

Analyze Mode

In the analyze mode, robotLocalization CLI reports the localizable strings in robot test and cadicases of available strings in existing properties files from properties files in the specified path list.

robotLocalization [*path list()] --analyze [*robot_file*]
–analyze

Specifies a robot test case. Typically, this robot file contains Xpath specifications with UI elements or robot variable specifications used in other keywords.

Extract Mode

The extract mode is used to extract strings from a specified robot file. It also generates internationalized robot files by replacing localizable strings with variables references.

–extract

Specifies a robot test case to extract strings.

–output_bundle

Specifies a bundle file which can be used to store product properties into a single file. This options is only valid if –use_bundle option is enaled.

–output_properties

Specifies a properties file to store localizable strings. If –use_bundle is specified, only strings not available in product properties files are stored.

–output_robot|–outr

Specifies a robot file by internationalizing the robot file specifeid wit –extract option. All localizable strings will be replaced by variable references. A string with “# i18n:OK ” comments are ignored.

–use_bundle|–use_keys

–use_bundle options checks the availablity of strings in the specified product properties files. If found, it uses strings there.

Dump Mode

–dump

–dump option generates list all the variables loaded from properties files.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

robotLocalization-0.9.1.tar.gz (18.7 kB view details)

Uploaded Source

Built Distribution

robotLocalization-0.9.1-py3-none-any.whl (24.7 kB view details)

Uploaded Python 3

File details

Details for the file robotLocalization-0.9.1.tar.gz.

File metadata

  • Download URL: robotLocalization-0.9.1.tar.gz
  • Upload date:
  • Size: 18.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.8.8

File hashes

Hashes for robotLocalization-0.9.1.tar.gz
Algorithm Hash digest
SHA256 8349ab283f7168cfc350789e59aeb5e63a3c6698a34250856b3a25c47b057378
MD5 607e3b75a492685551a0bc9412048d44
BLAKE2b-256 5e59ee7b3798c21c9b20d6a10b794cf0b4dd35d3710cf4f13224366ec895f797

See more details on using hashes here.

File details

Details for the file robotLocalization-0.9.1-py3-none-any.whl.

File metadata

File hashes

Hashes for robotLocalization-0.9.1-py3-none-any.whl
Algorithm Hash digest
SHA256 3bae7d1cf5e50fb2c5cf7d0a1aced48658dc526fd2c4286c6786a226cb41d701
MD5 a2e9cee566ebc5730a1e7fa1ac4afb82
BLAKE2b-256 9811eb4858c7cb068bb045826b3058cdd9d2bb77b2069e5f2a50dd1ca46b112e

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page