From 7bab6ba8d326a3d1f02efef04edd68d6df28b808 Mon Sep 17 00:00:00 2001 From: AakashGC Date: Fri, 8 Jul 2022 15:17:52 +1000 Subject: [PATCH] translations-test --- .../locales/es/LC_MESSAGES/proof.mo | Bin 440 -> 438 bytes .../locales/it/LC_MESSAGES/proof.mo | Bin 717 -> 719 bytes tests/test_locale_convert.py | 19 ++++++++++++++++++ 3 files changed, 19 insertions(+) create mode 100644 tests/test_locale_convert.py diff --git a/sphinx_proof/translations/locales/es/LC_MESSAGES/proof.mo b/sphinx_proof/translations/locales/es/LC_MESSAGES/proof.mo index 5d3fbc1b76201399efb47dbe3b718504462b2e18..e6c75055c74e97a53d540879d9d69790ad6f3ecf 100644 GIT binary patch delta 19 acmdnNyp4H62_x&qQfo%Gup_fe5*YwO90qX! delta 21 ccmdnSyn}f{2_yT)Qfo$zkktI5)Z9b{08NGlxBvhE diff --git a/sphinx_proof/translations/locales/it/LC_MESSAGES/proof.mo b/sphinx_proof/translations/locales/it/LC_MESSAGES/proof.mo index e8968d4a24d3a78f26d15948743c2fb8c90f0414..1a865d97d748c5c427d916f6746cd92e317b94dc 100644 GIT binary patch delta 117 zcmX@hdY*N{9A6#=28L871_llwT?C}Lfpj&HW(U&kK$;au_XBB=x~V{#3rH`5^4CJ? rT|gS7{`kh1ZH!Dssgv`WJVo=1i&Klr600)v^HLc?QuB*aa}yZ=-1!x- delta 114 zcmX@ldX{y<9A7R528L871_llwT>zxHfpjI1W(U%(K$;au_X24iAUzpKgVZm8@>fIY o9Y7kS{^-V+ZH$u(nLI`Pi;Gi>$`Y$G^Yc;}LQ?aKQgag-0Go0Yr2qf` diff --git a/tests/test_locale_convert.py b/tests/test_locale_convert.py new file mode 100644 index 0000000..51aa875 --- /dev/null +++ b/tests/test_locale_convert.py @@ -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")