This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: gettext: if looking for .mo in default locations, also look in locale-bundle location
Type: Stage:
Components: Library (Lib) Versions: Python 2.7
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: Dominique.Leuenberger
Priority: normal Keywords: patch

Created on 2012-08-03 19:11 by Dominique.Leuenberger, last changed 2022-04-11 14:57 by admin.

Files
File name Uploaded Description Edit
python-bundle-lang.patch Dominique.Leuenberger, 2012-08-03 19:11 Introduce logic to look for translations in /usr/share/locale-bundle
Messages (2)
msg167343 - (view) Author: Dominique Leuenberger (Dominique.Leuenberger) Date: 2012-08-03 19:11
Coming from openSUSE, might be a bit special, but worthy the discussion.

Background:
 - Language files are per design split off from the main application rpm (package-lang). Rational is 'space concerns for live CDs'
- We offer bundle-lang-<LANG> packages, with a set of commonly used applications translations bundled in one 'Please translate my system to LANG' RPM. Again: for the Live CD, we do bundle a limited set of language files (thus installing a subset of all .mo files provided by all packages).

=> now as rpm does not like a file at the same location to be owned by two packages, the bundle-lang-<LANG> package 'moves' it's own .mo files to /usr/share/locale-bundle, wheras the <PACKAGE>-lang rpm installs the .mo files under /usr/share/locale (default path).

Now, the issue is gettext.py checks the path proposed by the calling app using bindtextdomain(domain,[path]).

If path is defined, it's being used, otherwise /usr/share/locale is being used.

The attached patch extends the logic to:
- If path is being used
  - If path = _default_localedir
    - Check for .mo in _default_bundlelocaledir
    - if not found in bundle, check in _default_localedir
  - Use path
- if path is not defined
  - use _default_bundlelocaledir
    - if not found, use _default_localedir

=> so in any case, if default_bundlelocaledir is not used, it falls back to _default_localedir, and as such I'd argue is unintrusive and keeping the patch in upstream codebase (instead of downstream package) would make sense.

Best regards,
msg223058 - (view) Author: Mark Lawrence (BreamoreBoy) * Date: 2014-07-14 20:45
@Dominique please accept our apologies for the delay in replying.  Can someone please review the attached patch as it's only five extra lines.  I'd do it myself but I know nothing about openSUSE, internationalization or gettext.
History
Date User Action Args
2022-04-11 14:57:33adminsetgithub: 59757
2019-04-26 19:32:48BreamoreBoysetnosy: - BreamoreBoy
2014-07-14 20:45:38BreamoreBoysetnosy: + BreamoreBoy
messages: + msg223058
2012-08-03 19:11:07Dominique.Leuenbergercreate