isneezy / confere.js

A simple promise based javascript validation library with extras
https://isneezy.github.io/confere.js/
MIT License
1 stars 1 forks source link

Internationalization (i18n) #2

Open isneezy opened 7 years ago

isneezy commented 7 years ago

There is a need to internationalize the lib. has a proposal we can have a default internationalized strings/keys and give the developer the ability a flexibility to provide their own translation

configuration

var confere = new Confere({
   locale: "en" // locale: "en_US",
   i18n: { //custom translation (should override/merge the default)
      en: {
          name: "Name",
          "required" : "${name} field is required"
      },
      //... other locales translations
   }
   //... other configuration options
})
Romildo-Cumbe commented 7 years ago

Hello. I was looking to use this library in my system but it can't be in English. Since there's no i18n implemented yet, is there a way I can translate the default labels to portuguese?? Directly in the libs's source-code I mean

isneezy commented 7 years ago

@Romildo-Cumbe , thanks for posting here. i18n feature is on the way, for reasons beyond our control we had to postpone the release of the version that supports the feature. For now you can clone the repository, translate the strings to Portuguese, but pay attention when implementing in your system, add the locale: 'pt' parameter to be compatible with the version on the way #11

Steps to be taken: Make sure you have installed nodejs> = 5 and npm Clone or download the repo run npm install translate the strings located in ./src/ run npm run build more info see https://github.com/isneezy/confere.js#build-steps

If you have any doubts, feel free to post here Happy coding