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.0.6~20 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b2fcda02c1c9772d64aef924e6b77eb9d4e8a325;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;