-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
1,075 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import json | ||
from pathlib import Path | ||
|
||
from robot.api import logger | ||
|
||
|
||
def compare_translations(file: Path): | ||
with Path(__file__).parent.parent.joinpath( | ||
"robotframework_seleniumlibrary_translation_fi", "translation.json" | ||
).open("r") as file_object: | ||
expected_data = json.load(file_object) | ||
expected_keywords = [kw["name"] for kw in expected_data.values()] | ||
logger.info(f"expected_keywords: {expected_keywords}") | ||
with file.open("r") as file_object: | ||
data = json.load(file_object) | ||
keywords = data["keywords"] | ||
for keyword in keywords: | ||
logger.info(keyword) | ||
name = keyword["name"] | ||
name = name.replace(" ", "_").lower() | ||
assert name in expected_keywords, f"name '{name}' not in {expected_keywords}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
*** Settings *** | ||
Library Browser language=FI | ||
Library Process | ||
Library OperatingSystem | ||
Library json_lib.py | ||
|
||
*** Test Cases *** | ||
Translation Works With Translation | ||
Uusi Sivu https://github.com/MarketSquare/robotframework-browser-translation-fi | ||
|
||
LibDoc Works With Translation | ||
[Setup] Remove File ${CURDIR}/Browser.json | ||
${json_kw_speck} = Join Path ${CURDIR} Browser.json | ||
${cmd} = Join Command Line | ||
... python | ||
... -m | ||
... robot.libdoc | ||
... --format=json | ||
... Browser::language=FI | ||
... ${json_kw_speck} | ||
Run Process ${cmd} shell=True | ||
Compare Translations ${json_kw_speck} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# Copyright 2024- Robot Framework Foundation | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
from pathlib import Path | ||
from typing import TypedDict | ||
|
||
__version__ = "0.1.0" | ||
|
||
|
||
class Language(TypedDict): | ||
language: str | ||
path: str | ||
|
||
|
||
def get_language() -> Language: | ||
folder = Path(__file__).parent | ||
|
||
return {"language": "fi", "path": str(folder / "translation.json")} |
Oops, something went wrong.