Remove canned messafes from localization constants

This commit is contained in:
Dmitriy Simushev 2014-06-20 09:25:30 +00:00
parent f34ddb1060
commit fa5bf90195
3 changed files with 16 additions and 6 deletions

View File

@ -309,10 +309,20 @@ function add_canned_messages($link){
} }
$result = array(); $result = array();
foreach (get_available_locales() as $locale) { foreach (get_available_locales() as $locale) {
if (! in_array($locale, $existlocales)) { if (in_array($locale, $existlocales)) {
foreach (explode("\n", getlocal('chat.predefined_answers', null, $locale)) as $answer) { // Do not export canned messages for existing locales
$result[] = array('locale' => $locale, 'vctitle' => cut_string($answer, 97, '...'), 'vcvalue' => $answer); continue;
} }
$file_path = MIBEW_FS_ROOT . '/locales/' . $locale . '/canned_messages.yml';
if (!is_readable($file_path)) {
// Export canned messages only for locales which have canned messages
continue;
}
$canned_messages = get_yml_file_content($file_path);
foreach ($canned_messages as $answer) {
$result[] = array('locale' => $locale, 'vctitle' => cut_string($answer, 97, '...'), 'vcvalue' => $answer);
} }
} }
if (count($result) > 0) { if (count($result) > 0) {

View File

@ -0,0 +1,2 @@
- 'Hello. How may I help you?'
- 'Hello! Welcome to our support. How may I help you?'

View File

@ -98,8 +98,6 @@ msgid "chat.mailthread.sent.content"
msgstr "A history of your chat was sent to address {0}" msgstr "A history of your chat was sent to address {0}"
msgid "chat.mailthread.sent.title" msgid "chat.mailthread.sent.title"
msgstr "Sent" msgstr "Sent"
msgid "chat.predefined_answers"
msgstr "Hello. How may I help you?\nHello! Welcome to our support. How may I help you?"
msgid "chat.redirect.back" msgid "chat.redirect.back"
msgstr "Back..." msgstr "Back..."
msgid "chat.redirect.cannot" msgid "chat.redirect.cannot"