コード例 #1
0
 /**
  * load the activated translation from mediboard (used to compare with the sql one)
  *
  * @param array $locales the locales array
  *
  * @return string
  */
 function loadOldTranslation($locales = array())
 {
     if (!count($locales)) {
         $locales = array();
         $locale = CAppUI::pref("LOCALE", "fr");
         foreach (CAppUI::getLocaleFilesPaths($locale) as $_path) {
             include_once $_path;
         }
     }
     return $this->_old_translation = isset($locales[$this->source]) ? $locales[$this->source] : "";
 }
コード例 #2
0
/**
 * $Id$
 *
 * @package    Mediboard
 * @subpackage System
 * @author     SARL OpenXtrem <*****@*****.**>
 * @license    GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 * @version    $Revision$
 */
global $version;
CCanDo::checkEdit();
/////////// Locales
foreach (glob("locales/*", GLOB_ONLYDIR) as $localeDir) {
    $localeName = basename($localeDir);
    $locales = array();
    $localeFiles = CAppUI::getLocaleFilesPaths($localeName);
    foreach ($localeFiles as $localeFile) {
        if (basename($localeFile) != "meta.php") {
            include $localeFile;
        }
    }
    $locales = CMbString::filterEmpty($locales);
    foreach ($locales as &$_locale) {
        $_locale = CMbString::unslash($_locale);
    }
    $path = "./tmp/locales-{$localeName}.js";
    if (!is_file($path)) {
        CAppUI::stepAjax("Locales-javascript-cache-none", UI_MSG_OK, $localeName);
        continue;
    }
    $fp = fopen($path, 'r');
コード例 #3
0
 * Overwrite translation for the instance
 *
 * $Id$
 *
 * @package    Mediboard
 * @subpackage System
 * @author     SARL OpenXtrem <*****@*****.**>
 * @license    GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 * @version    $Revision$
 */
CCanDo::checkEdit();
$locales = CAppUI::flattenCachedLocales(CAppUI::$lang);
$in_use_locales = $locales;
//load old locales
$locale = CAppUI::pref("LOCALE", "fr");
foreach (CAppUI::getLocaleFilesPaths($locale) as $_path) {
    include_once $_path;
}
$locales = CMbString::filterEmpty($locales);
foreach ($locales as &$_locale) {
    $_locale = CMbString::unslash($_locale);
}
//get the list of translations made
$translation = new CTranslationOverwrite();
$translations_bdd = $translation->loadList();
/** @var CTranslationOverwrite[] $translations_bdd */
foreach ($translations_bdd as $_translation) {
    $_translation->loadOldTranslation($locales);
    $_translation->checkInCache();
}
//smarty