lp://qastaging/~zyga/command-not-found/rework-locale-support

Created by Zygmunt Krynicki and last modified
Get this branch:
bzr branch lp://qastaging/~zyga/command-not-found/rework-locale-support
Only Zygmunt Krynicki can upload to this branch. If you are Zygmunt Krynicki please log in for upload directions.

Branch merges

Related bugs

Related blueprints

Branch information

Owner:
Zygmunt Krynicki
Project:
command-not-found
Status:
Merged

Recent revisions

140. By Zygmunt Krynicki

Rework locale support.

This patch fixes locale issues I have observed on my laptop while testing
unrelated patch. There are three changes that seem to make everything work:

1) OptionParser is broken with regards to locale support. All the messages it
translates are converted to sys.getdefaultencoding() which seems to be 'ascii'.
This breaks our UTF-8 encoded strings so to work around that a simple subclass
is provided that uses locale.getpreferredencoding(). This is much better as the
returned values depends on user's locale setting.

2) Drop the set of hacky gettext/nogettext functions and use
gettext.translation().ugettext() everywhere. This makes all the c-n-f modules
work correctly and return translated unicode strings.

3) In command-not-found executable call
gettext.translation().install(unicode=True) to provide fallback translations
for the entire runtime. Calling install() makes '_' available in the builtin
namespace which covers use cases in the executable itself (command-not-found)
as well as in arbitrary places that use _ to resolve translations elsewhere in
python.

I have tested this on natty with several combinations of LANG=... settings,
including different encodings (.UTF-8, ISO8859-{1,2}) and it seems to work
every time.

139. By Michael Vogt

merged lp:~julien-nicoulaud/command-not-found/fix-zsh-hook,
many thanks to Julien Nicoulaud (LP: #624565)

137. By Zygmunt Krynicki

Merge speedup patch from Daniel Fahlgren

136. By Michael Vogt

releasing version 0.2.41ubuntu5

135. By Michael Vogt

releasing version 0.2.41ubuntu4

134. By Michael Vogt

releasing version 0.2.41ubuntu3

133. By Michael Vogt

* automatically update the scan.data in the pre-build.sh hook
  (thanks to Steve Langasek for this suggestion)
* updated to oneiric

132. By Michael Vogt

Migrate to dh_python2. LP: #788514.

131. By Michael Vogt

releasing version 0.2.41ubuntu2

Branch metadata

Branch format:
Branch format 7
Repository format:
Bazaar repository format 2a (needs bzr 1.16 or later)
Stacked on:
lp://qastaging/~command-not-found-developers/command-not-found/trunk
This branch contains Public information 
Everyone can see this information.

Subscribers