Luis M. Posted December 22, 2021 Report Posted December 22, 2021 I have most clients set their languages in Spanish, so their invoices and email notices are generated in Spanish (no problems there). The issue is that all those notices and invoices in Spanish, show their dates (due date, invoice date, the product span) in English. This is not a big of an issue because most months names are similar in English and Spanish (at least the first 3 letters as used in here), but some months names are completely different and I imagine other languages to have very different nomenclature. Is there a way to have those dates generated in the language the client has selected? I'm attaching some screenshots of what I'm talking about. The steps to reproduce this are: - Create a client in another language - Generate an invoice - Let the invoice be sent via email to the client, and you'll see the dates. Info: Blesta: 5.2.2 Apache: 2.4.52 PHP: 7.4.27 All required php modules installed. Quote
Paul Posted December 22, 2021 Report Posted December 22, 2021 Interesting! I think the language is handled by PHP and PHP's date function defaults these to English. The simple solution would be to change the month from a name to a number instead. This can be done under Settings > Company > General > Localization by updating the Date Format from the default "M d, Y" to something else. Per https://www.php.net/manual/en/function.date.php you could use, for example: m.d.y to display the date in this format: 03.10.01 Take a look at the examples from that link and format as desired. Quote
Luis M. Posted December 22, 2021 Author Report Posted December 22, 2021 35 minutes ago, Paul said: Interesting! I think the language is handled by PHP and PHP's date function defaults these to English. The simple solution would be to change the month from a name to a number instead. This can be done under Settings > Company > General > Localization by updating the Date Format from the default "M d, Y" to something else. Per https://www.php.net/manual/en/function.date.php you could use, for example: m.d.y to display the date in this format: 03.10.01 Take a look at the examples from that link and format as desired. I tried that and it worked! The issue gets a little more complicated if you use Blesta for clients in different countries, because in the US the format is m/d/y and in others (most of latin america, and some european even) the format would be d/m/y, and the invoice gets a little confusing. It would be nice that you can use the month's name translated according to the language your client is using, so using the default formatting would work for most (if not all) of the cases. I found these, apparently a locale can be set for dates, days of the week, and so on. https://www.php.net/manual/en/function.strftime.php https://www.php.net/manual/en/function.setlocale.php Please, consider the possibility of adding this behavior to Blesta. Thanks. Quote
Paul Posted December 22, 2021 Report Posted December 22, 2021 11 minutes ago, Luis M. said: Please, consider the possibility of adding this behavior to Blesta. Thanks for the suggestion, we will discuss. If you want to make an official request for this, you can post it at https://requests.blesta.com Quote
Luis M. Posted December 22, 2021 Author Report Posted December 22, 2021 22 minutes ago, Paul said: Thanks for the suggestion, we will discuss. If you want to make an official request for this, you can post it at https://requests.blesta.com Thanks! Request created https://requests.blesta.com/topic/have-blesta-set-the-correct-language-for-dates-in-invoices-and-notices Paul 1 Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.