This thread is resolved. Here is a description of the problem and solution.
Problem:
Bricks Theme - SVG Translation Not Working in the Front-end when using SVG widget.
Solution:
Please check this errata for a workaround: https://wpml.org/errata/bricks-theme-svg-translation-not-working-in-the-front-end/
This is the technical support forum for WPML - the multilingual WordPress plugin.
Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.
Tagged: Compatibility
This topic contains 9 replies, has 2 voices.
Last updated by Waqas Bin Hasan 9 months, 2 weeks ago.
Assisted by: Waqas Bin Hasan.
Author | Posts |
---|---|
February 22, 2024 at 8:50 am #15331875 | |
ludovicC-2 |
Hello, What could cause that ? Thank you. |
February 22, 2024 at 9:06 am #15331965 | |
Waqas Bin Hasan Supporter
Languages: English (English ) Timezone: Asia/Karachi (GMT+05:00) |
Hi, Reference to our recent chat, I need to take a closer look at your site. So I request temporary access (WP-Admin and FTP), preferably to a test site where the problem has been replicated. Your next answer will be private, to share this information safely. Also provide detailed steps to reproduce the issue and links to pages in admin and on frontend. IMPORTANT: Please take a complete backup of the site to avoid data loss. I may need to activate/deactivate plugins also. See https://wpml.org/purchase/support-policy/privacy-and-security-when-providing-debug-information-for-support/ for details on privacy and security. Regards. |
February 22, 2024 at 12:49 pm #15333647 | |
Waqas Bin Hasan Supporter
Languages: English (English ) Timezone: Asia/Karachi (GMT+05:00) |
Thank you for the access and the details. I am working on this and 'll get back to you as soon as I find something or have a solution. |
February 23, 2024 at 7:41 am #15336187 | |
Waqas Bin Hasan Supporter
Languages: English (English ) Timezone: Asia/Karachi (GMT+05:00) |
Thank you for your patience on this. I've reproduced the problem in a clean install. Looks like there's a conflict between theme and the media translation. Because if I switch to another theme the translated image is shown correctly in WPML -> Media Translation. Please note that by default WordPress doesn't allow svg image uploads. So this is a feature offered by the Bricks theme. Since the theme is on our compatibility list, I've escalated the matter to our compatibility team for a possible solution. I'll update you as soon as I hear back, however, it may take some time. Your patience and cooperation is highly appreciated. |
February 29, 2024 at 9:25 am #15356837 | |
Waqas Bin Hasan Supporter
Languages: English (English ) Timezone: Asia/Karachi (GMT+05:00) |
Thank you for your patience and cooperation. Our team suggests the following workaround: IMPORTANT: Take a backup before proceeding. - Open the /wp-content/themes/bricks/includes/integrations/wpml/wpml.php file. public function get_translated_attachment_id( $attachment_id ) { return apply_filters( 'wpml_object_id', $attachment_id, 'attachment', true ); } - With: public function get_translated_attachment_id( $attachment_id ) { if ( is_admin() && did_action( 'admin_init' ) ){ $current_screen = get_current_screen(); } // Check if the current screen is the WPML Media Translation screen (you'll need the exact screen ID) if ( $current_screen && $current_screen->id === 'wpml_page_wpml-media' ) { return $attachment_id; // Return the original image if it's a WPML Media Translation screen. } return apply_filters( 'wpml_object_id', $attachment_id, 'attachment', true ); } Please let me know how it goes. |
February 29, 2024 at 11:11 am #15357465 | |
ludovicC-2 |
Hello, Now, I can upload different svg in Media translation per language as you can see on my print screen. But if I create a test page and change the language, we still see the original svg as you can see on my test english page : hidden link Any ideas ? |
February 29, 2024 at 12:39 pm #15357956 | |
Waqas Bin Hasan Supporter
Languages: English (English ) Timezone: Asia/Karachi (GMT+05:00) |
Thank you for the updates. I retested this in sandbox and looks like the issue on frontend is with SVG widget, while using Image widget works fine: - hidden link However, I am discussing with my team that if we can look into this too. Meanwhile, can you check on your side using Image widget and confirm? |
February 29, 2024 at 1:42 pm #15358493 | |
ludovicC-2 |
"Meanwhile, can you check on your side using Image widget and confirm?" "However, I am discussing with my team that if we can look into this too." |
March 1, 2024 at 7:23 am #15361054 | |
Waqas Bin Hasan Supporter
Languages: English (English ) Timezone: Asia/Karachi (GMT+05:00) |
Thank you for the updates. Sure, please take your time. I am also awaiting feedback from my team about the widgets and 'll update you accordingly. Have a great weekend. |
March 7, 2024 at 9:23 am #15382935 | |
Waqas Bin Hasan Supporter
Languages: English (English ) Timezone: Asia/Karachi (GMT+05:00) |
Thank you for your cooperation. Our team offers the following workaround for SVG widget: Remember to take theme's backup beforehand. - Open ..../wp-content/themes/bricks/includes/elements/svg.php file. $svg_path = get_attached_file( $this->settings['file']['id'] ); - For: $svg_path = get_attached_file( apply_filters( 'wpml_object_id', $this->settings['file']['id'], 'attachment', FALSE ) ); I've tested this in the sandbox and seems to work fine (hidden link). Please let me know so we can move forward and update the author about it. |
March 7, 2024 at 12:43 pm #15384402 | |
ludovicC-2 |
That's great, it works 🙂 |