![]() If you are interested in the topic, WordPress Codex has a long and good documentation guide on i18n for developers. But it can also be utilized for changing certain texts to something different within the same language. This is very useful for people who want to use WordPress and your theme (or plugin) in a different language than the origin language it was written in (which is usually English). Inside your theme (or plugin) you can add files of a certain filetype for each translated language, or make sure other people are able to create their own translation in their own language. These functions make it so that WordPress is able to pick these up and inject a translation if it exists. ![]() ![]() The way it works is that you as a theme author or plugin developer wrap all your texts (such as “Read more”, “No posts”) in certain functions. This is called internationalization (i18n in short), and allows people to translate texts you add in your theme into another language. Why bother with adding translation support?Īll themes, at least ones that goes public for use of other people than the developer, should be available for translation. We will also learn how to set up PoEdit properly to create a translation file for our theme, ready to be translated into different languages. When you are finished translating, go to File → Save as… again to generate the MO file.In this lesson we learn about how translation (or otherwise known as i18n) in WordPress works and how to make the necessary adjustments in our templates. (must be named nl_NL.po and nl_NL.mo – These are for Dutch)ģ. Go to File → Save as… to save your translations in a PO file. Beside that box is where you add your translation.Ģ. On the left, there’s a box with the original message (in English) from the POT file. Over there you can find the translatable files. Then, see that within the theme files there’s a folder named “lang”. To translate the theme you need to follow these steps:įirst, download and install Poedit. And you should be able to translate the theme without any trouble.Īll of the contact form strings are translatable, what problem are you having with it? But it doesn’t mean it is an error or bug.Īs your pro said, it is a Warning. Many of the empty strings to translate are related to this. Whenever somebody creates a piece of software, it saves space for updates and modifications. Thanks for writing and for the kind words □ I need to change the language of the contactform to Dutch and now it doesn’t work. Is there a fix for this? Can you help me out? 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. 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. The best it can do is to detect problems, but fixing them is something only the developer can do. It configures what needs to be configured and scans the theme for strings, as it did in your case.īut if the theme itself has bugs, there’s precious little that Poedit could do about 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. Better yet, let the theme developer know about them (feel free to use my previous email) so that they can fix it. In that case you can just ignore the errors and click OK. 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. in PHP code, you would get lot of gibberish text in place of the empty string when used with a translation. This means that whenever you use gettext(“”) or _(“”) etc. 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. 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. ![]() He gave me this answer:Īside 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. (Sounds great) Only i got some errors and asked the Poedit developer what’s wrong. 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.
0 Comments
Leave a Reply. |