Mail template translate

How can customize the messages in spanish like the welcome message?
Where are the template to do that?

Thanks for any orientation.


Jaimeco

Hello @jaimeco ,

As far as I know there isn’t something like a template for those mails but if you really want to modify those messages, you need to modify this file (it is the file with Spanish translations for all messages/strings in HestiaCP) :

$HESTIA/web/locale/es/LC_MESSAGES/hestiaqcp.mo

The first “problem” is that hestiacp.mo is a binary data file, you can’t edit it directly, you need to convert it to .po file, edit that file, convert po to mo and replace current hestiacp.mo.

If you don’t have it installed you should install gettext

apt install gettext

Now copy, convert, modify, convert again and replace the translation:

mkdir /tmp/modifying_hestiacp
cd /tmp/modifying_hestiacp/
cp $HESTIA/web/locale/es/LC_MESSAGES/hestiacp.mo hestiacp.mo.original
msgunfmt hestiacp.mo.original -o hestiacp.po

Note: Keep a backup of hestiacp.mo.original just in case.

Now you can edit hestiacp.po file to change it to fit your needs. This is the part of the welcome message:


msgid ""
"Hello {{name}},\n"
"\n"
"Your account has been created and ready to use.\n"
"\n"
"https://{{hostname}}/login/\n"
"Username: {{user}}\n"
"Password: {{password}}\n"
"\n"
"Best regards,\n"
"\n"
"--\n"
"{{appname}}"
msgstr ""
"Hola {{name}},\n"
"\n"
"Su cuenta se ha creado, ya puede hacer uso de ella.\n"
"\n"
"https://{{hostname}}/login/\n"
"Usuario: {{user}}\n"
"Contraseña: {{password}}\n"
"\n"
"Saludos cordiales,\n"
"\n"
"--\n"
"{{appname}}"

Once edited, save the file, convert it from po to mo and replace original file:

msgfmt hestiacp.po -o hestiacp.mo.modified
cp -f hestiacp.mo.modified $HESTIA/web/locale/es/LC_MESSAGES/hestiacp.mo

And done, next message will be send with the modified translation.

The second problem, and this is the real problem, those changes will be overridden in next update and you would need to perform the changes again and you should do it from the original file again because it’s possible that translation has changed, or msgids added/deleted…

As far as I know there isn’t an easier way to do it but maybe I’m completely wrong and there is another way to do it :wink:

Cheers,
sahsanu

Won’t be needed have support for a better method…

Create a in:

/usr/local/hestia/data/templates/email/

With the same name as:

In your case:

Copy over the template and make any changes if you want and save them

If you want to translate to a different language add a file called:
email_credentials.isocode.html

2 Likes

In case of the welcome message change over:

2 Likes

Yes, that method is much better :yum:, thank you :smile:

It got changed in 1.8.0 BTW

So unless you are in 1.7.x or lower @sahsanu method will be required but it really sucks …

Also the user account default language is currently taken from the translation so far I should be already translated in Spanish

Crowdin.

2 Likes

Thanks for your orientation, it’s work for me.

1 Like

If you use @sahsanu method it will overwritten next update you should follow my instructions

2 Likes

Thanks, I will trye this method, thank you.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.