This forum has been archived. All content is frozen. Please use KDE Discuss instead.

How can I use a custom locale file?

Tags: None
(comma "," separated)
User avatar
sparhawk
Registered Member
Posts
433
Karma
0
OS

How can I use a custom locale file?

Sun Mar 27, 2016 8:22 am
I'm attempting to modify my locale at `/usr/share/i18n/locales/en_AU`. Specifically, I'm adding the following line to the `LC_TIME` section.

Code: Select all
first_weekday=2


I then run `sudo locale-gen` and restart. `$ locale -ck LC_TIME` and `$ cal` show the setting has correctly changed. However, KDE Plasma (korganizer) does not. In addition, the GUI to select locale (System Settings > Personalisation > Regional Settings > Formats > Detailed Settings > Time) seems to be missing some locales from `/usr/share/i18n/locales/`, for example `en_DK` aka "Denmark - English", and a few custom files I've created (e.g. en_AU_custom). Does Plasma read locale files from somewhere else, or do I need to refresh the cache?

(Previously posted here with no response.)

Last edited by sparhawk on Mon Mar 28, 2016 6:05 am, edited 1 time in total.
luebking
Karma
0
I've no idea of what I'm talking about, but grepping the sources, it looks as if korganizer would use a nice mixture of klocale and qlocale, so I suggest to copy the relevant sections from kdeglobals and kcmlocale-grouping of the ~/.kde/share/config from KDE4 to resp. ~/.config files for KDE5.
User avatar
sparhawk
Registered Member
Posts
433
Karma
0
OS
Thanks luebking. I could find kdeglobals in both `~/.kde4/share/config` and `~/.config`. However, when I grepped both for "week" or "day" (case-insensitive), I couldn't find anything. I couldn't find any detailed setting for specifying locales either. I also searched for kcmlocale-grouping, but could only find it at `~/.kde4/share/config/kcmlocale-grouping`. There was no file for Plasma 5.

I would have thought that Plasma would read the full details of the locale configuration from a file somewhere, similar to the full files at `/usr/share/i18n/locales/`.
luebking
Karma
0
there is no kf5 file, because the config doesn't exist in kf5.
however, if klocale (kde4support lib) should still read from there... it won't find it in that config path, though.
User avatar
sparhawk
Registered Member
Posts
433
Karma
0
OS
I'm not sure if I totally understand. So are you saying that Plasma 5's locale is configured by klocale (i.e. kde4support)? I'm still not certain which locale files to modify.
luebking
Karma
0
korganizer (which is not "plasma 5") uses a library that extends KF5 with an SC4 compatibility layer.
*If* that library reads the KDE locale settings as used in KDE4, it will look for the KDE4 config file, but in the KF5 config path.

I btw, doubt that the environment driven QLocale will be able to change the locale for running processes.
User avatar
sparhawk
Registered Member
Posts
433
Karma
0
OS
Sorry, I'm fairly lost now. (Perhaps that's obvious!) So you are saying that the only *possible* solution would be making sure the KDE4 config file is correct? If so, then it was probably already configured correctly, since this is a regression, and worked perfectly before.

Perhaps I should also clarify exactly what my problem is. Recently, Korganizer began starting weeks on a Sunday. I'd prefer them to start on a Monday. I'm so used to this that I missed several appointments. I changed LC_TIME from `en_AU.UTF-8` to `en_GB.UTF-8` (via Plasma's System Settings > Personalisation > Regional Settings > Formats > Detailed Settings > Time). This fixed the week problem for me.

However, this changed a whole bunch of other defaults: korganiser is now using a 24-hour clock; my panel clock is now showing a leading 0 with 12-hour time, and periods in `A.M.`, etc. It seemed to me that the best way to fix all of this would be to use the default LC_TIME of en_AU.UTF-8, and only modify the `first_weekday=2`. However, I cannot seem to do this in a way that Plasma will recognise.
luebking
Karma
0
I am saying that you shall copy the config file from the kde4 config path (~/.kde/share/config) to the kde5 config path (~/.config) - no guarantees, though. It's only based upon the perception that korganizer makes calls into the KDE4 API.
User avatar
sparhawk
Registered Member
Posts
433
Karma
0
OS
Thanks again for the reply. I tried copying `~/.kde4/share/config/kcmlocale-grouping` to `~/.config`, reverting LC_TIME via the System Settings GUI, then restarting, but this had no effect.

I previously mentioned that System Settings did not seem to contain all of the files in `/usr/share/i18n/locales/`, e.g. `en_DK`. However, I just noticed that this also works the other way around, i.e. there are some entries in System Settings that cannot be found on my computer, e.g. `wbp_AU`. I tried to `locate` these, but couldn't find them. Ideally, I'd love to be able to find these files, then manually edit one of them, so that *all* my formats are correct.

I looked at some of the formats in System Settings, but unfortunately one has to log in/out before you can tell what day of the week they start on. However, some of the choices for formats are bizarre. There doesn't seem to be any rhyme or reason to some, e.g. en_NZ uses a 12-hour clock and mi_NZ uses a 24 hour clock… or the former writes out a full day "Friday", and the latter abbreviates it "Fri". Ideally we should be able to change these… I know the GUI isn't set up for this yet, but at least via a config file.
User avatar
sparhawk
Registered Member
Posts
433
Karma
0
OS
Optimistic bump… I'm still trying to find a way to define a custom locale file that Plasma sources.
User avatar
sparhawk
Registered Member
Posts
433
Karma
0
OS
Final bump before I move to Gnome Shell (just kidding!!!).
kde-cfeck
Registered Member
Posts
93
Karma
0
Sorry, you cannot. QLocale does not read system locale files (because they lack many entries), but instead uses the CLDR database compiled into QtCore library. You will have to modify Qt sources to configure locales. See https://bugs.kde.org/show_bug.cgi?id=340982
User avatar
sparhawk
Registered Member
Posts
433
Karma
0
OS
Ahhh… Thank you very much for the reply! That is… frustrating.

I looked into the qt5 sources, but couldn't exactly work out what to modify. I found this comment in the bug you linked, which included this patch. I inspected `qtbase-opensource-src-5.7.0/src/corelib/tools/qlocale_data_p.h` and found the following lines.

Code: Select all
static const QLocaleData locale_data[] = {
//      lang   script terr    dec  group   list  prcnt   zero  minus  plus    exp quotStart quotEnd altQuotStart altQuotEnd lpStart lpMid lpEnd lpTwo sDtFmt lDtFmt sTmFmt lTmFmt ssMonth slMonth  sMonth lMonth  sDays  lDays  am,len      pm,len
...
    {     31,     7,    13,    46,    44,    59,    37,    48,    45,    43,   101,  8220,  8221,  8216,  8217, 0,6 , 0,6 , 222,9 , 222,9 , 300,6 , 10,17 , 18,7 , 25,12 , 5266,59 , 48,86 , 5266,59 , 5266,59 , 48,86 , 5266,59 , 2510,35 , 28,57 , 2545,25 , 2510,35 , 28,57 , 2545,25 , 89,2 , 87,2 , {65,85,68},  6,1 , 3869,59 , 4,4 , 4,0 , 832,18 , 850,9 ,     2,     1,     7,     6,     7 }, // English/Latin/Australia


However, I'm not sure what the abbreviated codes at the top refer to, nor the associated numbers. I searched the web but couldn't find any reference. Could you please link me to some documentation, if you know of any? Ideally I'd love to look at what all these fields mean, but I'm specifically looking to make the week start on a Monday. Thank you again for your help.
User avatar
compatico
Registered Member
Posts
106
Karma
0
OS
I'm having a similar issue with Neon - I have locale set to en_US and when I check the locale settings it shows:
locale -ck LC_TIME
...
first_weekday=1
first_workday=2

Which seems right but the calendar starts on Monday but I want it to show Sunday first as it's defined in the region settings. I used to be able to have this in Kubuntu but I can't find a way to set it in Neon.

Any ideas?
User avatar
sparhawk
Registered Member
Posts
433
Karma
0
OS
compatico wrote:Any ideas?


Did you read the rest of this thread? Basically, you can't. I've moved back to Thunderbird/Lightning. Gnome's Evolution calendar app is another reasonable option.


Bookmarks



Who is online

Registered users: Bing [Bot], Google [Bot], Yahoo [Bot]