Jump to content

Connect SuperML | Leeroopedia MCP: Equip your AI agents with best practices, code verification, and debugging knowledge. Powered by Leeroo — building Organizational Superintelligence. Contact us at founders@leeroo.com.

Implementation:MarketSquare Robotframework browser Translation CLI

From Leeroopedia
Revision as of 11:30, 16 February 2026 by Admin (talk | contribs) (Auto-imported from implementations/MarketSquare_Robotframework_browser_Translation_CLI.md)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Knowledge Sources
Domains CLI, Translation
Last Updated 2026-02-12 05:40 GMT

Overview

Backend module for the rfbrowser translation CLI command that generates default translation JSON templates and compares translation status against the current library keywords.

Description

The translation module provides module-level functions used by the Browser library CLI entry point. It builds a dictionary of all library keyword names, their docstrings, and SHA-256 checksums of those docstrings. The compare_translation function loads an existing project translation JSON file and compares it against the live library translation, producing a formatted table that highlights keywords with missing translations, missing checksums, changed documentation, or keywords that no longer exist in the library. Helper functions _get_heading, _table_doc_updated, and _max_kw_name_lenght handle the table formatting logic. The get_library_translation function instantiates the Browser library (with optional plugins and JS extensions) and iterates over all keyword attributes, including __init__ and __intro__ entries, to produce the complete translation dictionary.

Usage

Use this module when you need to generate a fresh translation JSON template for localizing Browser library keywords, or when you need to check whether an existing translation file is up to date with the current library version. It is invoked via the rfbrowser translation CLI command.

Code Reference

Source Location

Signature

def get_library_translation(
    plugings: str | None = None, jsextension: str | None = None
) -> dict:

def compare_translation(filename: Path, library_translation: dict):

def _max_kw_name_lenght(project_tanslation: dict) -> int:

def _get_heading(max_kw_lenght: int) -> list[str]:

def _table_doc_updated(lib_kw: str, max_name_lenght: int, reason: str) -> str:

Import

from Browser.entry.translation import get_library_translation, compare_translation

I/O Contract

Inputs

Name Type Required Description
plugings str or None No Plugin string passed to the Browser library constructor for loading custom plugins.
jsextension str or None No Path to a JavaScript extension file for the Browser library.
filename Path Yes (for compare_translation) Path to the project translation JSON file to compare against the library.
library_translation dict Yes (for compare_translation) Dictionary of the current library keyword translations produced by get_library_translation.

Outputs

Name Type Description
translation dict Dictionary mapping keyword names to their name, doc, and sha256 checksum (from get_library_translation).
table list[str] Formatted table lines showing translation discrepancies, or an empty list if all translations are current (from compare_translation).

Usage Examples

Robot Framework

*** Test Cases ***
Generate Translation Template Via CLI
    [Documentation]    This is invoked via the command line, not directly as a keyword.
    [Tags]    cli
    # From the command line:
    # rfbrowser translation --output translation.json
    # rfbrowser translation --compare translation.json
    Log    Translation CLI is used from the command line, not as a Robot Framework keyword.

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment