Skip to content

Localization & Direction

The widget can speak the same language as the rest of your site and respect right-to-left layouts.

Pick a language

Comnto ships with localisation bundles for the following locales:

ar, de, en, es, fa, fr, he, hi, id, it, ja, ko, nl, pl, pt, ru, sv, tr, uk, vi, zh, zh-TW

Use whichever form suits you best:

  • data-locale="fr"
  • window.comnto({ site: 'my-blog', locale: 'fr' })
  • widget.setLocale('fr')

If you omit the locale, the widget falls back to the page <html lang="..."> attribute or the site default stored in Comnto.

Custom phrases

Provide overrides with the localization option. You can deliver either a single-locale object or a map of locale codes.

js
window.comnto({
  el: '#comments',
  site: 'my-blog',
  locale: 'en',
  localization: {
    en: {
      heading: { title: 'Discussion' },
      noComments: { title: 'Be the first to comment' }
    }
  }
});

At runtime you can refine copies without reloading the iframe:

js
widget.setLocalization({
  ar: {
    heading: { title: 'التعليقات' }
  }
});

Direction (LTR / RTL)

The widget automatically switches to RTL when the locale uses a right-to-left script (Arabic, Hebrew, Persian, etc.). You can override the direction manually:

js
widget.setDirection('rtl'); // or 'ltr' / 'auto'

When you call setDirection, the widget updates the root <html dir="..."> attribute inside the iframe.

Mixed-language pages

For multilingual pages:

  1. Mount one widget per language by passing the desired locale (and site id) in each window.comnto() call.
  2. If you dynamically switch languages, call widget.setLocale(newLocale) and re-send the relevant overrides with widget.setLocalization().