Allow finding locale in system location on Linux

Bug #542429 reported by Toshio Kuratomi
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
QBzr
Fix Released
Medium
Toshio Kuratomi

Bug Description

On Linux, locale files should be placed in /usr/share/locale/ to conform to the FHS http://www.pathname.com/fhs/pub/fhs-2.3.html#SPECIFICOPTIONS15

I'll attach a patch which allows qbzr to look for the locale files in that location if they aren't found in the directory relative to the install. This is backwards compatible (as the current location is looked for first) but allows Linux distributions to move the locale directory under /usr/share/ if they choose.

Related branches

Revision history for this message
Toshio Kuratomi (toshio) wrote :
Revision history for this message
Alexander Belchenko (bialix) wrote : Re: [Bug 542429] Re: Allow finding locale in system location on Linux

Toshio Kuratomi пишет:
> ** Attachment added: "Short patch to check for locales in /usr/share/locale if they don't exist in the default location relative to the plugin installation"
> http://launchpadlibrarian.net/41366002/qbzr-localedir.patch

This patch makes sense only for Linux. It definitely won't for Windows.
And I'm not sure how it will work for Mac OS X.

Also there is note in the documentation for Python gettext module:

The default locale directory is system dependent; for example, on RedHat
Linux it is /usr/share/locale, but on Solaris it is /usr/lib/locale. The
gettext module does not try to support these system dependent defaults;
instead its default is sys.prefix/share/locale. For this reason, it is
always best to call bindtextdomain() with an explicit absolute path at
the start of your application.

So, at least I think we should change the preferences to
/usr/share/locale only if we on Linux. E.g. there should be condition
like that

if sys.platform == 'linux2':
     ...

Revision history for this message
Toshio Kuratomi (toshio) wrote :

Note: The code should do the right thing on windows and macos because the default remains the same:
  os.path.join(os.path.realpath(os.path.dirname(__file__)), '..', 'locale')

It's only when that directory is not available that we try the Linux system location. Good point about Solaris, though. Updated patch attached.

Revision history for this message
Toshio Kuratomi (toshio) wrote :

ping?

Revision history for this message
Alexander Belchenko (bialix) wrote :

yep, I'll merge.

Changed in qbzr:
status: New → Confirmed
importance: Undecided → Medium
assignee: nobody → Alexander Belchenko (bialix)
milestone: none → 0.19b2
Changed in qbzr:
assignee: Alexander Belchenko (bialix) → Toshio Kuratomi (toshio)
status: Confirmed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.