[PATCH 1 of 2] keyword: prepare kwdemo output for translation
Christian Ebert
blacktrash at gmx.net
Tue Jul 21 10:24:07 UTC 2009
# HG changeset patch
# User Christian Ebert <blacktrash at gmx.net>
# Date 1248171792 -3600
# Node ID f713de0058b6f0c7e21a9c97936158ed1fa9d97b
# Parent 8864112d4f57815b11d49dff22d25969d3ae23a8
keyword: prepare kwdemo output for translation
Translatable strings must be complete sentences.
Thanks to Wagner Bruna for pointing this out.
diff --git a/hgext/keyword.py b/hgext/keyword.py
--- a/hgext/keyword.py
+++ b/hgext/keyword.py
@@ -285,7 +285,6 @@
for k, v in items:
ui.write('%s = %s\n' % (k, v))
- msg = 'hg keyword config and expansion example'
kwstatus = 'current'
fn = 'demo.txt'
branchname = 'demobranch'
@@ -319,7 +318,11 @@
if k.endswith('keyword'):
extension = '%s = %s' % (k, v)
break
- ui.status(_('\n\tconfig using %s keyword template maps\n') % kwstatus)
+ msg = {'current': _('config using current keyword template maps'),
+ 'custom': _('config using custom keyword template maps'),
+ 'default': _('config using default keyword template maps')
+ }[kwstatus]
+ ui.status('\n\t%s\n' % msg)
ui.write('[extensions]\n%s\n' % extension)
demoitems('keyword', ui.configitems('keyword'))
demoitems('keywordmaps', kwmaps.iteritems())
@@ -327,7 +330,11 @@
repo.wopener(fn, 'w').write(keywords)
repo.add([fn])
path = repo.wjoin(fn)
- ui.note(_('\n%s keywords written to %s:\n') % (kwstatus, path))
+ msg = {'current': _('current keywords written to %s:') % path,
+ 'custom': _('custom keywords written to %s:') % path,
+ 'default': _('default keywords written to %s:') % path
+ }[kwstatus]
+ ui.note('\n%s\n' % msg)
ui.note(keywords)
ui.note('\nhg -R "%s" branch "%s"\n' % (tmpdir, branchname))
# silence branch command if not verbose
@@ -340,9 +347,19 @@
repo.ui.setconfig('hooks', name, '')
ui.note(_('unhooked all commit hooks\n'))
ui.note('hg -R "%s" ci -m "%s"\n' % (tmpdir, msg))
+ msg = _('hg keyword config and expansion example')
repo.commit(text=msg)
- fmt = ui.verbose and ' in %s' % path or ''
- ui.status(_('\n\t%s keywords expanded%s\n') % (kwstatus, fmt))
+ if ui.verbose:
+ msg = {'current': _('current keywords expanded in %s') % path,
+ 'custom': _('custom keywords expanded in %s') % path,
+ 'default': _('default keywords expanded in %s') % path
+ }[kwstatus]
+ else:
+ msg = {'current': _('current keywords expanded'),
+ 'custom': _('custom keywords expanded'),
+ 'default': _('default keywords expanded')
+ }[kwstatus]
+ ui.status('\n\t%s\n' % msg)
ui.write(repo.wread(fn))
ui.debug(_('\nremoving temporary repository %s\n') % tmpdir)
shutil.rmtree(tmpdir, ignore_errors=True)
More information about the Mercurial-devel
mailing list