$smarty->assign('only_db_untranslated', 'y');
} else {
	$smarty->assign('only_db_untranslated', 'n');
}

// Adding strings
if (isset($_REQUEST["add_tran"])) {
	check_ticket('edit-languages');
	$add_tran_source = $_REQUEST["add_tran_source"];
	$add_tran_tran = $_REQUEST["add_tran_tran"];

	if (strlen($add_tran_source) != 0 && strlen($add_tran_tran) != 0) {
		$add_tran_source = strip_tags($add_tran_source);
		$add_tran_tran = strip_tags($add_tran_tran);

		$translations->updateTrans($add_tran_source, $add_tran_tran);
	}
}

// Delete all db translations
if (isset($_REQUEST['delete_all']) && $tiki_p_admin) {
	$translations->deleteTranslations();
}

//Selection for untranslated Strings and edit translations
if (isset($_REQUEST["action"])) {
	$action = $_REQUEST["action"];
} else {
	$action = "";
}
 public function testUpdateTransShouldIgnoreWhenSourceAndTranslationAreEqual()
 {
     $this->obj->updateTrans('Source and translation are the same', 'Source and translation are the same');
     $result = TikiDb::get()->getOne('SELECT `source` FROM `tiki_language` WHERE `lang` = ? AND `source` = ?', array($this->lang, 'Source and translation are the same'));
     $this->assertFalse($result);
 }
예제 #3
0
 * @package tikiwiki
 */
// (c) Copyright 2002-2015 by authors of the Tiki Wiki CMS Groupware Project
//
// All Rights Reserved. See copyright.txt for details and a complete list of authors.
// Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details.
// $Id$
require_once 'tiki-setup.php';
require_once 'lib/language/LanguageTranslations.php';
$access->check_feature('lang_use_db');
$access->check_permission('tiki_p_edit_languages');
// start interactive translation session
if (!empty($_REQUEST['interactive_translation_mode'])) {
    $_SESSION['interactive_translation_mode'] = $_REQUEST['interactive_translation_mode'];
    if ($_REQUEST['interactive_translation_mode'] == 'off') {
        $cachelib->empty_cache('templates_c');
    }
    header('Location: ' . $_SESSION['last_mid_php']);
    exit;
}
/* Called by the JQuery ajax request. No response expected.
 * Save strings translated using interactive translation to database.
 */
if (isset($_REQUEST['source'], $_REQUEST['trans']) && count($_REQUEST['source']) == count($_REQUEST['trans'])) {
    $translations = new LanguageTranslations();
    foreach ($_REQUEST['trans'] as $k => $translation) {
        $source = $_REQUEST['source'][$k];
        $translations->updateTrans($source, $translation);
    }
    exit;
}