Bug 634385 - Multiple placeholders within one string in anaconda.po
Multiple placeholders within one string in anaconda.po
Status: CLOSED CURRENTRELEASE
Product: Fedora
Classification: Fedora
Component: anaconda (Show other bugs)
18
All Linux
low Severity medium
: ---
: ---
Assigned To: Brian Lane
Fedora Extras Quality Assurance
: i18n, Reopened
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2010-09-15 20:50 EDT by TianShixiong
Modified: 2013-09-11 19:48 EDT (History)
9 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2013-09-11 19:48:01 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


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

  None (edit)
Description TianShixiong 2010-09-15 20:50:26 EDT
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-21 20:25:24 EDT
Which line numbers in anaconda.pot in particular are wrong?
Comment 2 TianShixiong 2010-09-21 22:41:19 EDT
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 14:34:55 EDT
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 04:50:43 EDT
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 08:50:54 EDT
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 10:30:01 EDT
> 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 10:34:58 EDT
> 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 09:17:57 EST
POT file in git contains proper placeholders, so I'm closing this bug.
Comment 9 TianShixiong 2012-11-10 06:11:02 EST
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 13:05:19 EST
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 08:36:14 EST
(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 13:02:34 EST
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 06:20:14 EST
(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 12:36:56 EST
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 06:21:02 EST
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 10:43:50 EST
Those changes were introduced by 876441, could you add a note to that bug?
Comment 17 TianShixiong 2012-12-20 06:18:13 EST
(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 07:42:42 EST
(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 11:36:41 EST
Well, then we should open a new bug, not reuse an old one.
Comment 20 TianShixiong 2012-12-21 07:44:20 EST
(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 06:47:48 EST
(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.