Remove mail templates from localization constants

This commit is contained in:
Dmitriy Simushev 2014-06-19 14:21:23 +00:00
parent 561c512a9b
commit f34ddb1060
3 changed files with 40 additions and 19 deletions

View File

@ -338,24 +338,42 @@ function add_mail_templates($link){
}
$result = array();
foreach (get_available_locales() as $locale) {
if (! in_array($locale, $existlocales)) {
if (in_array($locale, $existlocales)) {
// Do not export mail templates for existing locales
continue;
}
$file_path = MIBEW_FS_ROOT . '/locales/' . $locale . '/mail_templates.yml';
if (!is_readable($file_path)) {
// Export templates only for locales which have templates
continue;
}
$templates = get_yml_file_content($file_path);
if (isset($templates['user_history'])) {
$result[] = array(
'locale' => $locale,
'name' => 'user_history',
'subject' => getlocal('mail.user.history.subject', null, $locale),
'body' => getlocal('mail.user.history.body', null, $locale)
'subject' => $templates['user_history']['subject'],
'body' => $templates['user_history']['body'],
);
}
if (isset($templates['password_recovery'])) {
$result[] = array(
'locale' => $locale,
'name' => 'password_recovery',
'subject' => getlocal('restore.mailsubj', null, $locale),
'body' => getlocal('restore.mailtext', null, $locale)
'subject' => $templates['password_recovery']['subject'],
'body' => $templates['password_recovery']['body'],
);
}
if (isset($templates['leave_message'])) {
$result[] = array(
'locale' => $locale,
'name' => 'leave_message',
'subject' => getlocal('leavemail.subject', null, $locale),
'body' => getlocal('leavemail.body', null, $locale)
'subject' => $templates['leave_message']['subject'],
'body' => $templates['leave_message']['body'],
);
}
}
@ -374,6 +392,12 @@ function add_mail_templates($link){
}
}
function get_yml_file_content($file)
{
$yaml = new \Symfony\Component\Yaml\Parser();
return $yaml->parse(file_get_contents($file));
}
function check_status()
{

View File

@ -0,0 +1,9 @@
user_history:
subject: 'Mibew: dialog history'
body: "Hello {0}!\n\nYour chat history: \n\n{1}\n--- \nRegards,\n{2} and Mibew\n{3}"
password_recovery:
subject: 'Reset your Mibew password'
body: "Hi, {0}\n\nPlease click on the link below or copy and paste the URL into your browser:\n{1}\n\nThis will let you choose another password.\n\nRegards,\nMibew"
leave_message:
subject: 'Question from {0}'
body: "Your have a message from {0}:\n\n{2}\n\nHis email: {1}\n{3}\n--- \nRegards,\nMibew"

View File

@ -434,10 +434,6 @@ msgid "invitation.accept.caption"
msgstr "Answer"
msgid "lang.choose"
msgstr "Choose your language"
msgid "leavemail.body"
msgstr "Your have a message from {0}:\n\n{2}\n\nHis email: {1}\n{3}\n--- \nRegards,\nMibew"
msgid "leavemail.subject"
msgstr "Question from {0}"
msgid "leavemessage.close"
msgstr "Close"
msgid "leavemessage.descr"
@ -476,10 +472,6 @@ msgid "mail_template.subject"
msgstr "Mail subject"
msgid "mail_template.title"
msgstr "Mail templates"
msgid "mail.user.history.body"
msgstr "Hello {0}!\n\nYour chat history: \n\n{1}\n--- \nRegards,\n{2} and Mibew\n{3}"
msgid "mail.user.history.subject"
msgstr "Mibew: dialog history"
msgid "mailthread.close"
msgstr "Close..."
msgid "mailthread.enter_email"
@ -994,10 +986,6 @@ msgid "restore.emailorlogin"
msgstr "Login or E-mail:"
msgid "restore.intro"
msgstr "You cannot retrieve your password, but you can set a new one by following a link sent to you by email."
msgid "restore.mailsubj"
msgstr "Reset your Mibew password"
msgid "restore.mailtext"
msgstr "Hi, {0}\n\nPlease click on the link below or copy and paste the URL into your browser:\n{1}\n\nThis will let you choose another password.\n\nRegards,\nMibew"
msgid "restore.pwd.message"
msgstr "Forgot your password?"
msgid "restore.sent.title"