Skip to content

Commit

Permalink
TEST: Added test for translations #83
Browse files Browse the repository at this point in the history
  • Loading branch information
AakashGfude authored Jul 8, 2022
1 parent c6c09df commit 16ae061
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 0 deletions.
Binary file modified sphinx_proof/translations/locales/es/LC_MESSAGES/proof.mo
Binary file not shown.
Binary file modified sphinx_proof/translations/locales/it/LC_MESSAGES/proof.mo
Binary file not shown.
19 changes: 19 additions & 0 deletions tests/test_locale_convert.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
from sphinx_proof.translations._convert import convert_json


def test_convert(tmp_path, monkeypatch):
# Generate folder structures needed
path_translation = tmp_path / "translations"
path_jsons = path_translation / "jsons"
path_compiled = path_translation / "locales"
path_jsons.mkdir(parents=True)
(path_jsons / "test.json").write_text(
'[{"language":"English","symbol":"en","text":"Text"},'
'{"language":"Other","symbol":"ot","text":"Translate"}]'
)
monkeypatch.setattr("subprocess.check_call", lambda args: None)
convert_json(path_translation)
assert (path_compiled / "ot").exists()
path_lc = path_compiled / "ot" / "LC_MESSAGES"
assert (path_lc / "proof.po").exists()
assert "Translate" in (path_lc / "proof.po").read_text("utf8")

0 comments on commit 16ae061

Please sign in to comment.