Commit 7e5d68ae authored by sampaioprimo's avatar sampaioprimo

remove variables from strings to be able to translate

parent 3b5abb10
......@@ -133,7 +133,7 @@ class LanguageTranslations extends TikiDb_Bridge
if ($lastStr === FALSE) {
// file has no line with "###end###\"=>\"###end###\") marking the end of the array
throw new Language_Exception(tra("The file lang/$this->lang/language.php is not well formated. Run get_strings.php?lang=$this->lang and then try to export the translations again."));
throw new Language_Exception(tr("The file lang/%0/language.php is not well formated. Run get_strings.php?lang=%0 and then try to export the translations again.", $this->lang));
}
// foreach translation in the database check each string in the language.php file
......
......@@ -58,7 +58,7 @@ class UserPayCredits extends CreditsLib
}
$credits_amount = $amount * $this->credits[$creditType]['xcrate'];
if ($this->useCredits($userId, $creditType, $credits_amount)) {
$msg = tr("Tiki credits payment done on %0 for $amount (using $creditType)", $tikilib->get_short_datetime($tikilib->now));
$msg = tr("Tiki credits payment done on %0 for %1 (using %2)", $tikilib->get_short_datetime($tikilib->now), $amount, $creditType);
$paymentlib->enter_payment( $invoice, $amount, 'tikicredits', array('info' => $msg, 'username' => $user, 'creditType' => $creditType, 'creditAmount' => $credits_amount));
return true;
} else {
......
......@@ -434,7 +434,7 @@ function prefs_global_list($partial = false) {
'kuser' => array(
'name' => tra('Kaltura "User"'),
'description' => tra('Owner of content shared by all Tiki users on this site. If empty then each Tiki user can only see their own media entries.'),
'hint' => tra("You could use your server name for this. e.g. $url_host"),
'hint' => tr("You could use your server name for this. e.g. %0", $url_host),
'type' => 'text',
'size' => 20,
'default' => $url_host,
......
......@@ -132,9 +132,19 @@ class reportsLib extends TikiLib
} elseif ($change['event']=="category_changed") {
if ($change['data']['action']=="object entered category") {
$body .= "<u>".$change['data']['user']."</u> ".tra("added the ".$change['data']['objectType'])." <a href=\"$tikiUrl/".$change['data']['objectUrl']."\">".$change['data']['objectName']."</a> ".tra("to the category")." <a href=\"$tikiUrl/tiki-browse_categories.php?parentId=".$change['data']['categoryId']."&deep=off\">".$change['data']['categoryName']."</a>.";
$body .= "<u>".$change['data']['user']."</u> ".
tr("added the %0 %1 to the category %2",
$change['data']['objectType'],
"<a href=\"$tikiUrl/{$change['data']['objectUrl']}\">{$change['data']['objectName']}</a>",
"<a href=\"$tikiUrl/tiki-browse_categories.php?parentId={$change['data']['categoryId']}&deep=off\">{$change['data']['categoryName']}</a>"
);
} elseif ($change['data']['action']=="object leaved category") {
$body .= "<u>".$change['data']['user']."</u> ".tra("removed the ".$change['data']['objectType'])." <a href=\"$tikiUrl/".$change['data']['objectUrl']."\">".$change['data']['objectName']."</a> ".tra("from the category")." <a href=\"$tikiUrl/tiki-browse_categories.php?parentId=".$change['data']['categoryId']."&deep=off\">".$change['data']['categoryName']."</a>.";
$body .= "<u>".$change['data']['user']."</u> ".
tr("removed the %0 %1 from the category",
$change['data']['objectType'],
"<a href=\"$tikiUrl/{$change['data']['objectUrl']}\">{$change['data']['objectName']}</a>",
"<a href=\"$tikiUrl/tiki-browse_categories.php?parentId={$change['data']['categoryId']}&deep=off\">{$change['data']['categoryName']}</a>."
);
} elseif ($change['data']['action']=="category created") {
$body .= "<u>".$change['data']['user']."</u> ".tra("created the subcategory")." <a href=\"$tikiUrl/tiki-browse_categories.php?parentId=".$change['data']['categoryId']."&deep=off\">".$change['data']['categoryName']."</a> ".tra("in")." <a href=\"$tikiUrl/tiki-browse_categories.php?parentId=".$change['data']['parentId']."&deep=off\">".$change['data']['parentName']."</a>.";
} elseif ($change['data']['action']=="category removed") {
......
......@@ -154,10 +154,10 @@ function smarty_block_pagination_links($params, $url, &$smarty, $repeat) {
// Handle next/prev images
if ( $params['noimg'] == 'n' ) {
$tmp = array(
'first' => tra("First {$params['itemname']}"),
'last' => tra("Last {$params['itemname']}"),
'next' => tra("Next {$params['itemname']}"),
'previous' => tra("Prev {$params['itemname']}"),
'first' => tr("First %0", $params['itemname']),
'last' => tr("Last %0", $params['itemname']),
'next' => tr("Next %0", $params['itemname']),
'previous' => tr("Prev %0", $params['itemname']),
'next_fast' => tra('Fast Next'),
'previous_fast' => tra('Fast Prev'),
);
......
......@@ -7153,8 +7153,8 @@ if( \$('#$id') ) {
$object = $objectlib->get_object($context['type'], $context['object']);
$mail = new TikiMail(null, $prefs['sender_email']);
$mail->setSubject(tra("Plugin $plugin_name pending approval"));
$mail->setHtml(tra("Plugin $plugin_name is pending approval on <a href='$base_url{$object['href']}'>{$object['name']}</a>"));
$mail->setSubject(tr("Plugin %0 pending approval", $plugin_name));
$mail->setHtml(tr("Plugin %0 is pending approval on %1", $plugin_name, "<a href='$base_url{$object['href']}'>{$object['name']}</a>"));
$allGroups = $userlib->get_groups();
$accessor = Perms::get($context);
......
......@@ -627,7 +627,7 @@ function wikiplugin_tracker($data, $params)
$page_badchars = "/[:\/?#\[\]@!$&'()*+,;=<>]/";
$matches = preg_match($page_badchars, $newpagename);
if ($matches) {
$field_errors['err_outputwiki'] = tra("The page to output the results to contains the following prohibited characters: $page_badchars_display. Try another name.");
$field_errors['err_outputwiki'] = tr("The page to output the results to contains the following prohibited characters: %0. Try another name.", $page_badchars_display);
}
} else {
unset($outputtowiki);
......
......@@ -71,7 +71,7 @@ else {
$date_field = substr($date_field, 0, COLUMN_MAXLEN);
}
if (!is_numeric($tab_id)) {
print tra("ERROR: Invalid tab_id received. Numeric format expected, got $tab_id.");
print tr("ERROR: Invalid tab_id received. Numeric format expected, got %0.", $tab_id);
die;
}
......
......@@ -453,7 +453,7 @@ if (isset($_REQUEST['page'])) {
if (!$helpUrl) {
$helpUrl = ucfirst($adminPage) . '+Config';
}
$helpDescription = "Help on $admintitle Config"; //get_strings tra("Help on $admintitle Config")
$helpDescription = tr("Help on %0 Config", $admintitle);
} else {
$smarty->assign('admintitle', 'Admin Home');
......
......@@ -30,7 +30,7 @@ if (isset($_REQUEST["metric_submit"])) {
die;
}
if (strlen($_REQUEST["metric_name"]) > $prefs['metrics_metric_name_length']) {
$smarty->assign('msg',tra("Cannot create or update metric: Metric name must be under " . $prefs['metrics_metric_name_length'] . " characters in length."));
$smarty->assign('msg',tr("Cannot create or update metric: Metric name must be under %0 characters in length.", $prefs['metrics_metric_name_length']));
$smarty->display("error.tpl");
die;
}
......@@ -79,7 +79,7 @@ if (isset($_REQUEST["tab_submit"])) {
die;
}
if (strlen($_REQUEST["tab_name"]) > $prefs['metrics_tab_name_length']) {
$smarty->assign('msg',tra("Cannot create or update tab: Tab name must be under " . $prefs['metrics_tab_name_length'] . " characters in length."));
$smarty->assign('msg',tr("Cannot create or update tab: Tab name must be under %0 characters in length.", $prefs['metrics_tab_name_length']));
$smarty->display("error.tpl");
die;
}
......
......@@ -66,8 +66,8 @@ if (isset($_REQUEST['create'])) {
$top = $_REQUEST['top'];
$output = '';
$output .= tra('TikiHelp WebHelp generation engine. Generating WebHelp using:');
$output .= '<ul><li>' . tra("Index: <strong>$name</strong>") . '</li>';
$output .= '<li>' . tra("Directory: <strong>$dir</strong>") . '</li></ul>';
$output .= '<ul><li>' . tr("Index: <strong>%0</strong>", $name) . '</li>';
$output .= '<li>' . tr("Directory: <strong>%0</strong>", $dir) . '</li></ul>';
$base = "whelp/$dir";
if (!is_writeable('whelp')) {
......@@ -77,7 +77,7 @@ if (isset($_REQUEST['create'])) {
}
if(!is_dir("whelp/$dir")) {
$output .= '<p>' . tra("Creating directory structure in <strong>$base</strong>.") . '</p>';
$output .= '<p>' . tr("Creating directory structure in <strong>%0</strong>.", $base) . '</p>';
mkdir("whelp/$dir");
mkdir("$base/js");
mkdir("$base/css");
......
......@@ -14,7 +14,7 @@ if ($prefs['feed_directories'] != 'y') {
require_once ('tiki-rss_error.php');
}
if ($prefs['feature_directory'] != 'y') {
$errmsg = tra("This feature is disabled") . ": feature_directory";
$errmsg = tr("This feature is disabled: %0", 'feature_directory');
require_once ('tiki-rss_error.php');
}
if ($tiki_p_view_directory != 'y') {
......@@ -32,7 +32,7 @@ $output = $rsslib->get_from_cache($uniqueid);
if ($output["data"] == "EMPTY") {
$title = tra("Tiki RSS feed for directory sites");
$rc = $dirlib->dir_get_category($_REQUEST["parent"]);
$desc = tra("Last sites of directory " . $rc["name"] . " .");
$desc = tr("Last sites of directory %0.", $rc["name"]);
$id = "siteId";
$titleId = "name";
$descId = "description";
......
......@@ -34,7 +34,7 @@ if (!isset($prefs['map_path']) or !$prefs['map_path']) {
die;
}
if (!is_dir($prefs['map_path'])) {
$smarty->assign('msg', tra('Please create a directory named ' . $prefs['map_path'] . ' to hold your map files.'));
$smarty->assign('msg', tr('Please create a directory named %0 to hold your map files.', $prefs['map_path']));
$smarty->display('error.tpl');
die;
}
......
......@@ -31,7 +31,7 @@ if (!isset($prefs['map_path']) or !$prefs['map_path']) {
die;
}
if (!is_dir($prefs['map_path'])) {
$smarty->assign('msg', tra('Please create a directory named ' . $prefs['map_path'] . ' to hold your map files.'));
$smarty->assign('msg', tr('Please create a directory named %0 to hold your map files.', $prefs['map_path']));
$smarty->display('error.tpl');
die;
}
......
......@@ -9,7 +9,7 @@ require_once ('tiki-setup.php');
$access->check_feature('feature_maps');
$access->check_permission('tiki_p_map_edit');
if (!is_dir($prefs['map_path'])) {
$smarty->assign('msg', tra('Please create a directory named ' . $prefs['map_path'] . ' to hold your map files.'));
$smarty->assign('msg', tr('Please create a directory named %0 to hold your map files.', $prefs['map_path']));
$smarty->display('error.tpl');
die;
}
......
......@@ -329,7 +329,7 @@ case 'glossary':
$indexPages[] = array(
'key' => $key,
'indextitle' => tra('Index (' . $code . ')'),
'indextitle' => tr('Index (%0)', $code),
'options' => array(
'decorator' => 'indexrow',
'display' => 'title',
......
......@@ -7,7 +7,7 @@
$access->check_script($_SERVER["SCRIPT_NAME"], basename(__FILE__));
$feed = tra("Error Message");
$title = tra("Tiki RSS Feed Error Message: $errmsg");
$title = tr("Tiki RSS Feed Error Message: %0", $errmsg);
$desc = $errmsg;
$id = "errorMessage";
$titleId = "title";
......
......@@ -19,7 +19,7 @@ if ($_REQUEST["msgId"]) {
$info = $shoutboxlib->get_shoutbox($_REQUEST["msgId"]);
$owner = $info["user"];
if ($tiki_p_admin_shoutbox != 'y' && $owner != $user) {
$smarty->assign('msg', tra("You do not have permission to edit messages $owner"));
$smarty->assign('msg', tr("You do not have permission to edit messages %0", $owner));
$smarty->display("error.tpl");
die;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment