Jump to content


Photo
- - - - -
Resolved

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

polylang translation translate

This topic has been archived. This means that you cannot reply to this topic.
13 replies to this topic

#1 janpeeters

janpeeters

    Advocate

  • Members

  • 307 posts

Posted 07 October 2012 - 03:15 PM

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:

Please Login or Register to see this Hidden Content


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 (

Please Login or Register to see this Hidden Content

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

#2 janpeeters

janpeeters

    Advocate

  • Members

  • 307 posts

Posted 07 October 2012 - 03:41 PM

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:

Please Login or Register to see this Hidden Content


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

#3 janpeeters

janpeeters

    Advocate

  • Members

  • 307 posts

Posted 07 October 2012 - 03:52 PM

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:

Please Login or Register to see this Hidden Content



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:

Please Login or Register to see this Hidden Content


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:

Please Login or Register to see this Hidden Content


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.

#4 Rob

Rob

    One Smart Egg

  • Members
  • 13575 posts

Posted 07 October 2012 - 09:08 PM

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.

#5 janpeeters

janpeeters

    Advocate

  • Members

  • 307 posts

Posted 07 October 2012 - 09:13 PM

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

#6 Rob

Rob

    One Smart Egg

  • Members
  • 13575 posts

Posted 08 October 2012 - 03:18 AM

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.

#7 janpeeters

janpeeters

    Advocate

  • Members

  • 307 posts

Posted 08 October 2012 - 07:31 AM

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

#8 Rob

Rob

    One Smart Egg

  • Members
  • 13575 posts

Posted 08 October 2012 - 09:27 PM

Will do.

#9 janpeeters

janpeeters

    Advocate

  • Members

  • 307 posts

Posted 12 October 2012 - 10:09 AM

Hi Rob,

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

Please Login or Register to see this Hidden Content



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

#10 Rob

Rob

    One Smart Egg

  • Members
  • 13575 posts

Posted 15 October 2012 - 08:53 PM

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

#11 janpeeters

janpeeters

    Advocate

  • Members

  • 307 posts

Posted 16 October 2012 - 07:10 AM

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

#12 Simon_P

Simon_P

    Messer

  • Administrators



  • 8388607 posts

Posted 16 October 2012 - 04:28 PM

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.

#13 janpeeters

janpeeters

    Advocate

  • Members

  • 307 posts

Posted 16 October 2012 - 05:13 PM

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

#14 Danny

Danny

    Is Awesome!

  • Moderators
  • 16897 posts

Posted 18 October 2012 - 11:50 AM

The topic was marked as resolved.