getkirby / kirby

Kirby's core application folder
https://getkirby.com
Other
1.27k stars 167 forks source link

`intl` date handler shows wrong language when default and user language is different in panel #5913

Open afbora opened 10 months ago

afbora commented 10 months ago

intl date handler shows wrong language when default and user language is different in panel. I see all UI strings/variables as TR (user language is TR, EN default language) but intl date handler shows English.

For ex: following info output is 04 Nov, 2023, but it should be 04 Kas, 2023

type: pages
info: >
  {{ model.createdAt.toDate('dd MMM, YYYY') }}

App setup

config.file

<?php

return [
    'languages' => true,
    'languages.detect' => true,
    'panel' => [
        'language' => 'tr',
    ],
    'date' => [
        'handler' => 'intl'
    ],
];

Language

Multi-language enabled and default language is EN and locale en_US

User

Logged user language is Turkish.

Kirby

3.9.7

distantnative commented 10 months ago

So Panel user language is Turkish but you're editing English content or Turkish content?

afbora commented 10 months ago

Yes, panel user language TR and editing English content. All panel UI and language dropdown (fetching query from collections) options TR except date.

distantnative commented 10 months ago

This sounds similar to https://github.com/getkirby/kirby/issues/5269.

Where there's no obvious answer if the Panel should request the backend passing the content language or the user language as current language.

In your example, I could also see people arguing the info text should match the current content language, not the UI language.