jamesmills / laravel-timezone

Enable user Timezones in your application.
MIT License
677 stars 91 forks source link

Added option to enable Carbon's translatedFormat #69

Closed aldesrahim closed 2 years ago

aldesrahim commented 3 years ago

Change format to translatedFormat for enabling translation.

Tested on Laravel 8

jamesmills commented 3 years ago

Hi @aldesrahim thanks for the contribution.

What does this actually do?

aldesrahim commented 3 years ago

based on carbon documentation

Format as ->format() do (using date replacements patterns from http://php.net/manual/fr/function.date.php) but translate words whenever possible (months, day names, etc.) using the current locale. Method added: 2.16.0

aldesrahim commented 3 years ago

Hi @jamesmills, the translatedFormat do is like format but translated to current language, its very useful for multi-lang app. Thanks.

jamesmills commented 3 years ago

My only issue with this is that it will force everything to use the translatedFormat when sometimes this might not be either expected or wanted.

I feel we need to add an option/flag or additional function for this.

Thoughts all?

aldesrahim commented 3 years ago

Hi @jamesmills, thanks for your response.

I've no problem if you want to add an option/flag or additional function for this, I agree to whatever path you're choosing 👍

aldesrahim commented 2 years ago

Hi @jamesmills, i've added some changes for enabling/toggling translation. if you have time, please take a look at my PR. Thank you !