Meh components are displayed in English by default. Using the language prop an existing different translation can be loaded. When no such translation exists, or you want to overwrite some of the labels, you can use the custom-translations prop.
Meh comes with translations for several languages out of the box. You can activate these by setting the language attribute:
<!-- Use German translations -->
<meh-comments
backend="https://comments.example.com"
language="de">
</meh-comments>Currently supported languages include:
- English (
en) - default - German (
de)
You can override specific translation strings by providing a JSON object through the custom-translations attribute:
<meh-form
backend="https://comments.example.com"
custom-translations='{"formTitle": "Join the discussion", "submitButton": "Post Comment"}'>
</meh-form>You only need to include the strings you want to override - any strings not specified will use the default translations for the selected language.
You can use both the language and custom-translations attributes together. In this case, Meh will:
- Load the default English translations
- Override them with the specified language translations
- Finally override those with your custom translations
<meh-comments
backend="https://comments.example.com"
language="de"
custom-translations='{"noComments": "Sei der Erste, der etwas sagt!"}'>
</meh-comments>You can find the complete list of translation strings in several ways:
- Look at the component's documentation. The
Propertiestable lists all available translation string keys in thetypecolumn. - Look at the default translations in each component's source file