Hi Georg! Good find! Thanks, we’ll update and fix.
Hi Georg,
I opened the source PO file (in /lang) and I don’t get the error with POEdit. What version are you using?
Thread Starter
Georg
(@georgwp)
Hi,
You can’t even save the .po file if you add the translation. Translate – or copy the original with Ctrl-B – ans then try to save the .po file having poEdit generate the .mo file automatically.
Best regards,
Georg
If I open lang/wptouch-pro-da_DO.po in PoEdit, I can save it into a .mo without issue. It asked me to define the plural forms, which I did as
nplurals=2; plural=(n != 1);
Can you please give me detailed instructions about what you are trying to do? I’m happy to fix something, but I can’t reproduce the issue locally here.
Which string do you think is wrong? Thanks.
Thread Starter
Georg
(@georgwp)
I do not have access to my poEdit right now, but here is what I recall. As I wrote, the culprit is in single.php line 26: the string is “% Comments”.
- Open the po file
- Define the plural forms (although this is not the problem in this case
- Define language as Danish (although I doubt this makes any difference
- Make sure that poEdit is set up to automatically generate .mo file when saving in Options > Editor (or Editing or something like that – I can’t see the English menu title)
- Search for the string “% Comments”
- Translate it to “% kommentarer”
- Save the file
- Now you see the error message I quoted in the initial message above
A proper solution would be to change the source to “%d comments”, which means that the variable will be treated as an integer (which it is) and presented as a decimal number, signed if need be (which of course is not relevant here). See http://php.net/sprintf.
When poEdit parses “% kommentarer” in the Danish translation, it correctly objects that ‘k’ is not a valid conversion specifier. The space is ignored. Therefore, don’t use ‘%’ as a variable/conversion specifier, but use ‘%d’, ‘%s’ or one of the other valid specifiers.
Hope this makes it more clear.
Thank you, and a merry Christmas and a happy new year.
Georg
Hi Georg,
Normally %d and %s are used because they coincide with sprintf in PHP. But in this case the % sign is passed into comments_popup_link within WordPress:
http://codex.wordpress.org/Function_Reference/comments_popup_link
and that function requires a % sign to be there.
I’ll take a look and see if we can escape the % sign by using a double %% for example. I’m sure there is a way.
Thanks.