• Home
  • News
  • Download
  • Help
  • Bugs

gPodder Bug Tracker – Bug 1165

Use dict-based format strings for numbers to allow translators to omit "%d"

Last modified: 2010-11-22 20:55:12 GMT

  • DE
  • | EN
  • | FR
  • Home
  • | New
  • | Browse
  • | Search
  • |
    [?]
  • | Reports
  • | Help
  • | New Account
  • | Log In
    [x]
  • | Forgot Password
    [x]
This bug tracker should not be used to create new bug or feature requests. Please use the new issue tracker on GitHub.
First Last Prev Next    This bug is not in your last search results.
Bug 1165 - Use dict-based format strings for numbers to allow translators to omit "%d"
Use dict-based format strings for numbers to allow translators to omit "%d"
Status: VERIFIED FIXED
Product: gPodder
Classification: Unclassified
Component: Application
2.8
PC Linux
: high normal
: 2.10
Assigned To: Thomas Perl
: 1148 (view as bug list)
Depends on:
Blocks:
  Show dependency tree / graph
 
Reported: 2010-09-27 22:41 BST by Amiad
Modified: 2010-11-22 20:55 GMT (History)
2 users (show)



Attachments
patch to bug. (508 bytes, patch)
2010-10-02 20:48 BST, Amiad
Details | Diff
patch (492 bytes, patch)
2010-10-12 13:13 BST, Amiad
Details | Diff
View All Add an attachment (proposed patch, testcase, etc.)

Note You need to log in before you can comment on or make changes to this bug.
Description Amiad 2010-09-27 22:41:28 BST
When I mark episode and choose "delete" from menu, the episode not delete.
Comment 1 Thomas Perl 2010-09-29 12:39:42 BST
(In reply to comment #0)
> When I mark episode and choose "delete" from menu, the episode not delete.

Please be a bit more specific. Does it happen for a specific episode or for any episode? Is there any output on the Terminal if you run "gpodder --verbose" from the Terminal and try to reproduce the problem?
Comment 2 Amiad 2010-10-01 14:36:47 BST
The problem happen in Hebrew locale and when I try to delete one episode only.
It happen because bug 1148. https://bugs.gpodder.org/show_bug.cgi?id=1148

The string in message of delete without parameter and therefore the message not appear and the episode not delete.

I added the parameter to this string in mo file and then the episode delete.
Comment 3 Amiad 2010-10-02 20:48:12 BST
Created attachment 578 [details]
patch to bug.

I maked patch to this bug.
if the user want to delete one episode then gPodder will show message without parameter.
Comment 4 Thomas Perl 2010-10-05 18:17:44 BST
(In reply to comment #3)
> Created an attachment (id=578) [details]
> patch to bug.
> 
> I maked patch to this bug.
> if the user want to delete one episode then gPodder will show message without
> parameter.

That's the wrong way to do it. Add "%d" where you would write "one" in the .po file.
Comment 5 Amiad 2010-10-05 18:40:41 BST
(In reply to comment #4)
> (In reply to comment #3)
> > Created an attachment (id=578) [details] [details]
> > patch to bug.
> > 
> > I maked patch to this bug.
> > if the user want to delete one episode then gPodder will show message without
> > parameter.
> 
> That's the wrong way to do it. Add "%d" where you would write "one" in the .po
> file.

I already wrote in bug 1148:
In hebrew "1 episode" (1 פרק) is wrong. I need to write "one episode" (פרק אחד).
Comment 6 Thomas Perl 2010-10-05 19:09:36 BST
(In reply to comment #5)
> (In reply to comment #4)
> > (In reply to comment #3)
> > > Created an attachment (id=578) [details] [details] [details]
> > > patch to bug.
> > > 
> > > I maked patch to this bug.
> > > if the user want to delete one episode then gPodder will show message without
> > > parameter.
> > 
> > That's the wrong way to do it. Add "%d" where you would write "one" in the .po
> > file.
> 
> I already wrote in bug 1148:
> In hebrew "1 episode" (1 פרק) is wrong. I need to write "one episode" (פרק
> אחד).

Alright. Due to the way the Polish language works, we have to use N_() there and cannot use something along the lines of "if count == 1". See also:

http://www.gnu.org/software/gettext/manual/gettext.html.gz#Plural-forms

I think the way to solve this is to simply have "one episode" as the translation for %d episode (singular), and make sure that the code can handle this (i.e. before using the "%" operator to format the string, check if enough parameters are there and skip any excessive parameters).
Comment 7 Amiad 2010-10-06 09:57:03 BST
It's impossible to ignore parameters Because of a bug in Python.
http://bugs.python.org/issue8359
So I wrote this patch.

I tried to use gettext.ngettext as written in the bug but it did not work.
No problem but the string appears in English.
Comment 8 Thomas Perl 2010-10-06 11:01:39 BST
(In reply to comment #7)
> It's impossible to ignore parameters Because of a bug in Python.
> http://bugs.python.org/issue8359
> So I wrote this patch.
> 
> I tried to use gettext.ngettext as written in the bug but it did not work.
> No problem but the string appears in English.

This hint seems helpful: http://bugs.python.org/msg102766 and seems to solve our problem. It just has to be changed in the source code. This also requires string changes, so I'll do this shortly after the next release, because other translators will also have to update their translations.
Comment 9 Thomas Perl 2010-10-06 22:59:47 BST
*** Bug 1148 has been marked as a duplicate of this bug. ***
Comment 10 Amiad 2010-10-12 13:13:55 BST
Created attachment 581 [details]
patch

gPodder need to use "%(episode)d" instead of "%d" and then "one episode" work fine.
need to change the similar strings.
Comment 11 Thomas Perl 2010-10-25 11:45:58 BST
Another way is available in newer Python versions:

'{0} episode'.format(1)
'one episode'.format(1)
Comment 12 Thomas Perl 2010-10-25 11:47:19 BST
(In reply to comment #11)
> Another way is available in newer Python versions:
> 
> '{0} episode'.format(1)
> 'one episode'.format(1)

This works in Python 2.6 onwards. We might need to provide a custom solution 2.5 or just stick with the dict-based approach for the time being.
Comment 13 Thomas Perl 2010-10-25 11:48:55 BST
(In reply to comment #12)
> (In reply to comment #11)
> > Another way is available in newer Python versions:
> > 
> > '{0} episode'.format(1)
> > 'one episode'.format(1)
> 
> This works in Python 2.6 onwards. We might need to provide a custom solution
> 2.5 or just stick with the dict-based approach for the time being.

Sorry for comment spamming here, but I just found another link that might provide us with said functionality in older Python versions:

http://github.com/mitsuhiko/logbook/blob/master/logbook/_stringfmt.py
Comment 14 Amiad 2010-10-26 10:10:52 BST
I checked "%(episode)d" and it work. I not sure that other solutions will work.
Comment 15 Thomas Perl 2010-11-22 20:55:12 GMT
Fixed: http://gpodder.org/commit/a31fe42e

The updated translation templates should be available soon via Transifex.

  • Format For Printing
  •  - XML
  •  - Clone This Bug
  •  - Top of page
First Last Prev Next    This bug is not in your last search results.

    • Home
    • | New
    • | Browse
    • | Search
    • |
      [?]
    • | Reports
    • | Help
    • | New Account
    • | Log In
      [x]
    • | Forgot Password
      [x]

© 2005-2014 Thomas Perl and the gPodder Team

exchange spam filter