mirror of
https://github.com/Mibew/mibew.git
synced 2025-03-03 10:28:32 +03:00
Replace "getlocal_" function with "getlocal"
This commit is contained in:
parent
090166b780
commit
9ddaba0b4c
@ -310,7 +310,7 @@ function add_canned_messages($link){
|
||||
$result = array();
|
||||
foreach (get_available_locales() as $locale) {
|
||||
if (! in_array($locale, $existlocales)) {
|
||||
foreach (explode("\n", getlocal_('chat.predefined_answers', $locale)) as $answer) {
|
||||
foreach (explode("\n", getlocal('chat.predefined_answers', null, $locale)) as $answer) {
|
||||
$result[] = array('locale' => $locale, 'vctitle' => cut_string($answer, 97, '...'), 'vcvalue' => $answer);
|
||||
}
|
||||
}
|
||||
|
@ -46,7 +46,7 @@ class CannedMessageController extends AbstractController
|
||||
foreach ($all_locales as $id) {
|
||||
$locales_with_label[] = array(
|
||||
'id' => $id,
|
||||
'name' => getlocal_($id, 'names')
|
||||
'name' => getlocal($id, null, 'names')
|
||||
);
|
||||
}
|
||||
$page['locales'] = $locales_with_label;
|
||||
|
@ -59,7 +59,7 @@ class TranslationController extends AbstractController
|
||||
$locales_list = array();
|
||||
$all_locales = get_available_locales();
|
||||
foreach ($all_locales as $loc) {
|
||||
$locales_list[] = array("id" => $loc, "name" => getlocal_("localeid", $loc));
|
||||
$locales_list[] = array('id' => $loc, 'name' => getlocal('localeid', null, $loc));
|
||||
}
|
||||
|
||||
// Extract needed localization constants.
|
||||
|
@ -364,7 +364,7 @@ class Thread
|
||||
// Send message
|
||||
$thread->postMessage(
|
||||
self::KIND_EVENTS,
|
||||
getlocal_("chat.status.user.reopenedthread", $thread->locale, true)
|
||||
getlocal('chat.status.user.reopenedthread', null, $thread->locale, true)
|
||||
);
|
||||
|
||||
return $thread;
|
||||
@ -600,8 +600,9 @@ class Thread
|
||||
// Check if user chatting at the moment
|
||||
if ($this->state == self::STATE_CHATTING) {
|
||||
// Send message to user
|
||||
$message_to_post = getlocal_(
|
||||
"chat.status.operator.dead",
|
||||
$message_to_post = getlocal(
|
||||
'chat.status.operator.dead',
|
||||
null,
|
||||
$this->locale,
|
||||
true
|
||||
);
|
||||
@ -625,8 +626,9 @@ class Thread
|
||||
$this->lastPingUser = 0;
|
||||
|
||||
// And send a message to operator
|
||||
$message_to_post = getlocal_(
|
||||
"chat.status.user.dead",
|
||||
$message_to_post = getlocal(
|
||||
'chat.status.user.dead',
|
||||
null,
|
||||
$this->locale,
|
||||
true
|
||||
);
|
||||
@ -865,8 +867,9 @@ class Thread
|
||||
if ($this->state == self::STATE_INVITED) {
|
||||
$this->postMessage(
|
||||
self::KIND_FOR_AGENT,
|
||||
getlocal_(
|
||||
"chat.visitor.invitation.canceled",
|
||||
getlocal(
|
||||
'chat.visitor.invitation.canceled',
|
||||
null,
|
||||
$this->locale,
|
||||
true
|
||||
)
|
||||
|
@ -141,7 +141,7 @@ function get_locale_links()
|
||||
return null;
|
||||
}
|
||||
foreach ($all_locales as $k) {
|
||||
$locale_links[$k] = getlocal_($k, "names");
|
||||
$locale_links[$k] = getlocal($k, null, 'names');
|
||||
}
|
||||
|
||||
return $locale_links;
|
||||
@ -278,46 +278,20 @@ function get_localized_string($string, $locale)
|
||||
return "!" . $string;
|
||||
}
|
||||
|
||||
function getlocal_($text, $locale, $raw = false)
|
||||
{
|
||||
$localized = load_messages($locale);
|
||||
if (isset($localized[$text])) {
|
||||
return $raw
|
||||
? $localized[$text]
|
||||
: sanitize_string($localized[$text], 'low', 'moderate');
|
||||
}
|
||||
if ($locale != 'en') {
|
||||
return getlocal_($text, 'en', $raw);
|
||||
}
|
||||
|
||||
return "!" . ($raw ? $text : sanitize_string($text, 'low', 'moderate'));
|
||||
}
|
||||
|
||||
function getlocal2_($text, $params, $locale, $raw = false)
|
||||
{
|
||||
$string = getlocal_($text, $locale, true);
|
||||
for ($i = 0; $i < count($params); $i++) {
|
||||
$string = str_replace("{" . $i . "}", $params[$i], $string);
|
||||
}
|
||||
|
||||
return $raw ? $string : sanitize_string($string, 'low', 'moderate');
|
||||
return getlocal($text, $params, $locale, $raw);
|
||||
}
|
||||
|
||||
function getlocal2($text, $params, $raw = false)
|
||||
{
|
||||
$string = getlocal_($text, CURRENT_LOCALE, true);
|
||||
|
||||
for ($i = 0; $i < count($params); $i++) {
|
||||
$string = str_replace("{" . $i . "}", $params[$i], $string);
|
||||
}
|
||||
|
||||
return $raw ? $string : sanitize_string($string, 'low', 'moderate');
|
||||
return getlocal($text, $params, CURRENT_LOCALE, $raw);
|
||||
}
|
||||
|
||||
/* prepares for Javascript string */
|
||||
function get_local_for_js($text, $params)
|
||||
{
|
||||
$string = getlocal_($text, CURRENT_LOCALE);
|
||||
$string = get_localized_string($text, CURRENT_LOCALE);
|
||||
$string = str_replace("\"", "\\\"", str_replace("\n", "\\n", $string));
|
||||
for ($i = 0; $i < count($params); $i++) {
|
||||
$string = str_replace("{" . $i . "}", $params[$i], $string);
|
||||
|
@ -271,7 +271,7 @@ function invitation_close_old()
|
||||
$thread = Thread::createFromDbInfo($thread_info);
|
||||
$thread->postMessage(
|
||||
Thread::KIND_FOR_AGENT,
|
||||
getlocal_('chat.visitor.invitation.ignored', $thread->locale, true)
|
||||
getlocal('chat.visitor.invitation.ignored', null, $thread->locale, true)
|
||||
);
|
||||
unset($thread);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user