godiard | 10 Feb 15:38
Favicon

[PATCH Record] Use named parameters in gettext strings

From: Gonzalo Odiard <godiard <at> gmail.com>

When there are more than one parameter with the same type
gettext need named parameters to enable the translators to change
the order if needed.
Pootle server complain about this format strings in Record activity,
and you can see the same error doing "./setup.py genpot"

Signed-off-by: Gonzalo Odiard <gonzalo <at> laptop.org>
---
 glive.py |    3 ++-
 model.py |    6 ++++--
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/glive.py b/glive.py
index fd9a5af..413dc60 100644
--- a/glive.py
+++ b/glive.py
@@ -393,7 +393,8 @@ class Glive:
         stringType = constants.MEDIA_INFO[type]['istr']

         # Translators: photo by photographer, e.g. "Photo by Mary"
-        tl[gst.TAG_TITLE] = _('%s by %s') % (stringType, self.model.get_nickname())
+        tl[gst.TAG_TITLE] = _('%(type)s by %(name)s') % {'type': cstringType,
+                'name': self.model.get_nickname()}
         return tl

     def blockedCb(self, x, y, z):
diff --git a/model.py b/model.py
index 884325b..d47671c 100644
(Continue reading)

Chris Leonard | 10 Feb 20:07
Picon

Re: [PATCH Record] Use named parameters in gettext strings

Gonzalo,

I believe this will fix this bug, thanks.

http://bugs.sugarlabs.org/ticket/3201

If the cron job error goes away, I will close the bug.

cjl

On Fri, Feb 10, 2012 at 9:38 AM, <godiard <at> sugarlabs.org> wrote:
From: Gonzalo Odiard <godiard <at> gmail.com>

When there are more than one parameter with the same type
gettext need named parameters to enable the translators to change
the order if needed.
Pootle server complain about this format strings in Record activity,
and you can see the same error doing "./setup.py genpot"

Signed-off-by: Gonzalo Odiard <gonzalo <at> laptop.org>
---
 glive.py |    3 ++-
 model.py |    6 ++++--
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/glive.py b/glive.py
index fd9a5af..413dc60 100644
--- a/glive.py
+++ b/glive.py
<at> <at> -393,7 +393,8 <at> <at> class Glive:
        stringType = constants.MEDIA_INFO[type]['istr']

        # Translators: photo by photographer, e.g. "Photo by Mary"
-        tl[gst.TAG_TITLE] = _('%s by %s') % (stringType, self.model.get_nickname())
+        tl[gst.TAG_TITLE] = _('%(type)s by %(name)s') % {'type': cstringType,
+                'name': self.model.get_nickname()}
        return tl

    def blockedCb(self, x, y, z):
diff --git a/model.py b/model.py
index 884325b..d47671c 100644
--- a/model.py
+++ b/model.py
<at> <at> -180,7 +180,8 <at> <at> class Model:

        mins = value / 60
        secs = value % 60
-        text = _('%d:%02d remaining') % (mins, secs)
+        text = _('%(mins)d:%(secs)02d remaining') % {'mins': mins,
+                'secs': secs}

        self.set_progress(progress_value, text)

<at> <at> -381,7 +382,8 <at> <at> class Model:
        stringType = constants.MEDIA_INFO[type]['istr']

        # Translators: photo by photographer, e.g. "Photo by Mary"
-        recd.title = _('%s by %s') % (stringType, recd.recorderName)
+        recd.title = _('%(type)s by %(name)s') % {'type': stringType,
+                'name': recd.recorderName}

        color = sugar.profile.get_color()
        recd.colorStroke = color.get_stroke_color()
--
1.7.7.6

_______________________________________________
Sugar-devel mailing list
Sugar-devel <at> lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel

_______________________________________________
Sugar-devel mailing list
Sugar-devel <at> lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel
Chris Leonard | 10 Feb 20:07
Picon

Re: [PATCH Record] Use named parameters in gettext strings

Gonzalo,

I believe this will fix this bug, thanks.

http://bugs.sugarlabs.org/ticket/3201

If the cron job error goes away, I will close the bug.

cjl

On Fri, Feb 10, 2012 at 9:38 AM, <godiard <at> sugarlabs.org> wrote:
From: Gonzalo Odiard <godiard <at> gmail.com>

When there are more than one parameter with the same type
gettext need named parameters to enable the translators to change
the order if needed.
Pootle server complain about this format strings in Record activity,
and you can see the same error doing "./setup.py genpot"

Signed-off-by: Gonzalo Odiard <gonzalo <at> laptop.org>
---
 glive.py |    3 ++-
 model.py |    6 ++++--
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/glive.py b/glive.py
index fd9a5af..413dc60 100644
--- a/glive.py
+++ b/glive.py
<at> <at> -393,7 +393,8 <at> <at> class Glive:
        stringType = constants.MEDIA_INFO[type]['istr']

        # Translators: photo by photographer, e.g. "Photo by Mary"
-        tl[gst.TAG_TITLE] = _('%s by %s') % (stringType, self.model.get_nickname())
+        tl[gst.TAG_TITLE] = _('%(type)s by %(name)s') % {'type': cstringType,
+                'name': self.model.get_nickname()}
        return tl

    def blockedCb(self, x, y, z):
diff --git a/model.py b/model.py
index 884325b..d47671c 100644
--- a/model.py
+++ b/model.py
<at> <at> -180,7 +180,8 <at> <at> class Model:

        mins = value / 60
        secs = value % 60
-        text = _('%d:%02d remaining') % (mins, secs)
+        text = _('%(mins)d:%(secs)02d remaining') % {'mins': mins,
+                'secs': secs}

        self.set_progress(progress_value, text)

<at> <at> -381,7 +382,8 <at> <at> class Model:
        stringType = constants.MEDIA_INFO[type]['istr']

        # Translators: photo by photographer, e.g. "Photo by Mary"
-        recd.title = _('%s by %s') % (stringType, recd.recorderName)
+        recd.title = _('%(type)s by %(name)s') % {'type': stringType,
+                'name': recd.recorderName}

        color = sugar.profile.get_color()
        recd.colorStroke = color.get_stroke_color()
--
1.7.7.6

_______________________________________________
Sugar-devel mailing list
Sugar-devel <at> lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel

_______________________________________________
Sugar-devel mailing list
Sugar-devel <at> lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel
Gonzalo Odiard | 16 Mar 16:15
Favicon

Re: [PATCH Record] Use named parameters in gettext strings

The previous patch had a typo.

Attached is a fixed patch.

Gonzalo
From 618fbd61141d3096d0b8d83197c50e2baacde1bc Mon Sep 17 00:00:00 2001
From: Gonzalo Odiard <godiard <at> gmail.com>
Date: Fri, 10 Feb 2012 11:28:26 -0300
Subject: [PATCH] Use named parameters in gettext strings -v2

When there are more than one parameter with the same type
gettext need named parameters to enable the translators to change
the order if needed.
Pootle server complain about this format strings in Record activity,
and you can see the same error doing "./setup.py genpot"

v2: Fixed typo

Signed-off-by: Gonzalo Odiard <gonzalo <at> laptop.org>
---
 glive.py |    3 ++-
 model.py |    6 ++++--
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/glive.py b/glive.py
index fd9a5af..97fc0e1 100644
--- a/glive.py
+++ b/glive.py
@@ -393,7 +393,8 @@ class Glive:
         stringType = constants.MEDIA_INFO[type]['istr']

         # Translators: photo by photographer, e.g. "Photo by Mary"
-        tl[gst.TAG_TITLE] = _('%s by %s') % (stringType, self.model.get_nickname())
+        tl[gst.TAG_TITLE] = _('%(type)s by %(name)s') % {'type': stringType,
+                'name': self.model.get_nickname()}
         return tl

     def blockedCb(self, x, y, z):
diff --git a/model.py b/model.py
index 884325b..d47671c 100644
--- a/model.py
+++ b/model.py
@@ -180,7 +180,8 @@ class Model:

         mins = value / 60
         secs = value % 60
-        text = _('%d:%02d remaining') % (mins, secs)
+        text = _('%(mins)d:%(secs)02d remaining') % {'mins': mins,
+                'secs': secs}

         self.set_progress(progress_value, text)

@@ -381,7 +382,8 @@ class Model:
         stringType = constants.MEDIA_INFO[type]['istr']

         # Translators: photo by photographer, e.g. "Photo by Mary"
-        recd.title = _('%s by %s') % (stringType, recd.recorderName)
+        recd.title = _('%(type)s by %(name)s') % {'type': stringType,
+                'name': recd.recorderName}

         color = sugar.profile.get_color()
         recd.colorStroke = color.get_stroke_color()
--

-- 
1.7.7.6

_______________________________________________
Sugar-devel mailing list
Sugar-devel <at> lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel
Chris Leonard | 18 Mar 07:07
Picon

Re: [PATCH Record] Use named parameters in gettext strings

Thanks, closed the ticket  http://bugs.sugarlabs.org/ticket/3201

cjl

On Fri, Mar 16, 2012 at 11:15 AM, Gonzalo Odiard <gonzalo <at> laptop.org> wrote:
> The previous patch had a typo.
> Attached is a fixed patch.
>
> Gonzalo
>
> _______________________________________________
> Sugar-devel mailing list
> Sugar-devel <at> lists.sugarlabs.org
> http://lists.sugarlabs.org/listinfo/sugar-devel
>
Chris Leonard | 18 Mar 07:07
Picon

Re: [PATCH Record] Use named parameters in gettext strings

Thanks, closed the ticket  http://bugs.sugarlabs.org/ticket/3201

cjl

On Fri, Mar 16, 2012 at 11:15 AM, Gonzalo Odiard <gonzalo <at> laptop.org> wrote:
> The previous patch had a typo.
> Attached is a fixed patch.
>
> Gonzalo
>
> _______________________________________________
> Sugar-devel mailing list
> Sugar-devel <at> lists.sugarlabs.org
> http://lists.sugarlabs.org/listinfo/sugar-devel
>
Gonzalo Odiard | 16 Mar 16:15
Favicon

Re: [PATCH Record] Use named parameters in gettext strings

The previous patch had a typo.

Attached is a fixed patch.

Gonzalo
From 618fbd61141d3096d0b8d83197c50e2baacde1bc Mon Sep 17 00:00:00 2001
From: Gonzalo Odiard <godiard <at> gmail.com>
Date: Fri, 10 Feb 2012 11:28:26 -0300
Subject: [PATCH] Use named parameters in gettext strings -v2

When there are more than one parameter with the same type
gettext need named parameters to enable the translators to change
the order if needed.
Pootle server complain about this format strings in Record activity,
and you can see the same error doing "./setup.py genpot"

v2: Fixed typo

Signed-off-by: Gonzalo Odiard <gonzalo <at> laptop.org>
---
 glive.py |    3 ++-
 model.py |    6 ++++--
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/glive.py b/glive.py
index fd9a5af..97fc0e1 100644
--- a/glive.py
+++ b/glive.py
@@ -393,7 +393,8 @@ class Glive:
         stringType = constants.MEDIA_INFO[type]['istr']

         # Translators: photo by photographer, e.g. "Photo by Mary"
-        tl[gst.TAG_TITLE] = _('%s by %s') % (stringType, self.model.get_nickname())
+        tl[gst.TAG_TITLE] = _('%(type)s by %(name)s') % {'type': stringType,
+                'name': self.model.get_nickname()}
         return tl

     def blockedCb(self, x, y, z):
diff --git a/model.py b/model.py
index 884325b..d47671c 100644
--- a/model.py
+++ b/model.py
@@ -180,7 +180,8 @@ class Model:

         mins = value / 60
         secs = value % 60
-        text = _('%d:%02d remaining') % (mins, secs)
+        text = _('%(mins)d:%(secs)02d remaining') % {'mins': mins,
+                'secs': secs}

         self.set_progress(progress_value, text)

@@ -381,7 +382,8 @@ class Model:
         stringType = constants.MEDIA_INFO[type]['istr']

         # Translators: photo by photographer, e.g. "Photo by Mary"
-        recd.title = _('%s by %s') % (stringType, recd.recorderName)
+        recd.title = _('%(type)s by %(name)s') % {'type': stringType,
+                'name': recd.recorderName}

         color = sugar.profile.get_color()
         recd.colorStroke = color.get_stroke_color()
--

-- 
1.7.7.6

_______________________________________________
Sugar-devel mailing list
Sugar-devel <at> lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel

Gmane