[damned-lies] Set explicit doc language to itstool



commit 3b83d5a2392e00469998d2b03149a39d2098d912
Author: Claude Paroz <claude 2xlibre net>
Date:   Mon Sep 17 10:56:23 2018 +0200

    Set explicit doc language to itstool
    
    This way, common text like About or See also will be translated.

 vertimus/tests/tests.py | 5 +++++
 vertimus/views.py       | 3 ++-
 2 files changed, 7 insertions(+), 1 deletion(-)
---
diff --git a/vertimus/tests/tests.py b/vertimus/tests/tests.py
index 2587c684..d4a6e841 100644
--- a/vertimus/tests/tests.py
+++ b/vertimus/tests/tests.py
@@ -760,6 +760,11 @@ class VertimusTest(TeamsAndRolesTests):
             response, '/HTML/%d/index.html' % action.pk, fetch_redirect_response=False
         )
         self.assertEqual(action.build_url, '/HTML/%d/index.html' % action.pk)
+        index_file = Path(
+            settings.SCRATCHDIR, 'HTML', str(action.pk), 'index.html'
+        )
+        with index_file.open('r') as ifile:
+            self.assertIn('<h2><span class="title">À propos</span></h2>', ifile.read())
 
     def test_mysql(self):
         # Copied from test_action_undo() with minor changes
diff --git a/vertimus/views.py b/vertimus/views.py
index ba2fe9e2..728c0b3e 100644
--- a/vertimus/views.py
+++ b/vertimus/views.py
@@ -320,7 +320,8 @@ class BuildTranslatedDocsView(PoFileActionBase):
 
             sources = doc_format.source_files()
             result = subprocess.run([
-                'itstool', '-m', gmo.name, '-o', str(build_dir), '--strict',
+                'itstool', '-m', gmo.name, '-l', state.language.locale,
+                '-o', str(build_dir), '--strict',
                 *[str(s) for s in sources],
             ], cwd=str(doc_format.vcs_path), stderr=subprocess.PIPE)
             if result.returncode != 0:


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]