xpath-localizer


Namexpath-localizer JSON
Version 1.0.4 PyPI version JSON
download
home_page
SummaryXPATH internationalization and localization helper
upload_time2023-07-06 13:29:39
maintainer
docs_urlNone
authorShinichiro Kayano
requires_python
licenseMIT
keywords automation cicd internationalization localization playwright robot test xpath
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            ###################################################
xpath-localizer (a.k.a robotframework-localization)
###################################################
|license|
|Conventional Commits|

*************************************************************
Xpath Localizer Package
*************************************************************

xpath localizer contains the following tools which help you to internationalize
various web UI automation frameworks such as robotFramework and playwright, or any 
automation tools that use the XPATH for the web element locator.

xploc command
    - ``xploc``` command 
    - this is a test

robotLocalization 
    ``robotLocalization`` command is to be used with Variabes statement in the robot frame work.
    It provides ``get_variables`` function and loads variables from specified properties files.


- A python command (xploc) to localize properties files containing XPATH specification. 
- A python library (xploc) to load localized strings using a BCP-47 compliant language fallback.
- A python command (robotLocalization) to load **variables** from localized properties files 
  with the robot Variables statement.

============
Installation
============
robotLocalization can be installed with pip/pipenv:

.. code:: bash

    pip install xpath-localizer
    pipenv install xpath-localizer

=======================
Usage in robotFramework
=======================

robotLocalization is used to provide a ``get_variables`` function in the robotFramework.
The get_variables function can be used in the robot test case to load strings from
properties files by providing a language fallback mechanism. 

.. code-block:: properties

    # resources/sample.properties
    msg = Hello, World!

.. code-block:: properties

    # resources/sample_ja.properties
    msg = みなさん、こんにちは!

.. code-block:: robotframework

    #   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 properties files in the specified path list 
or files.  If the specified locale is not available, English properties 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 xploc command helps testers to internationalize robot test cases.  

**xploc** *operand* *file_patterns* *language-list* 

Analyze Mode
------------

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

.. code:: bash 

    xploc [*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 (robotFramework)
------------------------------

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 (robotFramework)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Specifies a robot test case to extract strings. 

\--output_bundle | --outb
^^^^^^^^^^^^^^^^^^^^^^^^^

Specifies a bundle file that can be used to store product properties into a single file. 
This option is only valid if *--use_bundle* option is enabled. 

\--output_properties | --outp
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

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 (robotFramework)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Specifies a robot file by internationalizing the robot file specified with --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 option checks the availability of strings in the specified product properties files.
If found, it uses strings there. 

\--multi_trans
^^^^^^^^^^^^^^

\--multi_trans options checks the translated value for locales specified with --bundle_locale option
and checks the multiple translations.   If a variant translation is found, it extends the xpath expression 
to use "OR" condition to check against all of the variant translations. 

\--playwright (robotFramework)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

\--playwright option checks the xpath specification for Playwright when externalizing the robot
variables.  This option is useful when a robotFramework is used with the Playwright for Python. 

\--xpath (playwright|pytest)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^

\--xpath options specified that the specified files contain XPATH strings only.  This option is useful
to create a properties file from an XPATH file.  The XPATH file is usually generated by using a 
test automation framework that uses XPATH expression when locating web elements. 

Dump Mode
---------

\--dump
^^^^^^^

\--dump option generates a list of all the variables loaded from properties files.  


.. |license| image:: https://img.shields.io/badge/license-MIT-blue.svg
.. |robotLocalization_icon| image:: robotLocalization.png
.. |Conventional Commits| image:: https://img.shields.io/badge/Conventional%20Commits-1.0.0-%23FE5196?logo=conventionalcommits&logoColor=white





            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "xpath-localizer",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "automation cicd internationalization localization playwright robot test xpath",
    "author": "Shinichiro Kayano",
    "author_email": "",
    "download_url": "https://files.pythonhosted.org/packages/c9/3c/67f62686fb02af7a99120050a15475854de4186badeae859713ad4b363f0/xpath-localizer-1.0.4.tar.gz",
    "platform": null,
    "description": "###################################################\nxpath-localizer (a.k.a robotframework-localization)\n###################################################\n|license|\n|Conventional Commits|\n\n*************************************************************\nXpath Localizer Package\n*************************************************************\n\nxpath localizer contains the following tools which help you to internationalize\nvarious web UI automation frameworks such as robotFramework and playwright, or any \nautomation tools that use the XPATH for the web element locator.\n\nxploc command\n    - ``xploc``` command \n    - this is a test\n\nrobotLocalization \n    ``robotLocalization`` command is to be used with Variabes statement in the robot frame work.\n    It provides ``get_variables`` function and loads variables from specified properties files.\n\n\n- A python command (xploc) to localize properties files containing XPATH specification. \n- A python library (xploc) to load localized strings using a BCP-47 compliant language fallback.\n- A python command (robotLocalization) to load **variables** from localized properties files \n  with the robot Variables statement.\n\n============\nInstallation\n============\nrobotLocalization can be installed with pip/pipenv:\n\n.. code:: bash\n\n    pip install xpath-localizer\n    pipenv install xpath-localizer\n\n=======================\nUsage in robotFramework\n=======================\n\nrobotLocalization is used to provide a ``get_variables`` function in the robotFramework.\nThe get_variables function can be used in the robot test case to load strings from\nproperties files by providing a language fallback mechanism. \n\n.. code-block:: properties\n\n    # resources/sample.properties\n    msg = Hello, World!\n\n.. code-block:: properties\n\n    # resources/sample_ja.properties\n    msg = \u307f\u306a\u3055\u3093\u3001\u3053\u3093\u306b\u3061\u306f!\n\n.. code-block:: robotframework\n\n    #   sample.robot\n    # \n    #   $ robot --variable language:en sample.robot\n    #   $ robot --variable language:ja sample.robot\n    #   \n    *** Settings ***\n    Library     SeleniumLibrary\n    Variables   robotLocalization     ${LANGUAGE}    resources/sample.properties    verbose=True\n\n    *** Variables ***\n    ${LANGUAGE}              en     # default LANGUAGE.  This can be replaced by --variable option.\n\n    *** Test Cases ***\n    Test Case 1\n        [Documentation]    robotLocalization Sample\n        Log To Console     ${msg}\n        Log Variables\n\nGetting variables from get_variables function\n***********************************************\n\nrobotLocalization provides ``get_variabes`` function which can be specified \nin the robot Variables statement. \n\nSyntax in robot test\n--------------------\n\nVariables   **robotLocalization**   *localeId*   *path or file list* *pathOptions*\n\n*localeId* specifies the locale or language of the properties being used.  It is used \nto load strings from properties files in properties files in the specified path list \nor files.  If the specified locale is not available, English properties will be used. \n\n*pathOptions*\n^^^^^^^^^^^^^\n\nverbose=            True or False\nfiletype=           file type\n\nExamples\n--------\nVariables   **robotLocalization**   en   ${PROJECT_REPO_PATH}\n\nAccessing variables from robot code. \n\nInternationalization Helper CLI \n********************************\n\nThe xploc command helps testers to internationalize robot test cases.  \n\n**xploc** *operand* *file_patterns* *language-list* \n\nAnalyze Mode\n------------\n\nIn the analyze mode, xploc CLI reports the localizable strings in the robot test and \ncandidates of available strings in existing properties files from properties files in the\nspecified path list. \n\n.. code:: bash \n\n    xploc [*path list()] --analyze [*robot_file*]\n\n\\--analyze\n^^^^^^^^^^^\nSpecifies a robot test case.  Typically, this robot file contains Xpath specifications\nwith UI elements or robot variable specifications used in other keywords. \n\nExtract Mode (robotFramework)\n------------------------------\n\nThe extract mode is used to extract strings from a specified robot file.  \nIt also generates internationalized robot files by replacing localizable strings\nwith variables references. \n\n\\--extract (robotFramework)\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^\nSpecifies a robot test case to extract strings. \n\n\\--output_bundle | --outb\n^^^^^^^^^^^^^^^^^^^^^^^^^\n\nSpecifies a bundle file that can be used to store product properties into a single file. \nThis option is only valid if *--use_bundle* option is enabled. \n\n\\--output_properties | --outp\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\nSpecifies a properties file to store localizable strings. If *--use_bundle* is specified,\nonly strings not available in product properties files are stored.  \n\n\\--output_robot | --outr (robotFramework)\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\nSpecifies a robot file by internationalizing the robot file specified with --extract option.\nAll localizable strings will be replaced by variable references.  A string with \"# i18n:OK \"\ncomments are ignored. \n\n\\--use_bundle | --use_keys\n^^^^^^^^^^^^^^^^^^^^^^^^^^\n\n--use_bundle option checks the availability of strings in the specified product properties files.\nIf found, it uses strings there. \n\n\\--multi_trans\n^^^^^^^^^^^^^^\n\n\\--multi_trans options checks the translated value for locales specified with --bundle_locale option\nand checks the multiple translations.   If a variant translation is found, it extends the xpath expression \nto use \"OR\" condition to check against all of the variant translations. \n\n\\--playwright (robotFramework)\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\n\\--playwright option checks the xpath specification for Playwright when externalizing the robot\nvariables.  This option is useful when a robotFramework is used with the Playwright for Python. \n\n\\--xpath (playwright|pytest)\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\n\\--xpath options specified that the specified files contain XPATH strings only.  This option is useful\nto create a properties file from an XPATH file.  The XPATH file is usually generated by using a \ntest automation framework that uses XPATH expression when locating web elements. \n\nDump Mode\n---------\n\n\\--dump\n^^^^^^^\n\n\\--dump option generates a list of all the variables loaded from properties files.  \n\n\n.. |license| image:: https://img.shields.io/badge/license-MIT-blue.svg\n.. |robotLocalization_icon| image:: robotLocalization.png\n.. |Conventional Commits| image:: https://img.shields.io/badge/Conventional%20Commits-1.0.0-%23FE5196?logo=conventionalcommits&logoColor=white\n\n\n\n\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "XPATH internationalization and localization helper",
    "version": "1.0.4",
    "project_urls": null,
    "split_keywords": [
        "automation",
        "cicd",
        "internationalization",
        "localization",
        "playwright",
        "robot",
        "test",
        "xpath"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "8ac14d2de80cdfa08797065f7e0967063194a805f9a177e1a17a63e8cf69c446",
                "md5": "fc2d6ad0a1145b644cc8f332dbf71512",
                "sha256": "d8bef47b2d08b8e81cc220cfe500e7058702bcb2022fc977b72a08c0ee2f29c4"
            },
            "downloads": -1,
            "filename": "xpath_localizer-1.0.4-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "fc2d6ad0a1145b644cc8f332dbf71512",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 22907,
            "upload_time": "2023-07-06T13:29:37",
            "upload_time_iso_8601": "2023-07-06T13:29:37.883305Z",
            "url": "https://files.pythonhosted.org/packages/8a/c1/4d2de80cdfa08797065f7e0967063194a805f9a177e1a17a63e8cf69c446/xpath_localizer-1.0.4-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "c93c67f62686fb02af7a99120050a15475854de4186badeae859713ad4b363f0",
                "md5": "197bd2de62200eecbfb94d326ef7a7bb",
                "sha256": "1ac69858ff89bfe9ad9e454ed3f992b5d1d180f211ddb56f147ec12f8310917c"
            },
            "downloads": -1,
            "filename": "xpath-localizer-1.0.4.tar.gz",
            "has_sig": false,
            "md5_digest": "197bd2de62200eecbfb94d326ef7a7bb",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 21787,
            "upload_time": "2023-07-06T13:29:39",
            "upload_time_iso_8601": "2023-07-06T13:29:39.251990Z",
            "url": "https://files.pythonhosted.org/packages/c9/3c/67f62686fb02af7a99120050a15475854de4186badeae859713ad4b363f0/xpath-localizer-1.0.4.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-07-06 13:29:39",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "xpath-localizer"
}
        
Elapsed time: 0.08359s