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.
Sun | Mon | Tue | Wed | Thu | Fri | Sat |
---|---|---|---|---|---|---|
- | 9:00 – 14:00 | 9:00 – 14:00 | 9:00 – 14:00 | 9:00 – 14:00 | 9:00 – 14:00 | - |
- | 15:00 – 18:00 | 15:00 – 18:00 | 15:00 – 18:00 | 15:00 – 18:00 | 15:00 – 18:00 | - |
Supporter timezone: Asia/Dhaka (GMT+06:00)
This topic contains 11 replies, has 0 voices.
Last updated by Prosenjit Barman 1 week ago.
Assisted by: Prosenjit Barman.
Author | Posts |
---|---|
November 14, 2024 at 4:36 pm #16404138 | |
kevinL-62 |
Background of the issue: Symptoms: Questions: |
November 15, 2024 at 7:58 am #16405984 | |
Prosenjit Barman Supporter
Languages: English (English ) Timezone: Asia/Dhaka (GMT+06:00) |
Hello There, From your description, I understood that you Translated the contents first using WPML Translation Editor and later manually edited the Translation using Elementor Editor. Please note that the mix of translation methods you're using is not typically recommended, as it can lead to such conflicts. To avoid this issue, it's advisable to stick to one method of translation. If you have started translating content using the ATE, please don't manually alter the translation using the WordPress Editor. Since the translation memory isn't shared between the translation method or editors, any manual changes you make will be overridden when you update the translation again using the ATE. I hope you can understand. If you want to apply a line break using CSS for the translation, you can do that by specifically defining the CSS for that language, instead of manually making changes to the translation. You can target the Chinese language with CSS like this: html[lang="zh-hans"] .your-css-class { /* Specific styles for Chinese */ white-space: pre-wrap; color: red; /* Example styling */ } Replace .your-css-class with the actual class you're using (e.g., .line-break and value for lang with the actually lang value for the Chinese language. If you inspect the Chinese version, you'll see that value in the HTML tag.). I hope you can understand. If you have any more questions or need further assistance, please feel free to reach out. I'll be happy to help. Best regards, |
November 15, 2024 at 10:02 am #16407037 | |
kevinL-62 |
Dear Prosenjit, Thank you! I would like to clarify the steps to make it work. 1. So I will apply the CSS you provided in the gem global custom CSS. "I want to fix the line break issue. " "I want to fix "I want to fix <be class=".your-css-class"> And I want this line break to be applied screen width specific . For example:only Mobile will apply this line-break CSS rule. 4. Since it's ATE, all the setting there won't be overwritten unless the default language has been changed. Thank you for your clarification. |
November 18, 2024 at 3:58 am #16412645 | |
Prosenjit Barman Supporter
Languages: English (English ) Timezone: Asia/Dhaka (GMT+06:00) |
Hello There! Thank you for the update. Here’s my response to each of your points below. 1) Yes. You can also add the custom CSS by going to Appearance > Customer > Additional CSS. 2) Yes. If you add the translation using ATE, you'll need to use the ATE to make any edits/updates. If you make manual changes, that will be overwritten next time when you update the translation using ATE. 3) To format text in the editor, you’ll need to apply the same formatting in the default language. For example, if you add a line break using a `<br>` tag in the default language post, you’ll see an HTML marker (screenshot: hidden link) for that sentence/paragraph when adding or updating the translation. To ensure the formatting matches the default language, place the cursor at the marker and replicate the same formatting. However, if you want to apply the formatting to only one language, it’s best to use a CSS class. Define the class in the default language and update the translation, ensuring the class appears correctly in other languages. Then, use CSS to apply the specific styles for the language where you want the line break to appear. If you want the CSS to apply only to a specific viewport, define the class with a line-break rule for certain screen sizes using media queries. For example, to target mobile devices: @media (max-width: 768px) { .your-css-class { display: block; } } 4) Content settings in ATE will not be overwritten unless you modify the source content in the default language. I hope this clarifies your concerns. If you need further assistance, please don’t hesitate to reach out. I’ll be glad to help! Best regards, |
November 18, 2024 at 10:32 am #16414087 | |
kevinL-62 |
Dear Prosenjit, Thank you for folowing up. If you don't mind, I 've explained how I made it and what's the problem I'm still facing? hidden link Thank you for your help |
November 19, 2024 at 5:51 am #16417618 | |
Prosenjit Barman Supporter
Languages: English (English ) Timezone: Asia/Dhaka (GMT+06:00) |
Hello There, I reviewed the Japanese page and noticed that the HTML you added in the translation editor has not been included—only the `<br>` tag is present, which is expected behavior. In the Translation Editor, any external HTML you add will be stripped out and will not appear on the frontend. However, using the `<br>` tag, we can also apply some CSS to ensure the line break appears only on mobile devices. Below is the CSS code that will help in achieving what you're looking for. /* Hide the break on desktop */ html[lang="jp-JP"] .elementor-element-39d6b93 br { display: none; } /* Show the break on mobile devices */ @media (max-width: 768px) { html[lang="jp-JP"] .elementor-element-39d6b93 br { display: inline; } } Explanation: .elementor-element-39d6b93: This is the parent class of the element containing the text. Inspect the page using the browser console to identify this class. For other areas where you need similar adjustments, you can find and target their respective parent classes. CSS Rules: I hope the information above will help in solving the issue. Please feel free to let me know if you need further assistance or clarification. I'll be happy to help. Best regards, |
November 19, 2024 at 10:12 am #16418655 | |
kevinL-62 |
Thanks a lot Prosenjit, So does it mean I have to add the CSS script for every language I need, and every elementor container box, instead for a general one? Thank you! |
November 20, 2024 at 5:01 am #16422220 | |
Prosenjit Barman Supporter
Languages: English (English ) Timezone: Asia/Dhaka (GMT+06:00) |
Hi There! Since you want to apply the CSS changes to a specific language, the process I shared earlier is optimal for this purpose. However, if you're open to making manual changes in other languages, you can use a more universal approach to apply the mobile line-break behavior across your site wherever needed. Please note that with this approach, you will need to manually adjust the translations each time you update them using the WPML Translation Editor. I've shared the process, below. - You can create a single CSS rule that works site-wide for any <br> tag with a specific class, regardless of the language or container: /* General rule to hide <br> on larger screens */ br.mobile-break { display: none; } /* Show <br> only on mobile screens */ @media (max-width: 768px) { br.mobile-break { display: inline; } } - Simply add the mobile-break class to any <br> tag where you want the line break to appear only on mobile devices. This approach allows you to reuse the same CSS across your entire site, regardless of the language or container. Please let me know if the steps above resolve your concern or if you need further assistance. I'll be happy to help. Best regards, |
November 21, 2024 at 1:55 am #16427031 | |
kevinL-62 |
Dear Prosenjit, would you mind to check this video? I tried to apply, not sure if it's the correct approach as you mentioned./ hidden link Thank you! |
November 21, 2024 at 2:06 am #16427083 | |
kevinL-62 |
Hi, I asked ChatGPT and seems below solution fixed my concern. 1. Enable Shortcode Parsing in WPML Translations Navigate to WPML → Settings → Custom XML Configuration. xml This tells WPML to treat [mobile-break] as a valid shortcode and process it in the translated content. 2. Ensure Shortcode is Registered in functions.php php function mobile_break_shortcode() { 3. Test the Translation 4. Verify the CSS is Applied css /* Show <br> only on mobile screens */ |
November 21, 2024 at 2:37 am #16427110 | |
kevinL-62 |
Unfortunately, this method caused my mobile version broken in layout. (Like the attachment, Especially with my slider revolution modules.), so I will remove those codes first. But it's actually very convinient (I can just type a specific [mobile-break], then it will apply the line-break for mobile screen. |
November 21, 2024 at 4:29 am #16427230 | |
Prosenjit Barman Supporter
Languages: English (English ) Timezone: Asia/Dhaka (GMT+06:00) |
Hi There! I reviewed the video, and aside from the desktop screen, nothing else appears throughout the 4-minute duration. Please refer to this screenshot: hidden link. It seems the correct screen may not have been selected during the video. However, ;et me clarify what I mentioned in my previous response: - Create a CSS rule for a class named `.mobile-break`. This should be the approach if you want to define a universal class. But, please note that the changes will be removed once you update the translation through ATE. So, I'd recommend following the advice in this response: https://wpml.org/forums/topic/multi-language-synchronization-edited-content-being-overwritten/#post-16417618 Regarding the approach you've shared, it involves custom coding, and for static or simple styles, creating a shortcode might not be the best option. Shortcodes can add unnecessary complexity to the codebase and may lead to potential issues on the pages where they are used. I’d like to mention that providing custom coding support is beyond the scope of our assistance. That's why, sorry to say we might not be able to assist you with the direct coding. However, we can guide you with suggestions to help achieve your goal or resolve the issue. I hope you can understand. It would be better to go with the CSS approach instead of the Shortcode. Feel free to let me know if you have any other questions or need assistance. I'll be happy to help. Best regards, |