onthegosystems / wpml-page-builders-elementor Goto Github PK
View Code? Open in Web Editor NEWA library used by WPML to handle Elementor
A library used by WPML to handle Elementor
In the translation editor there seems to be missing the ability to translate:
-Animated modules - You can add a highlighted animation to a text. You can translate this manually via Elementor editor in the second language
-Post listing widget words for "Read more" - Can be translated as well via Elementor editor in the second language.
-Global modules for Elementor - they can be set as local and unlinked from the global module and this allows you to translate them.
Hello,
Could you add "field-html" in class-wpml-elementor-form.php to enable the possibility to translate html form fields.
Best Regards.
public function get_fields() {
return array( 'field_label', 'placeholder', 'field_options', 'field_html' );
}
protected function get_title( $field ) {
switch( $field ) {
.....
case 'field_html':
return esc_html_( 'Form: Field html', 'wpml-string-translation' );_
protected function get_editor_type( $field ) {
switch( $field ) {
.....
case 'field_html':
return 'VISUAL';
When adding the Elementor Icon Box element (icon-box), you can specify a link.
That link is then not available for translation and it is copied to the translation.
As you can see in https://github.com/OnTheGoSystems/wpml-page-builders-elementor/blob/master/src/class-wpml-elementor-translatable-nodes.php#L339 we have only two elements there and the link element is not one of them.
Related to: elementor/elementor#6786
We found out an issue where multiple URL fields cannot be translated.
Example code that is not working:
add_filter('wpml_elementor_widgets_to_translate', function($widgets) {
$widgets['example_name] = [
'conditions' => ['widgetType' => 'example_name'],
'fields' => [
'url_field_1' => [
'field' => 'url',
'type' => __('Example URL Field 1', 'trailactive'),
'editor_type' => 'LINE', // or 'LINK' but relative links not possible that way
],
'url_field_2' => [
'field' => 'url',
'type' => __('Example URL Field 2', 'trailactive'),
'editor_type' => 'LINE', // or 'LINK' but relative links not possible that way
],
],
];
return $widgets;
});
I have found the issue to be inside of the class-wpml-elementor-translatable-nodes.php
file.
To fix the issue, we can set $field['field']
to something like "{$key}_{$field_key}"
before calling the get_string_name()
function in get()
and update()
(only when !is_numeric($key)
). I have tested this change and it seems to work fine now!
I can create a Pull Request if that would be helpful?
The Elementor element image-box has two fields - title and description.
The title is set to "Line" type, but the description is set to "Visual" type.
Because it is set to "Visual", when translated, in the translation there is an extra paragraph (
) tag and the element contents are actually outside of the proper tag.
If we change the element type to "Line" for the description - there is no issue, but then you miss the fine controls in the translation editor - which is a minus.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.