seeddms-code/inc/inc.Language.php
2025-11-16 17:47:48 +01:00

178 lines
6.0 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
// MyDMS. Document Management System
// Copyright (C) 2002-2005 Markus Westphal
// Copyright (C) 2006-2008 Malcolm Cowe
// Copyright (C) 2010-2013 Uwe Steinmann
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
use Seeddms\Seeddms\Translator;
$translator = new Translator($settings);
$translator->init();
/* All remaining functions in this file are deprecated and should
* not be used anymore. Use instead the equivalent methods in class
* Translator;
*/
function getAvailableLanguages() { /* {{{ */
trigger_error("getAvailableLanguages() is deprecated.", E_USER_DEPRECATED);
foreach(debug_backtrace() as $n) {
trigger_error($n['file'].": Line ".$n['line'], E_USER_DEPRECATED);
}
return $GLOBALS['settings']->getAvailableLanguages();
} /* }}} */
function getLanguages() { /* {{{ */
trigger_error("getLanguages() is deprecated.", E_USER_DEPRECATED);
foreach(debug_backtrace() as $n) {
trigger_error($n['file'].": Line ".$n['line'], E_USER_DEPRECATED);
}
return $GLOBALS['settings']->getLanguages();
} /* }}} */
/**
* Get translation
*
* Returns the translation for a given key. It will replace markers
* in the form [xxx] with those elements from the array $replace.
* A default text can be gіven for the case, that there is no translation
* available. The fourth parameter can override the currently set language
* in the session or the default language from the configuration.
*
* @param string $key key of translation text
* @param array $replace list of values that replace markers in the text
* @param string $defaulttext text used if no translation can be found
* @param string $lang use this language instead of the currently set lang
*/
function getMLText($key, $replace = array(), $defaulttext = null, $lang="") { /* {{{ */
// trigger_error("getMLText() is deprecated.", E_USER_DEPRECATED);
// foreach(debug_backtrace() as $n) {
// trigger_error($n['file'].": Line ".$n['line'], E_USER_DEPRECATED);
// }
return $GLOBALS['translator']->translate($key, $replace, $defaulttext, $lang);
} /* }}} */
function printMLText($key, $replace = array(), $defaulttext = null, $lang="") { /* {{{ */
$GLOBALS['translator']->print($key, $replace, $defaulttext, $lang);
}
/* }}} */
function printReviewStatusText($status, $date=0) { /* {{{ */
$GLOBALS['translator']->printReviewStatusText($status, $date);
} /* }}} */
function getReviewStatusText($status, $date=0) { /* {{{ */
return $GLOBALS['translator']->getReviewStatusText($status, $date);
} /* }}} */
function printReceiptStatusText($status, $date=0) { /* {{{ */
print getReceiptStatusText($status, $date);
} /* }}} */
function getReceiptStatusText($status, $date=0) { /* {{{ */
if (is_null($status)) {
return getMLText("status_unknown");
}
else {
switch ($status) {
case -2:
return getMLText("status_recipient_removed");
break;
case -1:
return getMLText("status_receipt_rejected").($date !=0 ? " ".$date : "");
break;
case 0:
return getMLText("status_not_receipted");
break;
case 1:
return getMLText("status_receipted").($date !=0 ? " ".$date : "");
break;
default:
return getMLText("status_unknown");
break;
}
}
} /* }}} */
function printRevisionStatusText($status, $date=0) { /* {{{ */
print getRevisionStatusText($status, $date);
} /* }}} */
function getRevisionStatusText($status, $date=0) { /* {{{ */
if (is_null($status)) {
return getMLText("status_unknown");
}
else {
switch ($status) {
case -3:
return getMLText("status_revision_sleeping");
break;
case -2:
return getMLText("status_revisor_removed");
break;
case -1:
return getMLText("status_needs_correction").($date !=0 ? " ".$date : "");
return getMLText("status_revision_rejected").($date !=0 ? " ".$date : "");
break;
case 0:
return getMLText("status_not_revised");
break;
case 1:
return getMLText("status_revised").($date !=0 ? " ".$date : "");
break;
default:
return getMLText("status_unknown");
break;
}
}
} /* }}} */
function printApprovalStatusText($status, $date=0) { /* {{{ */
$GLOBALS['translator']->printApprovalStatusText($status, $date);
} /* }}} */
function getApprovalStatusText($status, $date=0) { /* {{{ */
return $GLOBALS['translator']->getApprovalStatusText($status, $date);
} /* }}} */
function printOverallStatusText($status) { /* {{{ */
$GLOBALS['translator']->printOverallStatusText($status);
} /* }}} */
function getOverallStatusText($status) { /* {{{ */
return $GLOBALS['translator']->getOverallStatusText($status);
} /* }}} */
function getAttributeTypeText($attrdef) { /* {{{ */
return $GLOBALS['translator']->getAttributeTypeText($attrdef);
} /* }}} */
function getAttributeObjectTypeText($attrdef) { /* {{{ */
return $GLOBALS['translator']->getAttributeObjectTypeText($attrdef);
} /* }}} */
function getAttributeValidationText($error, $attrname='', $attrvalue='', $regex='') { /* {{{ */
return $GLOBALS['translator']->getAttributeValidationText($error, $attrname, $attrvalue, $regex);
} /* }}} */
function getAttributeValidationError($error, $attrname='', $attrvalue='', $regex='') { /* {{{ */
return $GLOBALS['translator']->getAttributeValidationText($error, $attrname, $attrvalue, $regex);
} /* }}} */