WordPress.org

Ready to get started?Download WordPress

Forums

WPtouch Mobile Plugin
poEdit error (7 posts)

  1. Georg
    Member
    Posted 7 months ago #

    Hi,

    I took a look at the Danish translation of WPtouch.

    poEdit objected to single.php:26 with the following error message:

    "Error: 'msgstr' is not a valid PHP format string, unlike 'msgid'. Reason: In the directive number 1, the character 'k' is not a valid conversion specifier."

    Please, correct the source code.

    Best regards,

    Georg

    http://wordpress.org/plugins/wptouch/

  2. dalemugford
    Member
    Plugin Contributor

    Posted 7 months ago #

    Hi Georg! Good find! Thanks, we'll update and fix.

  3. Duane Storey
    Member
    Plugin Contributor

    Posted 7 months ago #

    Hi Georg,

    I opened the source PO file (in /lang) and I don't get the error with POEdit. What version are you using?

  4. Georg
    Member
    Posted 7 months ago #

    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

  5. Duane Storey
    Member
    Plugin Contributor

    Posted 7 months ago #

    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.

  6. Georg
    Member
    Posted 7 months ago #

    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".

    1. Open the po file
    2. Define the plural forms (although this is not the problem in this case
    3. Define language as Danish (although I doubt this makes any difference
    4. 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)
    5. Search for the string "% Comments"
    6. Translate it to "% kommentarer"
    7. Save the file
    8. 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

  7. Duane Storey
    Member
    Plugin Contributor

    Posted 7 months ago #

    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.

Reply

You must log in to post.

About this Plugin

About this Topic

Tags

No tags yet.