• Resolved felipelungov

    (@felipelungov)


    Hi,

    First of all, thank you for what seems to be a great plugin, and thank you for your great support too!! Before I ask, let me make sure I understand how the entire flow goes. I have read a lot about it in the last few days, but I am new to this and still a bit confused. If you want to write something like that in a sticky thread, I believe it would be very helpful for a lot of users.

    So the steps for best practices are:

    1. The theme/plugin developer needs to write the php code placing user-viewable string inside __(‘Hello World’) and _e(‘How are you’) functions.

    2. An application (such as Loco Translate) scans all the files and collects all those strings into a .pot file.

    3. The user decides to translate those strings to a different language. So they create a, say, pt_BR.po file that retrieves all the strings from the .pot file and work on the translations within the .po file. This can also be done in Loco Translate.

    4. When they save the .po file, the application (such as Loco Translate) will automatically generate a corresponding .mo file, and that is the file ultimately used by wordpress.

    So if all those steps are correct, my questions are:

    a. The theme I am trying to translate is written using __() and _e(), but they do not provide me a .pot file. Does Loco Translate create that file for me? I can’t find where. The “new template” link only shows for themes/plugins that have no templates already. The one I’m working on has three templates (one of them is a .mo file) and none of them have all the strings that are in the code.

    b. Can I also use Loco Translate to translate strings created by the WordPress code? It is not in the package list.

    c. There is a thread in which you say that in order to prevent updates from overwriting translations, we must save the .po and .mo files in the global languages directory. But I can’t find in the plugin where to “Save as”. And is that directory not erased when WordPress itself is updated?

    Thanks again!

    https://wordpress.org/plugins/loco-translate/

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Tim W

    (@timwhitlock)

    a)
    If there is no proper POT template file, Loco tries to fall back to anything it can find that looks like it might be a template (e.g. some people use bad names such as english.po etc.. ). I did this to help people, but it turns out to create more confusion and the “feature” may end up getting scrapped.

    If your theme has no POT file, you should contact the author and ask them to add one. If they say the template is there and it’s called “foo.po” ask them nicely to name it properly. Loco prefers <textdomain>.pot

    This is one of the reasons there is no step-by-step beginners guide. The things I say are in the theme may not be in theme. It get’s complicated very quickly if things aren’t set up in a standard way.

    b)
    You can enable core translations in the plugin settings. It’s experimental at the moment and doesn’t work wonderfully.

    c)
    If the global languages directory is writable, Loco will offer you the choice when you add a new language. There is no “save as” option after a PO/MO has been created, but Loco will notice if you move (and rename) them manually.

    Thread Starter felipelungov

    (@felipelungov)

    Hi, thanks for your prompt response!

    a. Ok. If you add that feature to the plugin (generating the .pot file from the .php files) I’m sure it would be much easier for the whole process to run in a standard way, if that is something the user desires. But of course I have no idea whether that is an easy feature to implement.

    Plugin Author Tim W

    (@timwhitlock)

    I don’t follow your point. The POT generation feature is added

    The plugin just avoids breaking authors’ file layouts. Most translators using this plugin are not the theme authors, so trying to ‘fix’ non-standard theme setups is not a good situation.

    Thread Starter felipelungov

    (@felipelungov)

    I couldn’t find that feature, and by your other reply I thought it wasn’t there. I’m on holidays now, when I’m back I’ll search for it again and if I can’t find it I’ll get in touch. Thanks!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Getting started – cannot find templates’ is closed to new replies.