This documentation site is about the unstable (upcoming) Comentario version.  Switch to the stable version »

Attribute: lang

The lang attribute of the <comentario-comments> tag controls language for the embedded comments

The lang attribute of the comments tag specifies the language that should be used for the embedded Comentario comments.

Its value is an RFC 5646 tag. If the attribute is omitted, Comentario will try to look it up on the current page by querying its <html> element for the lang attribute.

For the language to actually be selected, it has to be one of the values listed under ConfigurationStatic. Otherwise, Comentario will fall back to the global default: en (English).

Changing the value on-the-fly

This attribute is reactive: changing it on an already-embedded tag switches the language of the comments right away, without reloading the browser page:

document.querySelector('comentario-comments').setAttribute('lang', 'fr');

Because every visible label has to be translated, Comentario reinitialises itself completely: the messages are refetched in the new language, and the page data and the comments are reloaded. Removing the attribute falls back to the lang attribute of the page’s <html> element.

Reinitialisation discards any comment that is currently being written or edited, so avoid changing the value while the user may be typing.

See also