From: Marcin Haba Date: Fri, 28 Jan 2022 05:18:32 +0000 (+0100) Subject: baculum: Add capability to provide translated directive documentation file X-Git-Tag: Release-11.3.2~113 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=63a10dfc363d679ef827c4c4b08232a789d9e166;p=thirdparty%2Fbacula.git baculum: Add capability to provide translated directive documentation file --- diff --git a/gui/baculum/protected/Web/Class/DirectiveDoc.php b/gui/baculum/protected/Web/Class/DirectiveDoc.php index 87f56940a..82fcca36a 100644 --- a/gui/baculum/protected/Web/Class/DirectiveDoc.php +++ b/gui/baculum/protected/Web/Class/DirectiveDoc.php @@ -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;