Jump to content
janpeeters

How to translate manually added strings like 'Continue Reading…' in Polylang

Recommended Posts

janpeeters

Hi,

I've done quite a bit of reading and posting over the last days in this forum and discussed things with the developer of Polylang.

So far, things are evolving and I've achieved (in the latest dev build of Polylang) that Polylang correctly translates strings like blogtitle and blog tagline from one language to another. Also posts show up in the right language if properly linked to a language.

What remains though is that I've found no way to translate manually added strings (in Framework Site options) like 'Continue Reading…' and 'Posted on [date] by [author]' to another language.

Posts like:

http://www.pagelines.com/forum/topic/22076-translate-editable-strings-qtranslates-quicktags/page__hl__translate

end with the advice to use WPML. I can surely appreciate this advice but WPML is a premium payed plugin and Polylang feels like a great bet to translate your site free of charge. But in some areas it needs refinement. Let me add that it seems a lot lighter in resources I've tested WPML in the past and found it to be slow while Polylang is actually quite fast. But that might be just my observation.

I've read the posts that explain how to use POEdit to translate strings. As far as I can understand this is only for fixed strings in the Pagelines Framework (like the 'tagged' string used in the manual by Simon) and it can function as addition to downloading and installing languages from the translation department on this site (http://pagelines.com/translate/projects/pagelines-framework). Please correct me if I'm wrong.

So my question is what needs to be added to either Polylang or Framework to be able to enter manually editable strings in various languages.

Thanks for any enlightenment.

Jan

Share this post


Link to post
Share on other sites
janpeeters

A little addition. The Polylang dev explained if I could find the right Options in which the strings are stored you could make a plugin for it and add it to Polylang that way. Links and a little explanation can be found in this thread: http://wordpress.org/support/topic/plugin-polylang-site-title-and-tagline-are-not-changing?replies=23#post-3233719

I've dug in the Wordpress databases via phpMyAdmin, but to no avail (mainly because it's a large database).

Does Pagelines Framework have a Options API or a wpml-config.xml in which these can be found?

Thanks for your help!

Jan

Share this post


Link to post
Share on other sites
janpeeters

Right after posting my addition to this thread Chouby (Polylang Dev nickname on WP forums) posted the information below:

The whole discussion can be found here (the primary question has been solved in the latest dev build) but furtheron in the thread it gets to my question above:

http://wordpress.org...re-not-changing

I asked you about the wpml config file as it would have been a clue to know if the theme was compatible with WPML.

It's good to see that Pagelines source code is freely available:

http://phpxref.pagelines.com

I found here that the theme manages to be compatible with WPML.

I am not sure however that everything is managed in the function 'pagelines_magic_parse' in the file includes/library.options.php @ line 277.

Maybe you can ask the authors to add string translation management by Polylang with something like:

if (is_admin())

pll_register_string($key, $string);

else

return pll__($string);

The Polylang API works pretty much the same way as the WPML API, except that there is no group and that you must test 'is_admin' as 'pll_register_string' is not available on frontend and 'pll__' is not available on admin.

To answer your second post, the problem is not to include a string in the string translation table, but how to tell the theme that it has to use the translated string.

FYI, the file 'wpml-config.xml' is one way inform WPML it has to translate a string without using the WML API. Pagelines uses directly the WPML API

Hope this gives some more info. I've been really charmed by the way Chouby supports his plugin so maybe you could see if support could be added in collaboration with him. Thanks.

Share this post


Link to post
Share on other sites
Rob

If you look inside the Dashboard > PageLines > Site Options > Blog And Posts for your site, you're going to find that the string you're discussing for the meta tags. As these are dynamically added to the page from settings, it's quite possible they're not in any code that may be readily translated. I will discuss this with the developers and find out, and if so, will try to find a solution.


Former PageLines Moderator, Food Expert and Raconteur

Share this post


Link to post
Share on other sites
janpeeters

Hi Rob,

That was my thought too, but since Simon posted in another thread that Pagelines Framework front- and backend where fully translation compliant (in different wording) I thought there might be a way. So there might be a way to add the Framework options to the Polylang plugin via maybe a WPML API?

Thanks for inquiring!

Jan

Share this post


Link to post
Share on other sites
Rob

Honestly Jan, I don't know anything about Polylang. I do know many people use WPML quite successfully with PageLines.

Out of all the components of PageLines, that meta string is probably the only snippet that's dynamically generated and how you'd resolve it, candidly, is beyond my skills. Simon is our translation guru and I've asked him to look into this again.


Former PageLines Moderator, Food Expert and Raconteur

Share this post


Link to post
Share on other sites
janpeeters

Hi Rob, if you ask Simon, could you ask him how WPML translates these variable strings? That might lead the way. Thanks, Jan

Share this post


Link to post
Share on other sites
Rob

Will do.


Former PageLines Moderator, Food Expert and Raconteur

Share this post


Link to post
Share on other sites
janpeeters

Hi Rob,

I've posted a workaround for getting Polylang to work with Framework in the following thread:

http://www.pagelines.com/forum/topic/22597-workaround-translating-pl-framework-with-polylang/

So the big question that remains is:

How does Framework communicate with WPML (or vice versa) to provide for full translation?

Hopefully Simon can explain that so that it can be build into Polylang

Thanks, Jan

Share this post


Link to post
Share on other sites
Rob

Jan, I thought you posted a solution already. Is this resolved?


Former PageLines Moderator, Food Expert and Raconteur

Share this post


Link to post
Share on other sites
janpeeters

Hi Rob

this is just a temporary fix I would really love to have an answer to the following question:

How does Framework communicate with WPML (or vice versa) to provide for full translation?

Otherwise it stays a (what I call) ducktape solution. So if you could ask Simon again that would be great. There should be a way in which Framework provides WPML (or vice versa) with the right strings to translate.

Thanks, Jan

Share this post


Link to post
Share on other sites
Simon

WPML is different.

In a few sections instead of oset we use tset like this:

$the_text = ploption('quick_text_' . $i, $this->tset);

When tset is used in a section, it sets the $oset['translate'] to true. then the magic_parse function spots it and registers the string in WPML.

Same does not work for polylang, I tried it.

If your plugin works why not roll with it, were not going to add something into core that does not work properly. The WPML bit works thats why its in there.

Share this post


Link to post
Share on other sites
janpeeters

Hi Simon,

Thanks for your explanation. Where did you read that Pagelines needs to add something in to core? I was only asking how WPML translation for PL framework works so that Polylang dev could implement that functionality if viable. I'll report this back to the Polylang developer.

Thanks again,

Jan

Share this post


Link to post
Share on other sites
Danny

The topic was marked as resolved.


Please search our forums, before posting!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


  • Similar Content

    • DonRicardoRVM
      By DonRicardoRVM+
      ¿Where can  I translate the english items "Orders", "Adress", "Payment Methods". "Edit Account" and "Sing Out"of the my account page of the plugin Quickshop? In the po file they are not.
      I think that it have relation with this error: "Your theme version of my-account.php template', '2.6', 'the latest version, which supports multiple account pages and navigation, from WC 2.6.0".

      I use the Frame Work Pagelines´s Child theme for platform 5.

    • DonRicardoRVM
      By DonRicardoRVM+
      I need to translate the quickshop plugin to spanish, but I can´t do it. I edit the pot file, and compile the spanish translation in es_ES.mo and es_ES.po, bu it doesn´t works.
      Pleasu, could somebody help me?
    • Kedark
      By Kedark+
      Hello, when you update the DMS to the latest version 2.2.4, unfortunately, does not work translation theme. Has anyone encountered this? It looks as if the file with the translation was not read .. everything is in the original language. (Wordpress is also updated to the latest version)
      Help....
      RKA
    • fabienfons
      By fabienfons+
      Hi,
       
      I'd like to translate my website in french. (platform 5)
      How can i do ?
      Thanks
      Fabien
    • Audun MB
      By Audun MB+
      Are there any instructions for this? Seems like the plugin use standard .mo/.po for translation, but how do I prevent my language file from being overwritten with updates?
      Support for different number and currency formats in sections is also missing. For me this is an issue with Boxes. I can't use the counter with the current format (thousands separator), it looks really odd in Norwegian (and a lot of other languages). 
       
×