[Sugar-devel] [PATCH sugar 1/2] Localise sugar-install-bundle

Chris Leonard cjlhomeaddress at gmail.com
Mon Sep 5 08:11:01 EDT 2011


Can you help me understand which POT files these new strings will land
in?  Is it sugar.po?

I want to be sure to track them into Poolte and get them distributed

cjl

On Mon, Sep 5, 2011 at 6:10 AM, Sascha Silbe <silbe at activitycentral.com> wrote:
> sugar-install-bundle contains user-visible strings that should be translated.
>
> By default xgettext guesses the programming language based on the file
> extension. Since the scripts in bin/ don't have any extension, we need to tell
> xgettext the source language by explicitly stating it in XGETTEXT_OPTIONS.
> This works because the sugar package only contains Python files.
>
> Signed-off-by: Sascha Silbe <silbe at activitycentral.com>
> ---
>  bin/sugar-install-bundle |   19 +++++++++++++++----
>  po/Makevars              |    6 +++++-
>  po/POTFILES.in           |    1 +
>  3 files changed, 21 insertions(+), 5 deletions(-)
>
> diff --git a/bin/sugar-install-bundle b/bin/sugar-install-bundle
> index 52deada..d0b6fc5 100644
> --- a/bin/sugar-install-bundle
> +++ b/bin/sugar-install-bundle
> @@ -1,20 +1,31 @@
>  #!/usr/bin/env python
> +import gettext
>  import sys
>
>  from sugar.bundle.activitybundle import ActivityBundle
>
> +from jarabe import config
> +
>  from dbus.mainloop.glib import DBusGMainLoop
> -DBusGMainLoop(set_as_default=True)
> +
>
>  def cmd_help():
> -    print 'Usage: sugar-install-bundle [ bundlename ] \n\n\
> -    Install an activity bundle (.xo). \n'
> +    print _('Usage: sugar-install-bundle [ bundlename ] \n\n'
> +            'Install an activity bundle (.xo). \n')
> +
> +
> +gettext.bindtextdomain('sugar', config.locale_path)
> +gettext.bindtextdomain('sugar-toolkit', config.locale_path)
> +gettext.textdomain('sugar')
> +_ = gettext.gettext
>
>  if len(sys.argv) != 2:
>     cmd_help()
>     sys.exit(2)
>
> +DBusGMainLoop(set_as_default=True)
> +
>  bundle = ActivityBundle(sys.argv[1])
>  bundle.install()
>
> -print "%s: '%s' installed." % (sys.argv[0], sys.argv[1])
> +print _('%s: %r installed.') % (sys.argv[0], sys.argv[1])
> diff --git a/po/Makevars b/po/Makevars
> index da4dba6..d9251f9 100644
> --- a/po/Makevars
> +++ b/po/Makevars
> @@ -1 +1,5 @@
> -XGETTEXT_OPTIONS = --keyword=_ --keyword=N_ --keyword=C_:1c,2 --keyword=NC_:1c,2 --keyword=Q_ --keyword=g_dgettext:2 --keyword=g_dngettext:2,3 --keyword=g_dpgettext:2 --keyword=g_dpgettext2=2c,3 --keyword=pgettext:1c,2
> +XGETTEXT_OPTIONS = --language=python --keyword=_ --keyword=N_ \
> +        --keyword=C_:1c,2 --keyword=NC_:1c,2 --keyword=Q_ \
> +        --keyword=g_dgettext:2 --keyword=g_dngettext:2,3 \
> +        --keyword=g_dpgettext:2 --keyword=g_dpgettext2=2c,3 \
> +        --keyword=pgettext:1c,2
> diff --git a/po/POTFILES.in b/po/POTFILES.in
> index 9e46831..10652f4 100644
> --- a/po/POTFILES.in
> +++ b/po/POTFILES.in
> @@ -1,3 +1,4 @@
> +bin/sugar-install-bundle
>  extensions/cpsection/aboutme/__init__.py
>  extensions/cpsection/aboutme/model.py
>  extensions/cpsection/aboutme/view.py
> --
> 1.7.6
>
> _______________________________________________
> Sugar-devel mailing list
> Sugar-devel at lists.sugarlabs.org
> http://lists.sugarlabs.org/listinfo/sugar-devel
>


More information about the Sugar-devel mailing list