Skip to content

Internationalization (i18n)

robust-validator supports 66 languages in error messages.

Setting locales

You should import languages that you plan to support like the following example.

ts
import { validate, setLocales, en, fr, de } from "robust-validator";

setLocales([en, fr, de]);

Default language

You can decide default language selection.

ts
import { validate, setLocales, setOptions, en } from "robust-validator";

setLocales(en);

// Setting the default language
setOptions({
  language: "en",
});

Active language

You can override the active language by users' selection for every data validation.

ts
await validate(data, { email: "required" }, { language: "de" });

Supported Languages

Code (ISO 639-1)Language Name
arArabic
azAzerbaijani
beBelarusian
bgBulgarian
bsBosnian
caCatalan
csCzech
cyWelsh
daDanish
deGerman
elGreek
enEnglish
esSpanish
etEstonian
euBasque
faPersian
fiFinnish
frFrench
hrCroatian
huHungarian
idIndonesian
itItalian
jaJapanese
kaGeorgian
koKorean
liLimburgish
ltLithuanian
lvLatvian
mkMacedonian
mnMongolian
msMalay
noNorwegian
nlDutch
plPolish
ptPortuguese
roRomanian
ruRussian
seNorthern Sami
slSlovenian
sqAlbanian
srSerbian
svSwedish
trTurkish
ukUkrainian
viVietnamese
zhChinese

Released under the MIT License.