Bug 488088 - Missing translation for week days and months
Summary: Missing translation for week days and months
Status: RESOLVED FIXED
Alias: None
Product: dolphin
Classification: Applications
Component: general (show other bugs)
Version: 24.05.0
Platform: Other Linux
: NOR minor
Target Milestone: ---
Assignee: Dolphin Bug Assignee
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-06-05 18:56 UTC by Jet
Modified: 2024-08-23 07:53 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jet 2024-06-05 18:56:06 UTC
When sorting by date in Dolphin, the sorting itself works flawlessly, however the labels describing the time (eg Wednesday etc.) are not translated from English. I am using a Polish locale ( $LANG=pl_PL.UTF-8 ). But in other places such as the time calendar widget, or Merkuro the translations are present and working.
Comment 1 Jérôme L 2024-08-04 11:19:53 UTC
If this issue is about labels when grouping by date, then I am facing the same issue in French (LANG=fr_FR.UTF-8).

STEPS TO REPRODUCE
1. Open Dolphin in another language than English
2. 3. Open "Recent Locations" or "Recent Files"
or
2. Menu > View > Show in groups
3. Sort by date
4. Relative dates are translated/translatable (Today, Yesterday, One Week Ago)
5. Day/month are not (Wednesday, July ...)

SOLUTION
The issue is coming from KFileItemModel::timeRoleGroups https://invent.kde.org/system/dolphin/-/blob/master/src/kitemviews/kfileitemmodel.cpp?ref_type=heads#L2410
According to Qt documentation, QDateTime::toString always format in English https://doc.qt.io/qt-6/qdatetime.html#toString-1.
Creating `QLocale locale;` then using `locale.toString(fileTime, ...);` solve this (1 line added, and 13 lines changed).
I am looking for how to contribute those changes.

SOFTWARE/OS VERSIONS
KDE Plasma Version: 6.1.3
KDE Frameworks Version: 6.4.0
Qt Version: 6.7.2
Dolphin Version: 24.05.2
Comment 2 fanzhuyifan 2024-08-19 15:56:11 UTC
(In reply to Jérôme L from comment #1)
> If this issue is about labels when grouping by date, then I am facing the
> same issue in French (LANG=fr_FR.UTF-8).
> 
> STEPS TO REPRODUCE
> 1. Open Dolphin in another language than English
> 2. 3. Open "Recent Locations" or "Recent Files"
> or
> 2. Menu > View > Show in groups
> 3. Sort by date
> 4. Relative dates are translated/translatable (Today, Yesterday, One Week
> Ago)
> 5. Day/month are not (Wednesday, July ...)
> 
> SOLUTION
> The issue is coming from KFileItemModel::timeRoleGroups
> https://invent.kde.org/system/dolphin/-/blob/master/src/kitemviews/
> kfileitemmodel.cpp?ref_type=heads#L2410
> According to Qt documentation, QDateTime::toString always format in English
> https://doc.qt.io/qt-6/qdatetime.html#toString-1.
> Creating `QLocale locale;` then using `locale.toString(fileTime, ...);`
> solve this (1 line added, and 13 lines changed).
> I am looking for how to contribute those changes.
> 
> SOFTWARE/OS VERSIONS
> KDE Plasma Version: 6.1.3
> KDE Frameworks Version: 6.4.0
> Qt Version: 6.7.2
> Dolphin Version: 24.05.2

https://community.kde.org/Get_Involved/development

You are welcome to submit a MR on gitlab.
Comment 3 Bug Janitor Service 2024-08-21 23:28:44 UTC
A possibly relevant merge request was started @ https://invent.kde.org/system/dolphin/-/merge_requests/819
Comment 4 Méven 2024-08-23 07:53:11 UTC
Git commit 14f17839ab2dc3ddca8af1c66eaeb40df5ab9f3f by Méven Car, on behalf of Jérôme Lécuyer.
Committed on 23/08/2024 at 07:51.
Pushed by meven into branch 'master'.

Use QLocale to display localized time role group

Use QLocale to format the QDateTime displayed as the role/label of a group.
`QDateTime::toString` format the date and month names in English.
`QLocale::toString` returns them localized.
See the note about day and month names at https://doc.qt.io/qt-6/qdatetime.html#toString

M  +22   -21   src/kitemviews/kfileitemmodel.cpp

https://invent.kde.org/system/dolphin/-/commit/14f17839ab2dc3ddca8af1c66eaeb40df5ab9f3f