Merge lp://staging/~jr/bzr/i18n-options into lp://staging/bzr

Proposed by Jonathan Riddell
Status: Rejected
Rejected by: Jonathan Riddell
Proposed branch: lp://staging/~jr/bzr/i18n-options
Merge into: lp://staging/bzr
Diff against target: 85 lines (+61/-0)
1 file modified
bzrlib/commands.py (+61/-0)
To merge this branch: bzr merge lp://staging/~jr/bzr/i18n-options
Reviewer Review Type Date Requested Status
Vincent Ladeuil Needs Information
Review via email: mp+72915@code.staging.launchpad.net

Description of the change

Translate command options help text (e.g. the "Show help message." in "-h, --help Show help message.")

This copies and replaces the normal optparse format_options with a local version that adds gettext()

optparse normally expects gettext() to be called when adding the option but that can't be done with our i18n classes because running our i18n.install() imports config which imports commands which initialises the global Options classes so they exist before i18n can be installed.

Not very elegant :(

To post a comment you must log in.
Revision history for this message
Vincent Ladeuil (vila) wrote :

Some of the problems you're encountering were already mentioned in https://code.launchpad.net/~songofacandy/bzr/i18n-command/+merge/62752

Some of the proposed solutions (which couldn't be applied at that time) may also apply here.

Mainly, OptionParser use HelpFormatter and using our own derived class (instead of overriding lower level methods) should address the import issues by delaying the help formatting until our i18n framework is installed.

As said in the review above, this may require a bit more work upfront but should result in less code in the end and simplify the maintenance in the long term.

Also if "imports config which imports commands" is probably fixable.

I can help on both points if you want.

review: Needs Information
Revision history for this message
Vincent Ladeuil (vila) wrote :

@jr: ping, needs any help ?

Revision history for this message
Jonathan Riddell (jr) wrote :

Unmerged revisions

6101. By Jonathan Riddell

replace format_option with our version which adds gettext() call

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
The diff is not available at this time. You can reload the page or download it.