Next step is add default error messages into langValidation in core/locale/LangValidation.js file.
const langValidation = Object.freeze({
required: {
"en": "The _attribute_ is required",
"id": "_attribute_ wajib di isi",
"es": "El campo _attribute_ es obligatorio",
"hi": "_attribute_ आवश्यक है",
"ru": "Поле _attribute_ является обязательным",
"pt": "O campo _attribute_ é obrigatório",
"zh": "_attribute_ 必填",
"ja": "_attribute_ は必須です"
// add new translation with new locale id
},
email: {
"en": "The _attribute_ must be in E-mail format",
............
Then new translation into dictionary in core/locale/Dictionary.js file.
const Dictionary = Object.freeze({
"success": {
"en": "success",
"id": "sukses",
"es": "éxito",
"hi": "सफलता",
"ru": "успех",
"pt": "sucesso",
"zh": "成功",
"ja": "成功"
// add new translation with new locale id
},
"failed": {
"en": "failed",
.........
2. Bliss App & Admin App
First add locale id into enum LocaleId in lib/config/LocaleConfig.dart file.
enum LocaleId { en, id, es, hi, ru, pt, zh, ja } // add new locale id into this enum
Then add language into static function locales()
class LocaleConfig {
/**
* list of locales
*/
static List<Language> locales() {
return [
Language(id: LocaleId.en.name, name: "English"),
Language(id: LocaleId.id.name, name: "Bahasa Indonesia"),
Language(id: LocaleId.es.name, name: "Español (Spanish)"),
Language(id: LocaleId.hi.name, name: "हिंदी (Hindi)"),
Language(id: LocaleId.ru.name, name: "Русский (Rusia)"),
Language(id: LocaleId.pt.name, name: "Português (Portugis)"),
Language(id: LocaleId.zh.name, name: "中文 (Mandarin)"),
Language(id: LocaleId.ja.name, name: "日本語 (Japanese)"),
// add new Language() model here with new id from enum that you add before
];
}
The last step is, add new translation language into assets/lang/lang.json file.
{
"ok":{
"en":"ok",
"id":"oke",
"es": "vale",
"hi": "ठीक",
"ru": "ок",
"pt": "ok",
"zh": "好",
"ja": "はい"
// add new translation with new locale id
},
"yes":{
"en":"yes",
..........
Note: both admin the bliss app using same json on the app, means if you add new language in admin app, you must copy that lang.json into bliss app too.