Bug 634385 - Multiple placeholders within one string in anaconda.po
Summary: Multiple placeholders within one string in anaconda.po
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Fedora
Classification: Fedora
Component: anaconda
Version: 18
Hardware: All
OS: Linux
low
medium
Target Milestone: ---
Assignee: Brian Lane
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2010-09-16 00:50 UTC by TianShixiong
Modified: 2013-09-11 23:48 UTC (History)
9 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2013-09-11 23:48:01 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)
add placeholders (4.71 KB, patch)
2010-09-22 18:34 UTC, Chris Lumens
no flags Details | Diff

Description TianShixiong 2010-09-16 00:50:26 UTC
Description of problem:
There exist multiple placeholders in some strings of anaconda.po.
They can't be rearranged in the translation.

Version-Release number of selected component (if applicable):


How reproducible:
Always

Steps to Reproduce:
1. open the PO file using Poedit or other translation tools
2. translate the string with multiple placeholders

Actual results:
This makes the placeholders order in translation wrong.

Expected results:
The placeholders within one string should be named, so that they can be well reordered in translation.

Additional info:
[1] http://lists.fedoraproject.org/pipermail/trans/2010-September/008040.html
[2] http://live.gnome.org/GnomeI18nDeveloperTips  (search python)

Comment 1 Chris Lumens 2010-09-22 00:25:24 UTC
Which line numbers in anaconda.pot in particular are wrong?

Comment 2 TianShixiong 2010-09-22 02:41:19 UTC
3545 "The %s disc was not found in any of your CDROM drives. Please insert the %s "
3546 "disc and press %s to retry."  line 3545-3546

3829 msgid "Welcome to %s for %s" line 3829

3834 msgid "Welcome to %s for %s - Rescue Mode" line 3834

4742 msgid "Creating %s filesystem on %s"

4828 msgid "Creating %s on %s"

Comment 3 Chris Lumens 2010-09-22 18:34:55 UTC
Created attachment 449012 [details]
add placeholders

Is something like this what you had in mind?  I'm less sure on the parts in loader/, because I've never had to add these sorts of annotations to C files before.

Comment 4 TianShixiong 2010-09-23 08:50:43 UTC
Yes, the placeholders should be like this: "Creating %(type)s on %(device)s")
Names should be added to them.

It doesn't need to do this in C files.

I tried to use %1$s and %2$s to distinguish them in msgstr line. But it doesn't work, and the error message was:  
fatal error 'msgstr' is not a valid Python format
string, unlike 'msgid'. Reason: In the directive number 1, the
character '$' is not a valid conversion specifier.

I don't have coding experience and am not a developer, so I just supposed the file is a Python file according to the error message above:) 
The python file needs these names( like %(type)s ) to be added to the multi placeholders that exist in one line.

Comment 5 Piotr Drąg 2010-09-23 12:50:54 UTC
We certainly don't want this to be fixed in Fedora 14, as it would mean breaking a string freeze. Would be nice to fix it in a master branch though.

Comment 6 Chris Lumens 2010-09-23 14:30:01 UTC
> We certainly don't want this to be fixed in Fedora 14, as it would mean
> breaking a string freeze. Would be nice to fix it in a master branch though.

This bug isn't marked as F14Blocker, so I was only going to commit it to master.

Comment 7 Chris Lumens 2010-09-23 14:34:58 UTC
> Yes, the placeholders should be like this: "Creating %(type)s on %(device)s")
> Names should be added to them.
> 
> It doesn't need to do this in C files.

I can do the python parts, but that's only going to clear up the last two in your list above.  I'm not sure what we can do about the first three.

Comment 8 Piotr Drąg 2010-12-14 14:17:57 UTC
POT file in git contains proper placeholders, so I'm closing this bug.

Comment 9 TianShixiong 2012-11-10 11:11:02 UTC
I know that anaconda team is very busy now. But I have to reopen this bug. 

After the anaconda master po file for Fedora 18 updated, there comes a string with 3 placeholders in it.
Here it is:
%s may not have enough space for grub2 to embed core.img when using
the %s filesystem on %s

According to the details from transifex.net, the string is at pyanaconda/bootloader.py:1585

As a translator, I can't keep the placeholders' original order in the
translation. That means the translation won't be right or even
misleading because the placeholders will be interpreted in their
original order.

So I added 1$ 2$ 3$ into the %s to make sure what the order is in the
translation. The translation is:
当在 %3$s 上使用 %2$s 文件系统时,%1$s 的空间大小可能无法让 grub2 嵌入 core.img

I am not sure whether this is helpful.
If it fails, please consider to use some name variables to distinguish these %s.

Comment 10 Brian Lane 2012-11-12 18:05:19 UTC
Would something like this be easier?

msg = _("%(device)s may not have enough space for grub2 to embed "
        "core.img when using the %(format)s filesystem on %(type)s") \
        % msg_dict

Comment 11 TianShixiong 2012-11-13 13:36:14 UTC
(In reply to comment #10)
> Would something like this be easier?
> 
> msg = _("%(device)s may not have enough space for grub2 to embed "
>         "core.img when using the %(format)s filesystem on %(type)s") \
>         % msg_dict

Yes, this will be nice.

Comment 12 Brian Lane 2012-11-13 18:02:34 UTC
I pushed a quick fix during last night's build of anaconda-18.29-1, removing the $ from the change in comment 9 (it was complaining about $ not being a valid specifier). If that works ok I think we'll leave it like that for f18 since we're supposed to be in string freeze.

Comment 13 TianShixiong 2012-11-14 11:20:14 UTC
(In reply to comment #12)
> I pushed a quick fix during last night's build of anaconda-18.29-1, removing
> the $ from the change in comment 9 (it was complaining about $ not being a
> valid specifier). If that works ok I think we'll leave it like that for f18
> since we're supposed to be in string freeze.
I see your change.
How can we know whether it works?

Comment 14 Brian Lane 2012-11-14 17:36:56 UTC
Good question. That string isn't easy to reproduce. I am not sure exactly how the translation system handles these things. I'll look into it.

Comment 15 TianShixiong 2012-12-19 11:21:02 UTC
String ID: This Software RAID array is missing %d of %d member partitions. You can remove it or select a different device.

String ID: This LVM Volume Group is missing %d of %d physical volumes. You can remove it or select a different device.

This %s device is missing %d of %d %s. You can remove it or select a different device.

There are two or more placeholders in each of these newly updated strings, but no names for them. 
I really can't keep them in the right order in the translation.

Please, please add names to these placeholders if the strings are not freeze.
For example %(partition)d, %(device)d ...

Comment 16 Brian Lane 2012-12-19 15:43:50 UTC
Those changes were introduced by 876441, could you add a note to that bug?

Comment 17 TianShixiong 2012-12-20 11:18:13 UTC
(In reply to comment #16)
> Those changes were introduced by 876441, could you add a note to that bug?
Added

Comment 18 Kamil Páral 2012-12-20 12:42:42 UTC
(In reply to comment #16)
> Those changes were introduced by 876441, could you add a note to that bug?

I closed bug 876441 because the crash was fixed. Can we resolve the i18n deficiencies here?

Comment 19 Brian Lane 2012-12-20 16:36:41 UTC
Well, then we should open a new bug, not reuse an old one.

Comment 20 TianShixiong 2012-12-21 12:44:20 UTC
(In reply to comment #19)
> Well, then we should open a new bug, not reuse an old one.
Do you mean to open a new bug for this?

Comment 21 TianShixiong 2012-12-25 11:47:48 UTC
(In reply to comment #20)
> (In reply to comment #19)
> > Well, then we should open a new bug, not reuse an old one.
> Do you mean to open a new bug for this?

Please see the new bug https://bugzilla.redhat.com/show_bug.cgi?id=890157


Note You need to log in before you can comment on or make changes to this bug.