Intl.DateTimeFormat to format dates based on locale (fr-FR or ar-SA) and apply the date class to relevant CMS elements. lang attribute (fr or ar) via page settings or JavaScript for accurate localization. dir="rtl" on the <html> tag or container, and apply RTL-specific CSS for layout adjustments.To display dates/times correctly in French and Arabic and support right-to-left (RTL) layout for Arabic, you’ll need to use a combination of settings in Webflow and embedded code where necessary.
Webflow’s CMS doesn’t localize date formats by default, so you’ll need custom code using JavaScript to handle locale-based date formatting.
Intl.DateTimeFormat, specifying the correct locale, such as "fr-FR" for French or "ar-SA" for Arabic.
Example usage within an <embed> or <script> tag (place in Page Settings or before </body> in Custom Code):
document.querySelectorAll('.date').forEach(el => {
const rawDate = new Date(el.textContent.trim());
const isArabic = document.documentElement.lang === 'ar';
const locale = isArabic ? 'ar-SA' : 'fr-FR';
el.textContent = new Intl.DateTimeFormat(locale, {
year: 'numeric', month: 'long', day: 'numeric'
}).format(rawDate);
});
date to each date element in your Webflow Collection List.<html lang="fr"><html lang="ar">
Note: Webflow does not allow direct editing of the
<html>tag. Use JavaScript or server settings to modify thelangattribute at runtime if needed.
To enable right-to-left layout for Arabic pages or sections:
dir="rtl" attribute to the <html> or a wrapping container on your Arabic pages.```html
<script>
document.documentElement.setAttribute('dir', 'rtl');
</script>
```
```css
body {
direction: rtl;
text-align: right;
}
```
dir="rtl" manually on top-level Div Blocks if doing it page-wide isn’t possible.
Ensure the following when building RTL layouts:
To localize dates/times for French and Arabic on your Webflow site, use custom JavaScript with Intl.DateTimeFormat. For Arabic layout support, set dir="rtl" on your pages or wrapping elements and use RTL-aware styles. Combine these with correct lang attributes to ensure proper localization and accessibility.