/b-gtk/fix-viz

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/b-gtk/fix-viz

« back to all changes in this revision

Viewing changes to errors.py

  • Committer: Vincent Ladeuil
  • Date: 2008-05-05 18:16:46 UTC
  • mto: (487.1.1 gtk)
  • mto: This revision was merged to the branch mainline in revision 490.
  • Revision ID: v.ladeuil+lp@free.fr-20080505181646-n95l8ltw2u6jtr26
Fix bug #187283 fix replacing _() by _i18n().

* genpot.sh 
Remove duplication. Add the ability to specify the genrated pot
file on command-line for debugging purposes.

* po/olive-gtk.pot:
Regenerated.

* __init__.py, branch.py, branchview/treeview.py, checkout.py,
commit.py, conflicts.py, diff.py, errors.py, initialize.py,
merge.py, nautilus-bzr.py, olive/__init__.py, olive/add.py,
olive/bookmark.py, olive/guifiles.py, olive/info.py,
olive/menu.py, olive/mkdir.py, olive/move.py, olive/remove.py,
olive/rename.py, push.py, revbrowser.py, status.py, tags.py:
Replace all calls to _() by calls to _i18n(), the latter being
defined in __init__.py and imported in the other modules from
there. This fix the problem encountered countless times when
running bzr selftest and getting silly error messages about
boolean not being callables.

Show diffs side-by-side

added added

removed removed

Lines of Context:
15
15
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
16
16
 
17
17
import bzrlib.errors as errors
 
18
from bzrlib.plugins.gtk import _i18n
18
19
from dialog import error_dialog
19
20
 
 
21
 
20
22
def show_bzr_error(unbound):
21
23
    """Decorator that shows bazaar exceptions. """
22
24
    def convert(*args, **kwargs):
23
25
        try:
24
26
            unbound(*args, **kwargs)
25
27
        except errors.NotBranchError:
26
 
            error_dialog(_('Directory is not a branch'),
27
 
                         _('You can perform this action only in a branch.'))
 
28
            error_dialog(_i18n('Directory is not a branch'),
 
29
                         _i18n('You can perform this action only in a branch.'))
28
30
        except errors.LocalRequiresBoundBranch:
29
 
            error_dialog(_('Directory is not a checkout'),
30
 
                         _('You can perform local commit only on checkouts.'))
 
31
            error_dialog(_i18n('Directory is not a checkout'),
 
32
                         _i18n('You can perform local commit only on checkouts.'))
31
33
        except errors.PointlessCommit:
32
 
            error_dialog(_('No changes to commit'),
33
 
                         _('Try force commit if you want to commit anyway.'))
 
34
            error_dialog(_i18n('No changes to commit'),
 
35
                         _i18n('Try force commit if you want to commit anyway.'))
34
36
        except errors.ConflictsInTree:
35
 
            error_dialog(_('Conflicts in tree'),
36
 
                         _('You need to resolve the conflicts before committing.'))
 
37
            error_dialog(_i18n('Conflicts in tree'),
 
38
                         _i18n('You need to resolve the conflicts before committing.'))
37
39
        except errors.StrictCommitFailed:
38
 
            error_dialog(_('Strict commit failed'),
39
 
                         _('There are unknown files in the working tree.\nPlease add or delete them.'))
 
40
            error_dialog(_i18n('Strict commit failed'),
 
41
                         _i18n('There are unknown files in the working tree.\nPlease add or delete them.'))
40
42
        except errors.BoundBranchOutOfDate, errmsg:
41
 
            error_dialog(_('Bound branch is out of date'),
42
 
                         _('%s') % errmsg)
 
43
            error_dialog(_i18n('Bound branch is out of date'),
 
44
                         # FIXME: Really ? Internationalizing %s ?? --vila080505
 
45
                         _i18n('%s') % errmsg)
43
46
        except errors.NotVersionedError:
44
 
            error_dialog(_('File not versioned'),
45
 
                         _('The selected file is not versioned.'))
 
47
            error_dialog(_i18n('File not versioned'),
 
48
                         _i18n('The selected file is not versioned.'))
46
49
        except errors.DivergedBranches:
47
 
            error_dialog(_('Branches have been diverged'),
48
 
                         _('You cannot push if branches have diverged. Use the\noverwrite option if you want to push anyway.'))
 
50
            error_dialog(_i18n('Branches have been diverged'),
 
51
                         _i18n('You cannot push if branches have diverged. Use the\noverwrite option if you want to push anyway.'))
49
52
        except errors.NoSuchFile:
50
 
            error_dialog(_("No diff output"),
51
 
                         _("The selected file hasn't changed."))
 
53
            error_dialog(_i18n("No diff output"),
 
54
                         _i18n("The selected file hasn't changed."))
52
55
        except errors.NoSuchRevision:
53
 
                error_dialog(_('No such revision'),
54
 
                             _("The revision you specified doesn't exist."))
 
56
                error_dialog(_i18n('No such revision'),
 
57
                             _i18n("The revision you specified doesn't exist."))
55
58
        except errors.FileExists:
56
 
                error_dialog(_('Target already exists'),
57
 
                             _("Target directory already exists. Please select another target."))
 
59
                error_dialog(_i18n('Target already exists'),
 
60
                             _i18n("Target directory already exists. Please select another target."))
58
61
        except errors.AlreadyBranchError, errmsg:
59
 
            error_dialog(_('Directory is already a branch'),
60
 
                         _('The current directory (%s) is already a branch.\nYou can start using it, or initialize another directory.') % errmsg)
 
62
            error_dialog(_i18n('Directory is already a branch'),
 
63
                         _i18n('The current directory (%s) is already a branch.\nYou can start using it, or initialize another directory.') % errmsg)
61
64
        except errors.BranchExistsWithoutWorkingTree, errmsg:
62
 
            error_dialog(_('Branch without a working tree'),
63
 
                         _('The current directory (%s)\nis a branch without a working tree.') % errmsg)
 
65
            error_dialog(_i18n('Branch without a working tree'),
 
66
                         _i18n('The current directory (%s)\nis a branch without a working tree.') % errmsg)
64
67
        except errors.BzrError, msg:
65
 
            error_dialog(_('Unknown bzr error'), str(msg))
 
68
            error_dialog(_i18n('Unknown bzr error'), str(msg))
66
69
        except errors.PermissionDenied:
67
 
            error_dialog(_("Permission denied"), _("permission denied."))
 
70
            error_dialog(_i18n("Permission denied"), _i18n("permission denied."))
68
71
        except Exception, msg:
69
 
            error_dialog(_('Unknown error'), str(msg))
 
72
            error_dialog(_i18n('Unknown error'), str(msg))
70
73
 
71
74
    convert.__doc__ = unbound.__doc__
72
75
    convert.__name__ = unbound.__name__