Bug 509424 - Switch to using python's gettext module
Summary: Switch to using python's gettext module
Keywords:
Status: CLOSED UPSTREAM
Alias: None
Product: Fedora
Classification: Fedora
Component: revisor
Version: rawhide
Hardware: All
OS: Linux
low
medium
Target Milestone: ---
Assignee: Jeroen van Meeuwen
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: rhplectomy
TreeView+ depends on / blocked
 
Reported: 2009-07-02 17:48 UTC by Jeremy Katz
Modified: 2009-09-07 22:30 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2009-09-07 22:30:43 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)
switch to gettext directly (20.07 KB, patch)
2009-07-02 17:50 UTC, Jeremy Katz
no flags Details | Diff

Description Jeremy Katz 2009-07-02 17:48:56 UTC
We're hoping to kill of rhpl for Fedora 12.  The attached (untested -- my box at the office that has bandwidth and disk space is acting up and I'm not in the office still for ~ a week) patch switches revisor to use python's gettext module directly instead of rhpl.translate.  It's a pretty mechanical change. 

revisor will still depend on rhpl for keyboard stuff after this, but clumens and I are going to sit down and figure out the best way to kill that off after the holiday as there are about 4 or 5 packages in that position

Comment 1 Jeremy Katz 2009-07-02 17:50:22 UTC
Created attachment 350318 [details]
switch to gettext directly

Comment 2 Jonathan Steffan 2009-07-04 20:14:22 UTC
revisor/modgui/package_selection.py:from rhpl.translate import getDefaultLangs
revisor/modgui/lm_basic.py:from rhpl import keyboard_models
revisor/modgui/lm_basic.py:import rhpl.keyboard as keyboard

This is all that is left. Please let us know what the solution for removing this is.

Comment 3 Jeremy Katz 2009-07-27 13:34:07 UTC
For the keyboard stuff, system-config-keyboard >= 1.3.0 has the same files if you do
   import system_config_keyboard.keyboard as keyboard
   import system_config_keyboard.keyboard_models as keyboard_models
If you want to keep compat between releases, you can wrap that in a try/except ImportError piece and fall back to importing rhpl

For getDefaultLangs(), you can either require anaconda and use anaconda's implementation of the comps sorting or you also need to pull in your own version of the method (below from anaconda)

def _getDefaultLangs():
    languages = []
    for envar in ('LANGUAGE', 'LC_ALL', 'LC_MESSAGES', 'LANG'):
        val = os.environ.get(envar)
        if val:
            languages = val.split(':')
            break
    if 'C' not in languages:
        languages.append('C')

    # now normalize and expand the languages
    nelangs = []
    for lang in languages:
        for nelang in gettext._expand_lang(lang):
            if nelang not in nelangs:
                nelangs.append(nelang)
    return nelangs

Comment 4 Jonathan Steffan 2009-09-07 22:30:43 UTC
Finalized in a4e103b943bd19dda2627114644a2e4a5f225554


Note You need to log in before you can comment on or make changes to this bug.