LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 05-13-2011, 03:58 PM   #1
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,576
Blog Entries: 31

Rep: Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195
Locale adjustment not working as expected


Hello

On Slackware64 13.1 the as-installed en_GB locale gave Sunday as the first day of the week. This was not an issue until Xfce's Orage calendar was used when its display of Sunday as the first day of the week was offputting for someone used to Monday. A minor inconvenience but expected to be easy to fix.

At the command line:
Code:
c@CW8:~$ export LANG=en_GB  <== same for en_GB.utf8
c@CW8:~$ locale -k -c LC_TIME
LC_TIME
abday="Sun;Mon;Tue;Wed;Thu;Fri;Sat"
day="Sunday;Monday;Tuesday;Wednesday;Thursday;Friday;Saturday"
[snip]
first_weekday=2
first_workday=2
[snip]
I tried to adjust the locale following information in the locale (5) man page. Based on that I edited /usr/share/i18n/locales/en_GB, changing:
  • week from 7;19971130;4 to 7;19971201;4
  • first_weekday from 2 to 1
  • first_workday from 2 to 1
  • abday, moving "<U0053><U0075><U006E>" from the beginning of the list to the end
  • day, moving "<U0053><U0075><U006E><U0064><U0061><U0079>" from the beginning of the list to the end
Following information in the localedef (1) man page and the Arkanis Blog:
Code:
root@CW8:~# localedef -i en_GB -f UTF-8 en_GB
[no output]
Now the date command and Orage display Sun 14 May 2011 when it should be Sat.

What have I misunderstood?

Best

Charles
 
Old 05-14-2011, 05:09 AM   #2
cepheus11
Member
 
Registered: Nov 2010
Location: Germany
Distribution: Gentoo
Posts: 285

Rep: Reputation: 89
By changing week you already set the start to "Monday", the changes to first_weekday and first_workday are too much. They already honour the value of "week". However, the XFCE calendar seems to not honour "first_weekday", it should have displayed monday as first day, even without any changes: 1997-11-30 was a sunday, with first_weekday=2 there is "monday" as week start.

Be aware that your changes to files in /usr/share/... will be overwritten in most distributions when the package containing the files is updated. Maybe it's better to make the changes permanent via an environment variable somewhere in /etc/env.d/. The "best practice" depends on your distro.
 
Old 05-14-2011, 06:22 AM   #3
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,576
Blog Entries: 31

Original Poster
Rep: Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195
Thanks cepheus11

So days and abdays simply define a sequence of day names which start on the date nominated in week? And it is first_weekday and first_workday which define the first day of the weeks. For completeness, this can be explored at the command line (I've reverted to the as-installed locale):
Code:
c@CW8:~$ locale day
Sunday;Monday;Tuesday;Wednesday;Thursday;Friday;Saturday
c@CW8:~$ locale first_weekday
2
So the first day of the week is 1-based index 2 which is Monday. Not surprisingly then, the Slackware64 13.1 en_GB locale is set up correctly.

Thus the problem is in Orage but they say not so; from the Orage FAQ:

This really is a problem in your distro. You can check how your operating system reports these to GTK+ and hence to orage, which uses strictly gtk calendar widget and does not tune these settings itself. Command locale first_weekday shows which day is the first day in your system. Usually Sunday is day number 1, but that can be changed so check that with command locale day, which shows days starting from day number 1. You may try with different LANG enevironment variable settings and calendar view in orage should change accordingly. Log a new bug for orage if you think it is not working correctly. Look more information from Xfce bug 1237 or from Debian bug 215466

If you are adventurous, you can actually fix these yourself. You need to find your locale definition file (like fi_FI or fr_FR). locate is your friend here and helps finding it. After that you can check what the setting is: grep first_weekday fi_FI and change that if it is wrong and after that you need to recompile your locale database.


It was that last paragraph that got me to fix the "ain't broke".

The Debian bug is from 2003 and is about a Finnish locale file not having first_weekday and first_workday lines.

The Xfce bug is closely related and has useful discussion but was closed in 2007 as invalid because Orage "calls simply gtk_calendar_new ()" so if the calendar does not match the locale it is a GTK library problem. The GtkCalendar API documentation does not mention locale.

Netsearching for GtkCalendar locale bugs found nothing.

Time to post to the xfce4-dev@xfce.org mailing list, asking if there problem has been reported as a GTK bug ...
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] >> not working as expected MartenH Linux - Newbie 5 08-22-2010 11:35 AM
ln command not working as expected walterbyrd Linux - Software 3 01-04-2008 02:51 PM
alias not working as expected marozsas Linux - General 3 06-01-2006 01:46 PM
Useradd - not working as expected Paean Solaris / OpenSolaris 13 01-31-2006 05:06 PM
up2date not working as expected johnny13 Linux - Newbie 7 07-21-2003 02:15 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 12:44 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration