Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gettext: if looking for .mo in default locations, also look in locale-bundle location #59757

Open
DominiqueLeuenberger mannequin opened this issue Aug 3, 2012 · 2 comments
Labels
stdlib Python modules in the Lib dir

Comments

@DominiqueLeuenberger
Copy link
Mannequin

DominiqueLeuenberger mannequin commented Aug 3, 2012

BPO 15552
Files
  • python-bundle-lang.patch: Introduce logic to look for translations in /usr/share/locale-bundle
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = None
    created_at = <Date 2012-08-03.19:11:07.485>
    labels = ['library']
    title = 'gettext: if looking for .mo in default locations, also look in locale-bundle location'
    updated_at = <Date 2019-04-26.19:32:48.439>
    user = 'https://bugs.python.org/DominiqueLeuenberger'

    bugs.python.org fields:

    activity = <Date 2019-04-26.19:32:48.439>
    actor = 'BreamoreBoy'
    assignee = 'none'
    closed = False
    closed_date = None
    closer = None
    components = ['Library (Lib)']
    creation = <Date 2012-08-03.19:11:07.485>
    creator = 'Dominique.Leuenberger'
    dependencies = []
    files = ['26679']
    hgrepos = []
    issue_num = 15552
    keywords = ['patch']
    message_count = 2.0
    messages = ['167343', '223058']
    nosy_count = 1.0
    nosy_names = ['Dominique.Leuenberger']
    pr_nums = []
    priority = 'normal'
    resolution = None
    stage = None
    status = 'open'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue15552'
    versions = ['Python 2.7']

    Linked PRs

    @DominiqueLeuenberger
    Copy link
    Mannequin Author

    DominiqueLeuenberger mannequin commented Aug 3, 2012

    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,

    @DominiqueLeuenberger DominiqueLeuenberger mannequin added the stdlib Python modules in the Lib dir label Aug 3, 2012
    @BreamoreBoy
    Copy link
    Mannequin

    BreamoreBoy mannequin commented Jul 14, 2014

    @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.

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    stdlib Python modules in the Lib dir
    Projects
    Status: No status
    Status: No status
    Development

    No branches or pull requests

    0 participants