Translation Poedit Pro

This support request was posted in BBQ by vanwoods

Request ID #3182 In Progress
  • Hi Juanfra,

    Thanks for the great theme to use!

    I’m trying to change to language file of the BBQ with Poedit Pro with the option that it changes everything in the theme automatically. (Sounds great) Only i got some errors and asked the Poedit developer what’s wrong. He gave me this answer:

    aside from the less-than-ideal presentation of the errors by Poedit (I’ll fix this), what the warnings say is actually correct: the problem really is what it says, that the theme contains code to “translate” empty strings (“”) with gettext/PO, which doesn’t make much sense.

    I take it that you are the theme’s developer? If so, then the best fix is to not do this and fix the locations listed in the warnings. You see, the “” string is special in gettext — in PO files, the translations metadata are store as a fake translation of the empty string at the beginning of the file. This means that whenever you use gettext(“”) or __(“”) etc. in PHP code, you would get lot of gibberish text in place of the empty string when used with a translation. Plus, it doesn’t really do anything (there’s nothing to translate in an empty string, after all), so it’s best to just use a plain string literal instead of wrapping it in a gettext function.

    Second email answer:
    In that case you can just ignore the errors and click OK. Better yet, let the theme developer know about them (feel free to use my previous email) so that they can fix it.

    You are right that Poedit Pro promises to do all the necessary things — for setting up the translation for a given theme or plugin. It configures what needs to be configured and scans the theme for strings, as it did in your case.

    But if the theme itself has bugs, there’s precious little that Poedit could do about it. The best it can do is to detect problems, but fixing them is something only the developer can do. For example, if the theme doesn’t mark some strings as translatable, even though they should be, there’s no way Poedit could find them. And if the theme has bugs — which calling gettext(“”) with an empty string is, a bug in the theme’s PHP code — Poedit cannot fix them by itself either.

    Is there a fix for this? Can you help me out?

    I need to change the language of the contactform to Dutch and now it doesn’t work.

    Regards, Patrick

    Juanfra Aldasoro

    Hello Patrick,

    Thanks for writing and for the kind words 🙂

    Whenever somebody creates a piece of software, it saves space for updates and modifications. Many of the empty strings to translate are related to this. But it doesn’t mean it is an error or bug.

    As your pro said, it is a Warning. It is not an error. And you should be able to translate the theme without any trouble.

    All of the contact form strings are translatable, what problem are you having with it?

    To translate the theme you need to follow these steps:

    First, download and install Poedit. Then, see that within the theme files there’s a folder named “lang”. Over there you can find the translatable files. So, you’ll need to do the following:

    1. Open the file in Poedit.
    On the left, there’s a box with the original message (in English) from the POT file. Beside that box is where you add your translation.
    2. Go to File → Save as… to save your translations in a PO file. (must be named nl_NL.po and nl_NL.mo – These are for Dutch)
    3. When you are finished translating, go to File → Save as… again to generate the MO file.

    Finally, to make the relation, you need to be running your WordPress install in Dutch:

    http://codex.wordpress.org/WordPress_in_Your_Language#Dutch_-_Nederlands_.28nl_NL.29

    Best,
    Juan.

    Ok, thnx i’ll try that.

    Is the above way also the best way to translate the contactform? I can’t find all the words to translate in the nicethemes.po file? (for example the submitbutton) I now hardcoded it into the template-contact.php

    Juanfra Aldasoro

    Hi Patrick,

    Thanks for your prompt response 🙂

    Yes, the way I described is the way I recommend to do the translations. All of the contact form strings are part of the translation files. By translating the file you’ll be translating the form then.

    Best,
    Juan.

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.

Login to your Account

Welcome back! Please log in to your account by filling the fields below:

Forgot?

Not a member? Create a free account.

Create a Free Account

You're 27 seconds away from some awesome WordPress free stuff, benefits and more. Create a free account and have access to our free products, benefits and more!

Already have an account? Log in
Secure Server