gantry / gantry5

:rocket: Next Generation Template / Theme Framework
http://gantry.org
1.03k stars 206 forks source link

WordPress - qTranslate-X #886

Open dazzyon opened 8 years ago

dazzyon commented 8 years ago

I'm using the qTranslate-X plugin to create a multilingual site with Gantry 5.

Translating the following is without problems: Pages, Posts, Menu's, WooCommerce products.

The only issue i have is translating things inside the Gantry 5 particles. With qTranslate-X it's possible to use the following syntax to specify a text for different languages:

[:en]English Text[:de]Deutsch[:]

Even with the Custom HTML particle (process shortcodes enabled) this syntax is ignored (the full code like the example above is visible).

The strange thing is, when i add a widget particle (custom menu) and i set the title with the language tags, it works! When i do the same with another widget particle, the language tags don't work (full code visible).

mahagr commented 8 years ago

@newkind I think this is duplicate to #887

dazzyon commented 8 years ago

@mahagr I don't think it's the same issue. The shortcodes also don't work for Custom HTML particles, where shortcodes are already supported.

dazzyon commented 8 years ago

I guess the problem is that the content of the particles doesn't get passed through the Wordpress translation function "__(...)".

When i add the translate(...) function (part of the Gantry framework) to the "filter" function inside Platform.php (the function that enables shortcodes for custom HTML particles if i understand it correctly), the language shortcodes work:

public function filter($text) { return translate(\do_shortcode($text)); }

Maybe there is an easy way to make this work for all particles?

bhodeler commented 8 years ago

Hi Dazzyon!

I´d like to know if you have got to solve this issue.

I'm doing the translation of a web made with Isotope theme wordpress. I wonder if it is possible to translate the content of the particles with which it works in Gantry 5. My problem is in how to translate texts that I have included in various Gantry particles, because it does not recognize as shortcodes.

Thanks.

dazzyon commented 8 years ago

Hi bhodeler,

I don't have a solution for the particles that don't support shortcodes unfortunately. By editing de Platform.php file as described above it only works for custom HTML particles.

bhodeler commented 8 years ago

Ok. Thanks a lot!!!

dazzyon commented 8 years ago

@bhodeler I created a pull request for the translate function in shortcode enabled particles.