Project

General

Profile

Actions

Bug #2252

open

gettext should search in several directories

Added by Igor Pashev over 10 years ago. Updated over 9 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
Actions

Also available in: Atom PDF