bug#33211: coreutils.mo is in both LC_TIME and LC_MESSAGES folders

2019-01-18 Thread Assaf Gordon

tags 33211 notabug
close 33211
stop

Hell0,

On 2018-10-30 3:33 p.m., scootergrisen wrote:

I wonder if its a mistake that in Fedora i can see coreutils.mo in both:
/usr/share/locale/*/LC_TIME
/usr/share/locale/*/LC_MESSAGES

They seem to be identical.


This is not a mistake (nor a bug).

Not only they are identical, one is a symlink to the other:

  $ cd /usr/local/share/locale/ca
  $ ls -log LC_*/coreutils.mo
  -rw-r--r-- 1 379478 Dec 27 22:47 LC_MESSAGES/coreutils.mo
  lrwxrwxrwx 1 27 Dec 27 22:47 LC_TIME/coreutils.mo -> 
../LC_MESSAGES/coreutils.mo



coreutils.mo is the only file i see in the /usr/share/locale/*/LC_TIME 
folder.


Most programs that use gettext (https://www.gnu.org/software/gettext/)
are concerned with user visible messages, hence most of the translation
only use LC_MESSAGES directory, and there's no need for other files.

Few coreutils programs (e.g. date, sort) do care about translation of
time-related strings (e.g. days / month names).
That's why coreutils also uses LC_TIME.

One can ask for the date/time to use one local,
and messages to use another:

  $ export LC_TIME=ru_RU.UTF-8
  $ export LANGUAGE=ja_JP.UTF-8

  $ date
  Пт янв 18 01:06:10 MST 2019

  $ date -d ABCD
  date: `ABCD' は無効な日付です


Should the /usr/share/locale/*/LC_TIME/coreutils.mo files be removed so 
there is only the /usr/share/locale/*/LC_MESSAGES/coreutils.mo files?


No, Both should exist, otherwise setting LC_TIME won't work.

Technically, the translated strings for both messages and time are
stored in the same file - that's why when coreutils is installed,
one is a symlink to the other.


Even more technically, when building from source,
the file "bootstrap.conf" contains the following:

  # Other locale categories that need message catalogs. 


  EXTRA_LOCALE_CATEGORIES=LC_TIME

The directory "./po" is populated with available translation
(e.g. "ru.po" and "ja.po").

During the build, the ".po" files are compiled into binary ".gmo" files.
During installation, the files are copied/symlinked:
  $ make install
  [...]
  make[2]: Entering directory '/home/gordon/projects/coreutils/po'
  installing af.gmo as /usr/local/share/locale/af/LC_MESSAGES/coreutils.mo
  installing af.gmo link as /usr/local/share/locale/af/LC_TIME/coreutils.mo
  installing be.gmo as /usr/local/share/locale/be/LC_MESSAGES/coreutils.mo
  installing be.gmo link as /usr/local/share/locale/be/LC_TIME/coreutils.mo
  [...]


Hope this addresses the issue.
I'm closing this as "not a bug", but discussion can continue by replying
to this thread.

regards,
 - assaf





bug#33211: coreutils.mo is in both LC_TIME and LC_MESSAGES folders

2018-10-30 Thread scootergrisen

I wonder if its a mistake that in Fedora i can see coreutils.mo in both:
/usr/share/locale/*/LC_TIME
/usr/share/locale/*/LC_MESSAGES

They seem to be identical.

coreutils.mo is the only file i see in the /usr/share/locale/*/LC_TIME 
folder.


Should the /usr/share/locale/*/LC_TIME/coreutils.mo files be removed so 
there is only the /usr/share/locale/*/LC_MESSAGES/coreutils.mo files?