Jump to content

Invoices and notices generated in other languages (i.e. Spanish) have dates shown in English.


Luis M.

Recommended Posts

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.

 

screenshot1.png

screenshot2.png

screenshot3.png

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...