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

Custom language and date formatting #1307

Closed
Nexulo opened this issue Dec 13, 2021 · 1 comment · Fixed by #1349
Closed

Custom language and date formatting #1307

Nexulo opened this issue Dec 13, 2021 · 1 comment · Fixed by #1349
Labels
impact: low a minor issue for some people status: working on it Someone is already working on this issue type: enhancement New feature or request

Comments

@Nexulo
Copy link

Nexulo commented Dec 13, 2021

Is it currently not possible to adjust the format of a date when listing the models? For example, the publish date is displayed as "Month Day, Year" (Dec 10, 2021), but I would rather have the German notation "dd.mm.yyyy H:i:s" (10.12.2021 10:00:00).
I am aware that it is possible via an additional function in the model (e.g. getFormattedPublishStartDateAttribute). But unfortunately the publish date is formatted wrong in several areas, for example also when displaying the publish status when editing an entry of the model.

Also, I have not found a way to translate the term "Scheduled" (which appears in various areas in twill) into German. I saw this word is output 1:1 in the Vue app and is not overridable with a custom language, is that correct?

Bildschirmfoto 2021-12-13 um 09 38 29

@pboivin
Copy link
Contributor

pboivin commented Dec 14, 2021

Hi @maisen20,

There are a few settings you could tweak in config/twill.php for publication dates:

    'publish_date_24h' => false, // enable 24h format in publisher dates
    'publish_date_format' => 'd F Y H:i', // format used by publication date pickers
    'publish_date_display_format' => 'DD MMMM YYYY HH:mm', // format used when displaying the publication date

Another option to explore would be to override the serializeDate() method on your model:

protected function serializeDate(DateTimeInterface $date)
{
    return $date->format('Y-m-d');
}

You're right, it seems like the Scheduled label and a few others are still hardcoded in the Vue components. If you have some time to help out with this, it would be really appreciated! The labels can be translated via the $trans() helper method. Here's an example from a previous PR :
https://github.com/area17/twill/pull/954/files#diff-71c652ea6bb1e4909e58793f2d182bcdc5244d33c1ca96c020ad0a7c5fdc70a5R33

haringsrob added a commit to haringsrob/twill that referenced this issue Jan 5, 2022
haringsrob added a commit to haringsrob/twill that referenced this issue Jan 5, 2022
haringsrob added a commit to haringsrob/twill that referenced this issue Jan 12, 2022
haringsrob added a commit to haringsrob/twill that referenced this issue Jan 12, 2022
haringsrob added a commit to haringsrob/twill that referenced this issue Jan 14, 2022
haringsrob added a commit to haringsrob/twill that referenced this issue Jan 14, 2022
haringsrob added a commit to haringsrob/twill that referenced this issue Jan 14, 2022
haringsrob added a commit to haringsrob/twill that referenced this issue Jan 14, 2022
@ifox ifox added impact: low a minor issue for some people status: working on it Someone is already working on this issue type: enhancement New feature or request labels Feb 6, 2022
haringsrob added a commit to haringsrob/twill that referenced this issue Feb 9, 2022
haringsrob added a commit that referenced this issue Feb 25, 2022
* #1307: Auto add publish_start_date if setup.

* 1307: Make labels translatable + Use config date format for displaying the sceduled publish date.

* #1307: Make the scheduled column opt-in.

* #1307: Config store.

* #1307: Regenerate language files.

* #1307: Backwards compatability + remove unused.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
impact: low a minor issue for some people status: working on it Someone is already working on this issue type: enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants