saleor / apps

A central space for Saleor Apps, integrations, and the App Store 🚀
https://apps.saleor.io
Other
112 stars 305 forks source link

i18n support in Emails and Messages app #726

Open krzysztofwolski opened 1 year ago

krzysztofwolski commented 1 year ago

Problem I would like to solve

Send fully translated emails to customers.

Intro

API

Saleor API provides translation models that the App could use. To choose a language, we can:

Currently, the API does not provide a way to automatically detect language and add a proper translation to the subscription. It means additional API calls after receiving the webhook.

Templates

Sendgrid and SMTP providers lack dedicated i18n support and require conditional rendering with Handlebars to localize text. Sendgrid documentation with examples for reference.

For initial i18n implementation in the EAM, it would be recommended approach. As a potential improvement in the future, we could make configuration variants depending on the language:

When a webhook arrives, the App checks for any configuration variant of the event language. If none is found, the base configuration is used.

The proposed solution increases the app's complexity (both for implementation and for the user).

Impact

krzysztofwolski commented 1 year ago

The #816 PR added translated fields for the product and variant names. Other fields, like attribute names, are not translated.