Skip to content

Internationalization ​

Validation messages, dialog titles and the OK label come from built-in dictionaries. submito picks the language from the closest lang attribute around the form (falling back to <html lang>). A regional code falls back to its base language (sr-Latn → sr, en-GB → en), and unknown languages fall back to English.

html
<html lang="sr">
  …
  <!-- or per form -->
  <section lang="en">
    <form id="contact">…</form>
  </section>
</html>

Built-in languages:

CodeLanguage
enEnglish (default and fallback)
bgBulgarian
deGerman
esSpanish
frFrench
srSerbian (Latin script)

Regional variants use the base dictionary, so de-AT, es-MX, fr-CA and sr-Latn all work.

Override messages ​

Use messages to replace any string for one form. Anything you leave out keeps the built-in text for the detected language:

js
submito.newForm({
  form: '#signup',
  messages: {
    required: 'Please fill this in.',
    minlength: 'Use at least {min} characters.',
    success_title: 'Welcome aboard!',
    success: 'Check your inbox to confirm your email.',
  },
});

For a language submito does not ship, pass the whole set in messages (for example, render it from your server for the current locale).

Keys ​

KeyEnglish default
requiredThis field is required.
emailPlease enter a valid email address.
urlPlease enter a valid URL.
numberPlease enter a valid number.
minlengthPlease enter at least {min} characters.
maxlengthPlease enter no more than {max} characters.
minPlease enter a value of {min} or more.
maxPlease enter a value of {max} or less.
patternPlease match the requested format.
invalidPlease enter a valid value.
phonePlease enter a valid phone number.
captchaIncorrect answer. Please try again.
captcha_requiredPlease complete the security check.
captcha_errorThe security check could not be completed. Please try again.
success_titleThank you!
successYour submission has been received.
error_titleSomething went wrong
errorWe could not process your request. Please try again.
networkNetwork error. Check your connection and try again.
okOK

{min} and {max} are replaced with the field's attribute values. success and error are only used when the server sends no message.

Server messages ​

submito never translates message or errors from your API. Return them in the user's language, for example based on the Accept-Language header or a locale field you add with data.

Contributing a language ​

Dictionaries live in src/i18n.js. Add a new top-level key (e.g. de) with the same keys as en, rebuild, and open a pull request.

Released under the MIT License.