-
Notifications
You must be signed in to change notification settings - Fork 240
Internationalization (i18n)
Geddy provides internationalization support out of the box, with localized error messages in the following languages:
- Chinese (Simplified)
- English (US)
- German (Germany)
- Japanese (Japan)
- Portuguese (Brazil)
- Spanish (Spain)
You can set a specific locale at the request level, or a default one for your entire app. The default locale if you don't set one is American English ('en-us').
Set a locale in your environment.js by setting the defaultLocale
property on the i18n
config option:
...
, i18n: {
defaultLocale: 'ja-jp'
}
...
Geddy will load i18n data according to the loadPaths
property of your app's i18n
config -- an array of paths to look in for JSON files containing i18n data. By default, it contains an entry for 'config/locales' in your app.
Geddy's i18n code loads the data into data structures based on the filename. (So the data in /foo/bar/en-uk.json gets loaded into the en-uk locale, etc.)
Internationalization data is loaded from JSON files in the following format:
{
"model.validatesPresent": "「{name}」の入力が必要です。"
, "model.validatesAbsent": "「{name}」の入力は不要です。"
, "model.validatesConfirmed": "「{name}」と「{qual}」が一致しません。"
, "model.validatesFormat": "「{name}」のフォーマットが正しくありません。"
, "model.validatesExactLength": "「{name}」は{qual}文字でなければいけません。"
, "model.validatesMinLength": "「{name}」は{min}文字以上でなければいけません。"
, "model.validatesMaxLength": "「{name}」は{max}文字以内でなければいけません。"
, "model.validatesWithFunction": "「{name}」は有効ではありません。"
}