Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request : i18n support for emails and application settings #593

Open
ymauray opened this issue Sep 21, 2022 · 5 comments
Open

Feature request : i18n support for emails and application settings #593

ymauray opened this issue Sep 21, 2022 · 5 comments

Comments

@ymauray
Copy link

ymauray commented Sep 21, 2022

Hi, thanks for the great tool !

I am building a Flutter mobile app that will support english and french as its languages. It would be very nice to have the possibiliy to send localized version of the Verification, Password reset, and Confirm email change emails. Manual selection of the language via the API call is perfectly acceptable. It could be english by default.

Also, the name of the app will be localized, so it won't be the same in english and in french. That could be hard coded in the email templates, so having that localized in PocketBase is not as important as the emails templates.

Have a good day !

@ganigeorgiev
Copy link
Member

ganigeorgiev commented Sep 21, 2022

I've recently received a similar request on the support mail, but unfortunately this cannot be done easily at the moment. I'll leave the issue open for now, so that I can consider it and maybe combine with the planned collection triggers in #317.


Currently there are 2 available options if you want to have localized mail templates:

  1. Extend PocketBase and use the OnMailerBefore* event hooks to send custom emails (for example, you can get the preferred user language from some custom user profile field).

  2. Provide both localized versions in the same mail template. I've seen this pattern used with Firebase, and although it is not ideal, it maybe a good enough workaround for now, especially for users who are not familiar with Go and don't want to use PocketBase as framework.

@ymauray
Copy link
Author

ymauray commented Sep 21, 2022

Thanks for the suggestions. I totally understand that it might be complex - i18n things are always complex ! - and it's more important to make PocketBase work well first !

I'll figure something out for the name of my app, and I like the idea of the emails having both languages, so I'll go with that until it's possible to have them localized.

Cheers from Switzerland!

@gedw99
Copy link

gedw99 commented Apr 24, 2023

Is there the ability to create html emails in Pocketbase ?

If not there is a golang one here

https://github.com/Boostport/mjml-go

mjml is a higher level xml like description language for html emails.

@ganigeorgiev
Copy link
Member

@gedw99 There is no external template language if that's what you are asking. Internally we are using the go text/template and html/template packages.

For general info how to send emails when using PocketBase as framework, you can check https://pocketbase.io/docs/sending-emails/

@gladson
Copy link

gladson commented Jul 16, 2023

To help with the discussion...

https://github.com/maximilien/i18n4go

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants