Home›Support›English Support›[Resolved] Blog posts written in right-to-left languages are not rendering properly
[Resolved] Blog posts written in right-to-left languages are not rendering properly
This thread is resolved. Here is a description of the problem and solution.
Problem: The client was experiencing issues with blog posts written in Arabic not rendering properly. They needed assistance with configuring WPML to support right-to-left (RTL) formatting for Arabic blog posts. Solution: We identified that the issue was due to incorrect placement of a variable in the translation string. The variable %s, which displays the list of available languages a blog post is available in, was incorrectly formatted as “s%” for RTL languages. We corrected the translation string for “This post is also available in” from
منشور المدونة متاح أيضًا باللغات التالية: s%
to
منشور المدونة متاح أيضًا باللغات التالية: %s
.
If you're experiencing similar issues, we recommend checking your translation strings for proper variable formatting in RTL languages. For further guidance, please refer to our documentation on WPML documentation.
Please note that this solution might be outdated or not applicable to your specific case. We highly recommend checking related known issues at https://wpml.org/known-issues/, verifying the version of the permanent fix, and confirming that you have installed the latest versions of themes and plugins. If the issue persists, please open a new support ticket.
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.
Background of the issue:
I am trying to display blog posts for languages that use right-to-left formatting correctly, specifically Arabic. The Arabic home (archive) page displays properly, however, Arabic blog posts do not. The site I need help with is hidden link.
Here's a link to an English blog post: hidden link
Here's a link to an Arabic blog post: hidden link
Symptoms:
Blog posts written in right-to-left languages are not rendering properly.
Questions:
How can I configure WPML to support right-to-left formatting for Arabic?
Are there specific settings in WPML to adjust the layout for right-to-left languages?
If CSS needs to be added, can we do so through the customizer rather than updating a theme file?
I still need help with this issue. Here are two screenshots of Arabic pages, representing the Archive Layout and Single Post Layout. The page should look like the archive layout with the header, footer, and right rail.
I've checked your Arabic page here hidden link and it looks broken.
Also, could you backup and update all WPML plugins to the latest version?
I will need to closely examine your website. Therefore, I will require temporary access (WP-Admin and FTP) to a test site where the problem has been replicated, if possible. This will enable me to provide better assistance and determine if any configurations need to be modified.
Please note that it is important to have a backup for security purposes and to prevent any potential data loss. You can use the UpdraftPlus plugin (https://wordpress.org/plugins/updraftplus/) to fulfill your backup requirements.
Your upcoming reply will be treated with confidentiality and will only be visible to you and me.
✙ To resolve the issue, I may need your consent to deactivate and reactivate plugins and the theme, as well as make configuration changes on the site if necessary. This emphasizes the significance of having a backup.
It looks like the FTP access is not working. Could you please follow the guide here that explains how to enable debugging and share the debug log with us? https://wpml.org/documentation/support/debugging-wpml/ Take note that, once you enabled debugging, please open this link hidden link so that the error log can be generated.
You can upload the debug log to Google Drive and share it with me.
[28-Feb-2025 18:57:25 UTC] PHP Fatal error: Uncaught ValueError: Missing format specifier at end of string in /srv/htdocs/wp-content/plugins/sitepress-multilingual-cms/classes/language-switcher/class-wpml-ls-render.php:335
Stack trace:
#0 /srv/htdocs/wp-content/plugins/sitepress-multilingual-cms/classes/language-switcher/class-wpml-ls-render.php(335): sprintf('\xD9\x85\xD9\x86\xD8\xB4\xD9\x88\xD8\xB1 \xD8\xA7\xD9\x84...', '\n <span clas...')
#1 /srv/htdocs/wp-content/plugins/sitepress-multilingual-cms/classes/language-switcher/class-wpml-ls-render.php(310): WPML_LS_Render->post_translations_label(Object(WPML_LS_Post_Translations_Slot))
I regret any inconvenience caused, but to proceed with troubleshooting, I kindly ask for a snapshot of the site. Alternatively, with your permission, I can create one myself. For this purpose, I typically recommend using the free plugin "Duplicator." If you're already familiar with Duplicator (https://wordpress.org/plugins/duplicator/), please skip the following steps and simply send me the archive file you downloaded.
To guide you further, please adhere to these instructions:
1. View the Duplicator instructions video: hidden link
3. If the archive file exceeds 400MB, please use Duplicator's file filters to exclude cache, wp-uploads directory, media, and archive files.
Once you have the archive file ready, kindly share the link with us. You can utilize platforms like Google Drive, Dropbox, or similar for file sharing, as the snapshot file might be large.
Please note that your next reply will be private, visible only to you and me. You can paste the file link there. Rest assured that once the issue is resolved, I will delete the local site.
Upon further investigation by our team, we discovered what we believe was causing the rendering issue.
The variable, %s, used to display the list of available languages a blog post is available in should have been written as “s%” in the translation string for Arabic, following suit with RTL formatting.
To fix the problem, we updated the translation string for “This post is also available in” from
منشور المدونة متاح أيضًا باللغات التالية: s%
To
منشور المدونة متاح أيضًا باللغات التالية: %s
Below is a link to an Arabic blog post for your reference:
hidden link
The blog post is now rendering perfectly on our end. Please see the attached screenshot for reference.
Can you please confirm that was the only cause of this issue?
We use cookies to optimize our website and services. Your consent allows us to process data such as browsing behavior. Not consenting may affect some features.
Functional
Always active
Required for our website to operate and communicate correctly.
Preferences
The technical storage or access is necessary for the legitimate purpose of storing preferences that are not requested by the subscriber or user.
Statistics
We use these to analyze the statistics of our site. Collected information is completely anonymous.The technical storage or access that is used exclusively for anonymous statistical purposes. Without a subpoena, voluntary compliance on the part of your Internet Service Provider, or additional records from a third party, information stored or retrieved for this purpose alone cannot usually be used to identify you.
Marketing
These cookies track your browsing to provide ads relevant to you.