mirror of
https://github.com/Mibew/i18n.git
synced 2025-01-22 21:40:28 +03:00
Add 'msgjs:' and 'pagejs:' prefixies to template engine
This commit is contained in:
parent
33f30bd1c6
commit
a4d12d7b65
@ -65,18 +65,25 @@ function expand_var($matches)
|
||||
}
|
||||
}
|
||||
|
||||
} else if ($prefix == 'msg:' || $prefix == 'url:') {
|
||||
} else if ($prefix == 'msg:' || $prefix == 'msgjs:' || $prefix == 'url:') {
|
||||
$message = '';
|
||||
if (strpos($var, ",") !== false) {
|
||||
$pos = strpos($var, ",");
|
||||
$param = substr($var, $pos + 1);
|
||||
$var = substr($var, 0, $pos);
|
||||
return getlocal2($var, array($page[$param]));
|
||||
$message = getlocal2($var, array($page[$param]));
|
||||
} else {
|
||||
$message = getlocal($var);
|
||||
}
|
||||
return getlocal($var);
|
||||
if ($prefix == 'msgjs:') {
|
||||
return json_encode($message);
|
||||
}
|
||||
return $message;
|
||||
} else if ($prefix == 'form:') {
|
||||
return form_value($var);
|
||||
} else if ($prefix == 'page:') {
|
||||
return isset($page[$var]) ? $page[$var] : "";
|
||||
} else if ($prefix == 'page:' || $prefix == 'pagejs:') {
|
||||
$message = isset($page[$var]) ? $page[$var] : "";
|
||||
return ($prefix == 'pagejs:') ? json_encode($message) : $message;
|
||||
} else if ($prefix == 'if:' || $prefix == 'else:' || $prefix == 'endif:' || $prefix == 'ifnot:') {
|
||||
return "<!-- wrong $prefix:$var -->";
|
||||
}
|
||||
|
@ -32,43 +32,43 @@
|
||||
${page:additional_js}
|
||||
<script type="text/javascript"><!--
|
||||
Mibew.Localization.set({
|
||||
'chat.close.confirmation': "${msg:chat.close.confirmation}",
|
||||
'typing.remote': "${msg:typing.remote}",
|
||||
'chat.window.predefined.select_answer': "${msg:chat.window.predefined.select_answer}",
|
||||
'chat.window.send_message': "${msg:chat.window.send_message}",
|
||||
'chat.window.send_message_short_and_shortcut': "${msg:chat.window.send_message_short,send_shortcut}",
|
||||
'chat.window.close_title': "${msg:chat.window.close_title}",
|
||||
'chat.window.toolbar.refresh': "${msg:chat.window.toolbar.refresh}",
|
||||
'chat.window.toolbar.mail_history': "${msg:chat.window.toolbar.mail_history}",
|
||||
'chat.window.toolbar.redirect_user': "${msg:chat.window.toolbar.redirect_user}",
|
||||
'page.analysis.userhistory.title': "${msg:page.analysis.userhistory.title}",
|
||||
'chat.client.name': "${msg:chat.client.name}",
|
||||
'chat.client.changename': "${msg:chat.client.changename}",
|
||||
'chat.window.toolbar.turn_off_sound': "${msg:chat.window.toolbar.turn_off_sound}",
|
||||
'chat.window.toolbar.turn_on_sound': "${msg:chat.window.toolbar.turn_on_sound}",
|
||||
'chat.window.poweredby': "${msg:chat.window.poweredby}",
|
||||
'chat.mailthread.sent.close': "${msg:chat.mailthread.sent.close}",
|
||||
'form.field.department': "${msg:form.field.department}",
|
||||
'form.field.department.description': "${msg:form.field.department.description}",
|
||||
'form.field.email': "${msg:form.field.email}",
|
||||
'form.field.name': "${msg:form.field.name}",
|
||||
'form.field.message': "${msg:form.field.message}",
|
||||
'leavemessage.close': "${msg:leavemessage.close}",
|
||||
'leavemessage.descr': "${msg:leavemessage.descr}",
|
||||
'leavemessage.sent.message': "${msg:leavemessage.sent.message}",
|
||||
'leavemessage.error.email.required': '${page:localized.email.required}',
|
||||
'leavemessage.error.name.required': '${page:localized.name.required}',
|
||||
'leavemessage.error.message.required': '${page:localized.message.required}',
|
||||
'leavemessage.error.wrong.email': '${page:localized.wrong.email}',
|
||||
'errors.captcha': '${msg:errors.captcha}',
|
||||
'mailthread.perform': "${msg:mailthread.perform}",
|
||||
'presurvey.name': "${msg:presurvey.name}",
|
||||
'presurvey.mail': "${msg:presurvey.mail}",
|
||||
'presurvey.question': "${msg:presurvey.question}",
|
||||
'presurvey.submit': "${msg:presurvey.submit}",
|
||||
'presurvey.error.wrong_email': "${msg:presurvey.error.wrong_email}",
|
||||
'presurvey.title': "${msg:presurvey.title}",
|
||||
'presurvey.intro': '${msg:presurvey.intro}'
|
||||
'chat.close.confirmation': ${msgjs:chat.close.confirmation},
|
||||
'typing.remote': ${msgjs:typing.remote},
|
||||
'chat.window.predefined.select_answer': ${msgjs:chat.window.predefined.select_answer},
|
||||
'chat.window.send_message': ${msgjs:chat.window.send_message},
|
||||
'chat.window.send_message_short_and_shortcut': ${msgjs:chat.window.send_message_short,send_shortcut},
|
||||
'chat.window.close_title': ${msgjs:chat.window.close_title},
|
||||
'chat.window.toolbar.refresh': ${msgjs:chat.window.toolbar.refresh},
|
||||
'chat.window.toolbar.mail_history': ${msgjs:chat.window.toolbar.mail_history},
|
||||
'chat.window.toolbar.redirect_user': ${msgjs:chat.window.toolbar.redirect_user},
|
||||
'page.analysis.userhistory.title': ${msgjs:page.analysis.userhistory.title},
|
||||
'chat.client.name': ${msgjs:chat.client.name},
|
||||
'chat.client.changename': ${msgjs:chat.client.changename},
|
||||
'chat.window.toolbar.turn_off_sound': ${msgjs:chat.window.toolbar.turn_off_sound},
|
||||
'chat.window.toolbar.turn_on_sound': ${msgjs:chat.window.toolbar.turn_on_sound},
|
||||
'chat.window.poweredby': ${msgjs:chat.window.poweredby},
|
||||
'chat.mailthread.sent.close': ${msgjs:chat.mailthread.sent.close},
|
||||
'form.field.department': ${msgjs:form.field.department},
|
||||
'form.field.department.description': ${msgjs:form.field.department.description},
|
||||
'form.field.email': ${msgjs:form.field.email},
|
||||
'form.field.name': ${msgjs:form.field.name},
|
||||
'form.field.message': ${msgjs:form.field.message},
|
||||
'leavemessage.close': ${msgjs:leavemessage.close},
|
||||
'leavemessage.descr': ${msgjs:leavemessage.descr},
|
||||
'leavemessage.sent.message': ${msgjs:leavemessage.sent.message},
|
||||
'leavemessage.error.email.required': ${pagejs:localized.email.required},
|
||||
'leavemessage.error.name.required': ${pagejs:localized.name.required},
|
||||
'leavemessage.error.message.required': ${pagejs:localized.message.required},
|
||||
'leavemessage.error.wrong.email': ${pagejs:localized.wrong.email},
|
||||
'errors.captcha': ${msgjs:errors.captcha},
|
||||
'mailthread.perform': ${msgjs:mailthread.perform},
|
||||
'presurvey.name': ${msgjs:presurvey.name},
|
||||
'presurvey.mail': ${msgjs:presurvey.mail},
|
||||
'presurvey.question': ${msgjs:presurvey.question},
|
||||
'presurvey.submit': ${msgjs:presurvey.submit},
|
||||
'presurvey.error.wrong_email': ${msgjs:presurvey.error.wrong_email},
|
||||
'presurvey.title': ${msgjs:presurvey.title},
|
||||
'presurvey.intro': ${msgjs:presurvey.intro}
|
||||
});
|
||||
//--></script>
|
||||
|
||||
@ -85,11 +85,11 @@
|
||||
webimRoot: '${webimroot}',
|
||||
tplRoot: '${tplroot}',
|
||||
company: {
|
||||
name: '${page:company.name}',
|
||||
name: ${pagejs:company.name},
|
||||
chatLogoURL: '${page:company.chatLogoURL}'
|
||||
},
|
||||
webimHost: '${page:webimHost}',
|
||||
title: '${page:page.title}'
|
||||
title: ${pagejs:page.title}
|
||||
},
|
||||
${if:chatOptions}
|
||||
chatOptions: ${page:chatOptions},
|
||||
|
Loading…
Reference in New Issue
Block a user