Project

General

Profile

Bug #2252

gettext should search in several directories

Added by Igor Pashev over 8 years ago. Updated over 7 years ago.

Status:
In Progress
Priority:
High
Assignee:
-
Category:
-
Start date:
2012-03-07
Due date:
% Done:

70%

Estimated time:
Difficulty:
Bite-size
Tags:
needs-triage
Gerrit CR:

Description

Most programmes ship message catalogs in directories named after language code, without country code or encoding (e. g. ru, but not ru_RU or ru_RU.UTF-8). But locale is set with full specification (ru_RU.UTF-8). Currently Illumos' libc searchs only in ru_RU.UTF-8, and fails, cause there are no message catalogs there. Thus programmes always speak english.

Instead, it should trim language specification (ru_RU.UTF-8 -> ru_RU -> ru) until message catalog is found. Just like glibc on Linux:

Linux:

# strace chmod --help
...
open("/usr/share/locale/ru_RU.UTF-8/LC_MESSAGES/coreutils.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale/ru_RU.utf8/LC_MESSAGES/coreutils.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale/ru_RU/LC_MESSAGES/coreutils.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale/ru.UTF-8/LC_MESSAGES/coreutils.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale/ru.utf8/LC_MESSAGES/coreutils.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale/ru/LC_MESSAGES/coreutils.mo", O_RDONLY) = 3
...

Illumos:

# truss /usr/gnu/bin/chmod --help
...
sysconfig(_CONFIG_PAGESIZE)                     = 4096
open("/usr/gnu/share/locale/ru_RU.UTF-8/LC_MESSAGES/coreutils.mo", O_RDONLY) Err#2 ENOENT
ioctl(1, TCGETA, 0x08046B40)                    = 0
...


Files

locale.patch (1.26 KB) locale.patch Igor Pashev, 2012-06-03 04:33 AM

History

#1

Updated by Igor Pashev about 8 years ago

  • Status changed from New to In Progress
  • % Done changed from 0 to 70
#2

Updated by Igor Pashev about 8 years ago

  • Assignee set to Igor Pashev
#3

Updated by Igor Pashev about 8 years ago

root@oi:/export/home/illumos-gate# locale
LANG=ru_RU.UTF-8
LC_CTYPE="ru_RU.UTF-8" 
LC_NUMERIC="ru_RU.UTF-8" 
LC_TIME="ru_RU.UTF-8" 
LC_COLLATE="ru_RU.UTF-8" 
LC_MONETARY="ru_RU.UTF-8" 
LC_MESSAGES="ru_RU.UTF-8" 
LC_ALL=
root@oi:/export/home/illumos-gate# LD_PRELOAD_32=`pwd`/proto/root_i386/lib/libc.so.1 mc --version
.....
С поддержкой событий X11
>>>>>>>>>>>>>>>> /usr/share/locale/ru_RU.UTF-8
>>>>>>>>>>>>>>>> /usr/share/locale/ru_RU
>>>>>>>>>>>>>>>> /usr/share/locale/ru
>>>>>>>>>>>>>>>> /usr/share/locale/ru/LC_MESSAGES
С поддержкой интернационализации
>>>>>>>>>>>>>>>> /usr/share/locale/ru_RU.UTF-8
>>>>>>>>>>>>>>>> /usr/share/locale/ru_RU
>>>>>>>>>>>>>>>> /usr/share/locale/ru
>>>>>>>>>>>>>>>> /usr/share/locale/ru/LC_MESSAGES
С поддержкой многих кодировок
>>>>>>>>>>>>>>>> /usr/share/locale/ru_RU.UTF-8
>>>>>>>>>>>>>>>> /usr/share/locale/ru_RU
>>>>>>>>>>>>>>>> /usr/share/locale/ru
>>>>>>>>>>>>>>>> /usr/share/locale/ru/LC_MESSAGES
...
root@oi:/export/home/illumos-gate# ln -sf ru /usr/share/locale/ru_RU.UTF-8
root@oi:/export/home/illumos-gate# LD_PRELOAD_32=`pwd`/proto/root_i386/lib/libc.so.1 mc --version
....
С поддержкой фоновых операций
>>>>>>>>>>>>>>>> /usr/share/locale/ru_RU.UTF-8
>>>>>>>>>>>>>>>> /usr/share/locale/ru_RU.UTF-8/LC_MESSAGES
С поддержкой мыши в xterm
>>>>>>>>>>>>>>>> /usr/share/locale/ru_RU.UTF-8
>>>>>>>>>>>>>>>> /usr/share/locale/ru_RU.UTF-8/LC_MESSAGES
С поддержкой событий X11
>>>>>>>>>>>>>>>> /usr/share/locale/ru_RU.UTF-8
>>>>>>>>>>>>>>>> /usr/share/locale/ru_RU.UTF-8/LC_MESSAGES
С поддержкой интернационализации
....

#5

Updated by Igor Pashev over 7 years ago

  • Assignee deleted (Igor Pashev)

Also available in: Atom PDF