mirror of
https://github.com/e107inc/e107.git
synced 2025-08-06 14:46:56 +02:00
Language file cleanup
This commit is contained in:
@@ -59,6 +59,7 @@ function nextprev_shortcode($parm = '')
|
|||||||
{
|
{
|
||||||
$e107 = e107::getInstance();
|
$e107 = e107::getInstance();
|
||||||
$pref = e107::getPref();
|
$pref = e107::getPref();
|
||||||
|
$tp = e107::getParser();
|
||||||
|
|
||||||
e107::coreLan('np');
|
e107::coreLan('np');
|
||||||
|
|
||||||
@@ -196,8 +197,10 @@ function nextprev_shortcode($parm = '')
|
|||||||
{
|
{
|
||||||
$e_vars->caption = 'LAN_NP_CAPTION';
|
$e_vars->caption = 'LAN_NP_CAPTION';
|
||||||
}
|
}
|
||||||
// Advanced multilingual support: 'Page %1$d of %2$d' -> match the exact argument, result would be 'Page 1 of 20'
|
|
||||||
$e_vars->caption = sprintf(defset($e_vars->caption, $e_vars->caption), $current_page, $total_pages);
|
// Advanced multilingual support: 'Page [x] of [y]' -> match the exact argument, result would be 'Page 1 of 20'
|
||||||
|
$e_vars->caption = $tp->lanVars(defset($e_vars->caption, $e_vars->caption),array('x'=>$current_page, 'y'=>$total_pages));
|
||||||
|
// sprintf(defset($e_vars->caption, $e_vars->caption), $current_page, $total_pages);
|
||||||
|
|
||||||
// urldecoded by parse_str()
|
// urldecoded by parse_str()
|
||||||
$pagetitle = explode('|', vartrue($parm['pagetitle']));
|
$pagetitle = explode('|', vartrue($parm['pagetitle']));
|
||||||
@@ -321,7 +324,7 @@ function nextprev_shortcode($parm = '')
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
$e_vars_loop->url_label = $label ? $tp->toAttribute($label) : LAN_NP_GOTO;
|
$e_vars_loop->url_label = $label ? $tp->toAttribute($label) : LAN_NP_GOTO;
|
||||||
$e_vars_loop->url_label = sprintf($e_vars_loop->url_label, ($c + 1));
|
$e_vars_loop->url_label = str_replace("[x]", ($c + 1), $e_vars_loop->url_label);
|
||||||
$ret_items[] = $tp->simpleParse($tmpl[$tprefix.'item'], $e_vars_loop);
|
$ret_items[] = $tp->simpleParse($tmpl[$tprefix.'item'], $e_vars_loop);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1920,7 +1920,8 @@ class e_admin_controller
|
|||||||
if(!method_exists($this, $method))
|
if(!method_exists($this, $method))
|
||||||
{
|
{
|
||||||
$this->getRequest()->setAction('e404');
|
$this->getRequest()->setAction('e404');
|
||||||
e107::getMessage()->add(sprintf(LAN_UI_404_METHOD_ERROR, $method), E_MESSAGE_ERROR);
|
$message = e107::getParser()->lanVars(LAN_UI_404_METHOD_ERROR, array('x'=>$method), true);
|
||||||
|
e107::getMessage()->add($message, E_MESSAGE_ERROR);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -4252,7 +4253,8 @@ class e_admin_ui extends e_admin_controller_ui
|
|||||||
$cnt = $this->getTreeModel()->update($field, $value, $selected, $value, false);
|
$cnt = $this->getTreeModel()->update($field, $value, $selected, $value, false);
|
||||||
if($cnt)
|
if($cnt)
|
||||||
{
|
{
|
||||||
$this->getTreeModel()->addMessageSuccess(sprintf(LAN_UI_BATCH_BOOL_SUCCESS, $cnt));
|
$caption = e107::getParser()->lanVars(LAN_UI_BATCH_BOOL_SUCCESS, array('x'=>$cnt), true);
|
||||||
|
$this->getTreeModel()->addMessageSuccess($caption);
|
||||||
}
|
}
|
||||||
$this->getTreeModel()->setMessages();
|
$this->getTreeModel()->setMessages();
|
||||||
}
|
}
|
||||||
@@ -4268,7 +4270,8 @@ class e_admin_ui extends e_admin_controller_ui
|
|||||||
$cnt = $tree->update($field, "1-{$field}", $selected, null, false);
|
$cnt = $tree->update($field, "1-{$field}", $selected, null, false);
|
||||||
if($cnt)
|
if($cnt)
|
||||||
{
|
{
|
||||||
$tree->addMessageSuccess(sprintf(LAN_UI_BATCH_REVERSED_SUCCESS, $cnt));
|
$caption = e107::getParser()->lanVars(LAN_UI_BATCH_REVERSED_SUCCESS, array('x'=>$cnt), true);
|
||||||
|
$tree->addMessageSuccess($caption);
|
||||||
//sync models
|
//sync models
|
||||||
$tree->load(true);
|
$tree->load(true);
|
||||||
}
|
}
|
||||||
@@ -4391,12 +4394,14 @@ class e_admin_ui extends e_admin_controller_ui
|
|||||||
if($cnt)
|
if($cnt)
|
||||||
{
|
{
|
||||||
$vttl = $this->getUI()->renderValue($field, $value, $this->getFieldAttr($field));
|
$vttl = $this->getUI()->renderValue($field, $value, $this->getFieldAttr($field));
|
||||||
$this->getTreeModel()->addMessageSuccess(sprintf(LAN_UI_BATCH_UPDATE_SUCCESS, $vttl, $cnt));
|
$caption = e107::getParser()->lanVars(LAN_UI_BATCH_UPDATE_SUCCESS, array('x'=>$vttl, 'y'=>$cnt), true);
|
||||||
|
$this->getTreeModel()->addMessageSuccess($caption);
|
||||||
}
|
}
|
||||||
elseif($rcnt)
|
elseif($rcnt)
|
||||||
{
|
{
|
||||||
$vttl = $this->getUI()->renderValue($field, $value, $this->getFieldAttr($field));
|
$vttl = $this->getUI()->renderValue($field, $value, $this->getFieldAttr($field));
|
||||||
$this->getTreeModel()->addMessageSuccess(sprintf(LAN_UI_BATCH_DEATTACH_SUCCESS, $vttl, $rcnt));
|
$caption = e107::getParser()->lanVars(LAN_UI_BATCH_DEATTACH_SUCCESS, array('x'=>$vttl, 'y'=>$cnt), true);
|
||||||
|
$this->getTreeModel()->addMessageSuccess($caption);
|
||||||
}
|
}
|
||||||
$this->getTreeModel()->setMessages();
|
$this->getTreeModel()->setMessages();
|
||||||
}
|
}
|
||||||
@@ -4869,7 +4874,8 @@ class e_admin_ui extends e_admin_controller_ui
|
|||||||
// Option for working with tables having no PID
|
// Option for working with tables having no PID
|
||||||
if(!varset($this->pid) && vartrue($this->fields) && false !== $this->pid)
|
if(!varset($this->pid) && vartrue($this->fields) && false !== $this->pid)
|
||||||
{
|
{
|
||||||
e107::getMessage()->add(LAN_UI_NOPID_ERROR, E_MESSAGE_WARNING);
|
$message = e107::getParser()->toHtml(LAN_UI_NOPID_ERROR,true);
|
||||||
|
e107::getMessage()->add($message, E_MESSAGE_WARNING);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->pid;
|
return $this->pid;
|
||||||
@@ -5081,7 +5087,8 @@ class e_admin_form_ui extends e_form
|
|||||||
// check form custom methods
|
// check form custom methods
|
||||||
if(vartrue($foptions['type']) === 'method' && method_exists('e_form', $field)) // check even if type is not method. - just in case of an upgrade later by 3rd-party.
|
if(vartrue($foptions['type']) === 'method' && method_exists('e_form', $field)) // check even if type is not method. - just in case of an upgrade later by 3rd-party.
|
||||||
{
|
{
|
||||||
e107::getMessage()->addError(sprintf(LAN_UI_FORM_METHOD_ERROR, $field));
|
$message = e107::getParser()->lanVars(LAN_UI_FORM_METHOD_ERROR, array('x'=>$field), true);
|
||||||
|
e107::getMessage()->addError($message);
|
||||||
$err = true;
|
$err = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -5113,7 +5120,7 @@ class e_admin_form_ui extends e_form
|
|||||||
$request = $controller->getRequest();
|
$request = $controller->getRequest();
|
||||||
if($controller->getId())
|
if($controller->getId())
|
||||||
{
|
{
|
||||||
$legend = sprintf(LAN_UI_EDIT_LABEL, $controller->getId());
|
$legend = e107::getParser()->lanVars(LAN_UI_EDIT_LABEL, array('x'=>$controller->getId())); // sprintf(LAN_UI_EDIT_LABEL, $controller->getId());
|
||||||
$form_start = vartrue($controller->headerUpdateMarkup);
|
$form_start = vartrue($controller->headerUpdateMarkup);
|
||||||
$form_end = vartrue($controller->footerUpdateMarkup);
|
$form_end = vartrue($controller->footerUpdateMarkup);
|
||||||
}
|
}
|
||||||
|
@@ -2580,7 +2580,20 @@ class e_parser
|
|||||||
return sprintf("%0".$numDigits."d",$num);
|
return sprintf("%0".$numDigits."d",$num);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generic variable translator for LAN definitions.
|
||||||
|
* @example $tp->lanVars("My name is [x] and I own a [y]", array('x'=>"John", 'y'=>"Cat"));
|
||||||
|
*/
|
||||||
|
function lanVars($lan, $array= array(), $bold=false)
|
||||||
|
{
|
||||||
|
foreach($array as $k=>$v)
|
||||||
|
{
|
||||||
|
$search[] = "[".$k."]";
|
||||||
|
$replace[] = ($bold===true) ? "<strong>".$v."</strong>" : $v;
|
||||||
|
}
|
||||||
|
|
||||||
|
return str_replace($search, $replace, $lan);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return an Array of all specific tags found in an HTML document and their attributes.
|
* Return an Array of all specific tags found in an HTML document and their attributes.
|
||||||
|
@@ -335,6 +335,7 @@ class language{
|
|||||||
/**
|
/**
|
||||||
* Generic variable translator for LAN definitions.
|
* Generic variable translator for LAN definitions.
|
||||||
* @example $lng->translate("My name is [x] and I own a [y]", array('x'=>"John", 'y'=>"Cat"));
|
* @example $lng->translate("My name is [x] and I own a [y]", array('x'=>"John", 'y'=>"Cat"));
|
||||||
|
* @deprecated Use $tp->lanVars() instead.
|
||||||
*/
|
*/
|
||||||
function translate($lan, $array= array())
|
function translate($lan, $array= array())
|
||||||
{
|
{
|
||||||
|
@@ -362,22 +362,21 @@ define("LAN_FILTER_LABEL_CLEAR", "Clear Filter");
|
|||||||
define("LAN_FILTER_LABEL_TYPED", "(typed)");
|
define("LAN_FILTER_LABEL_TYPED", "(typed)");
|
||||||
|
|
||||||
//FIXME Remove html
|
//FIXME Remove html
|
||||||
define("LAN_UI_NOPID_ERROR", "There is no <strong>Primary ID</strong> set");
|
define("LAN_UI_NOPID_ERROR", "There is no [b]Primary ID[/b] set");
|
||||||
define("LAN_UI_BATCHDEL_ERROR", "Batch delete not allowed!");
|
define("LAN_UI_BATCHDEL_ERROR", "Batch delete not allowed!");
|
||||||
define("LAN_UI_404_BODY_ERROR", "Requested page was not found!");
|
define("LAN_UI_404_BODY_ERROR", "Requested page was not found!");
|
||||||
define("LAN_UI_404_TITLE_ERROR", "Page Not Found");
|
define("LAN_UI_404_TITLE_ERROR", "Page Not Found");
|
||||||
define("LAN_UI_404_METHOD_ERROR", "Action <strong>%1\$s</strong> not found!");
|
define("LAN_UI_404_METHOD_ERROR", "Action [x] not found!");
|
||||||
define("LAN_UI_403_BODY_ERROR", "Access to the requested page is denied.");
|
define("LAN_UI_403_BODY_ERROR", "Access to the requested page is denied.");
|
||||||
define("LAN_UI_403_TITLE_ERROR", "Access denied");
|
define("LAN_UI_403_TITLE_ERROR", "Access denied");
|
||||||
define("LAN_UI_FORM_METHOD_ERROR", "FATAL ERROR: The field name <strong>%1\$s</strong> is not allowed. Please rename the key <strong>%1\$s</strong> to something else in your fields array and database table (if required).");
|
define("LAN_UI_FORM_METHOD_ERROR", "FATAL ERROR: The field name [x] is not allowed. Please rename the key [x] to something else in your fields array and database table (if required).");
|
||||||
|
|
||||||
//FIXME - remove % code and HTML from LANS below and replace with "[x]" and bbcode.
|
define("LAN_UI_BATCH_UPDATE_SUCCESS", "[x] set for [y] record(s).");
|
||||||
define("LAN_UI_BATCH_UPDATE_SUCCESS", "<strong>%1\$s</strong> set for <strong>%2\$d</strong> record(s).");
|
define("LAN_UI_BATCH_REVERSED_SUCCESS", "[x] records successfully reversed.");
|
||||||
define("LAN_UI_BATCH_REVERSED_SUCCESS", "<strong>%1\$d</strong> records successfully reversed.");
|
define("LAN_UI_BATCH_BOOL_SUCCESS", "[x] records successfully updated.");
|
||||||
define("LAN_UI_BATCH_BOOL_SUCCESS", "<strong>%1\$d</strong> records successfully updated.");
|
define("LAN_UI_BATCH_DEATTACH_SUCCESS", "[x] removed from [y] record(s).");
|
||||||
define("LAN_UI_BATCH_DEATTACH_SUCCESS", "<strong>%1\$s</strong> removed from <strong>%2\$d</strong> record(s).");
|
|
||||||
|
|
||||||
define("LAN_UI_EDIT_LABEL", "Update record #%1\$s");
|
define("LAN_UI_EDIT_LABEL", "Update record #[x]");
|
||||||
define("LAN_UI_CREATE_LABEL", "Create new record");
|
define("LAN_UI_CREATE_LABEL", "Create new record");
|
||||||
define("LAN_UI_PREF_LABEL", "Settings");
|
define("LAN_UI_PREF_LABEL", "Settings");
|
||||||
define("LAN_UI_DELETE_LABEL", "Confirm Delete");
|
define("LAN_UI_DELETE_LABEL", "Confirm Delete");
|
||||||
|
@@ -18,11 +18,11 @@ define('LAN_NP_NEXT', 'next');
|
|||||||
define('LAN_NP_URLNEXT', 'Go to the next page');
|
define('LAN_NP_URLNEXT', 'Go to the next page');
|
||||||
define('LAN_NP_LAST', 'last');
|
define('LAN_NP_LAST', 'last');
|
||||||
define('LAN_NP_URLLAST', 'Go to the last page');
|
define('LAN_NP_URLLAST', 'Go to the last page');
|
||||||
define('LAN_NP_GOTO', 'Go to page %s');
|
define('LAN_NP_GOTO', 'Go to page [x]');
|
||||||
define('LAN_NP_URLCURRENT', 'Currently viewed');
|
define('LAN_NP_URLCURRENT', 'Currently viewed');
|
||||||
|
|
||||||
// WARNING - USE SINGLE QUOTES!!!
|
// WARNING - USE SINGLE QUOTES!!!
|
||||||
// Replacement: '%1$d' - current page; '%2$d' - total pages
|
// Replacement: '%1$d' - current page; '%2$d' - total pages
|
||||||
define('NP_CAPTION', 'Page %1$d of %2$d');
|
define('NP_CAPTION', 'Page [x] of [y]');
|
||||||
|
|
||||||
?>
|
?>
|
Reference in New Issue
Block a user