Alpaca provides localized bundles for several locales including:

  • Chinese (zh_CN)
  • Czech (cs_CZ)
  • Croatian (hr_HR)
  • Dutch (nl_BE)
  • Finnish (fi_FI)
  • French (fr_FR)
  • German (variant 1) (de_AT)
  • German (variant 2) (de_DE)
  • Greek (el_GR)
  • Italian (it_IT)
  • Japanese (ja_JP)
  • Norwegian (nb_NO)
  • Polish (pl_PL)
  • Portugeuse (pt_BR)
  • Spanish (es_ES)
  • Swedish (sv_SE)

These bundles allow Alpaca to render default messages (such as validation messages) in translated languages.

In addition, Alpaca supports localized text in forms. You simply supply these values as you normally would within the JSON schema, options or other portions of the Alpaca configuration.

Example: Spanish

Here is an example of a form that renders in Spanish. To change the locale to Spanish (es_ES), override the view and specify the locale.

{% raw %} {% endraw %}

Example: Chinese

Here is an example of a form that renders in Chinese.

{% raw %} {% endraw %}

Example: Overriding locale messages on-the-fly

You can override locale-specific messages on the fly. All values are derived from the underlying messages that you can extend programmatically by defining a new view, as shown here. In this example, we also use the $.alpaca.setDefaultLocale() method to set a default language rather than specifying in the options.

{% raw %} {% endraw %}

Adding your own locale bundles

Alpaca provides an easy framework for adding and modifying for various languages. It comes with several i18n bundles pre-stocked. All of the i18n bundles are contained within the source code under the /src/js/messages/i18n directory.

Simply take one of the existing bundles and copy it for your own locale. Enter all of the translations into it and then include it into your copy of gulpfile.js. Then simply specify which locale you'd like Alpaca to render in within the options. Or use $.alpaca.setDefaultLocale() to set the default.

And boom, you're all set.

Consider contributing your locale bundle to the Alpaca project! Chances are that there are others out there trying to do what you're doing. Your hard work could save someone, somewhere, a lot of time and effort.

Simply submit a pull request with your changes. Or drop us an email. We'd enjoy working with you.