Alpaca provides localized bundles for several locales including:
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.
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
.
Here is an example of a form that renders in Chinese.
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.
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.