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
When I mark episode and choose "delete" from menu, the episode not delete.
(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?
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.
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.
(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.
(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" (פרק אחד).
(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).
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.
(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.
*** Bug 1148 has been marked as a duplicate of this bug. ***
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.
Another way is available in newer Python versions: '{0} episode'.format(1) 'one episode'.format(1)
(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.
(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
I checked "%(episode)d" and it work. I not sure that other solutions will work.
Fixed: http://gpodder.org/commit/a31fe42e The updated translation templates should be available soon via Transifex.