]> git.ipfire.org Git - thirdparty/bacula.git/commitdiff
baculum: Add capability to provide translated directive documentation file
authorMarcin Haba <marcin.haba@bacula.pl>
Fri, 28 Jan 2022 05:18:32 +0000 (06:18 +0100)
committerEric Bollengier <eric@baculasystems.com>
Thu, 24 Mar 2022 08:03:27 +0000 (09:03 +0100)
gui/baculum/protected/Web/Class/DirectiveDoc.php

index 87f56940a00c86a1bcbbb5d241d5b874863c32ab..82fcca36aba9a2f9fdce0d4b103b1b8e394be253 100644 (file)
@@ -63,9 +63,16 @@ class DirectiveDoc extends WebModule {
                        $resource_type = 'Job';
                }
 
-               $doc = '';
-               $doc_file = Prado::getPathOfNamespace(self::DOC_PATH, self::DOC_EXT);
-               if (is_null(self::$dom) && file_exists($doc_file)) {
+               $doc = $doc_file = '';
+               $lang = $this->getModule('web_config')->getLanguage();
+               $doc_lang_file = Prado::getPathOfNamespace(self::DOC_PATH . '_' . $lang, self::DOC_EXT);
+               $doc_en_file = Prado::getPathOfNamespace(self::DOC_PATH, self::DOC_EXT);
+               if (file_exists($doc_lang_file)) {
+                       $doc_file = $doc_lang_file;
+               } elseif (file_exists($doc_en_file)) {
+                       $doc_file = $doc_en_file;
+               }
+               if (is_null(self::$dom) && !empty($doc_file)) {
                        $dom = new DOMDocument();
                        $dom->loadHTMLFile($doc_file);
                        self::$dom = $dom;