Bug 509424 - Switch to using python's gettext module
Switch to using python's gettext module
Status: CLOSED UPSTREAM
Product: Fedora
Classification: Fedora
Component: revisor (Show other bugs)
rawhide
All Linux
low Severity medium
: ---
: ---
Assigned To: Jeroen van Meeuwen
Fedora Extras Quality Assurance
:
Depends On:
Blocks: rhplectomy
  Show dependency treegraph
 
Reported: 2009-07-02 13:48 EDT by Jeremy Katz
Modified: 2009-09-07 18:30 EDT (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2009-09-07 18:30:43 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


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

  None (edit)
Description Jeremy Katz 2009-07-02 13:48:56 EDT
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 13:50:22 EDT
Created attachment 350318 [details]
switch to gettext directly
Comment 2 Jonathan Steffan 2009-07-04 16:14:22 EDT
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 09:34:07 EDT
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 18:30:43 EDT
Finalized in a4e103b943bd19dda2627114644a2e4a5f225554

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