vekexasia / android-edittext-validator

Android form edit text is an extension of EditText that brings data validation facilities to the edittext.
MIT License
1.45k stars 378 forks source link

error string internationalisation #46

Closed mahermeg17 closed 8 years ago

mahermeg17 commented 8 years ago

Hi, I need to show error msg for Arabic users which not supported (https://github.com/vekexasia/android-edittext-validator/tree/09a1a466e687e9afb4eef0daf3f179cdae8b967f/library/res) So I use [whatever:emptyErrorString="@string/msg_invalid_data_empty"] into my layout xml file. But it only shows fr msg which is the default language of the phone. Even I force my app to use Arabic language (all other UI are correctly in Arabic). And when I use a Validator from java like this

MultiValidator tmpValidator = new AndValidator(); tmpValidator.enqueue(new FormAlphaNumericValidator(getResources().getString(R.string.msg_invalid_data_format))); tmpValidator.enqueue(new EmptyValidator(getResources().getString(R.string.msg_invalid_data_empty))); mScannedDocNumber.addValidator(tmpValidator);

My FormAlphaNumericValidator extends AlphaNumericValidator show correctly the error msg in Arabic. But not the EmptyValidator. Are there a better way to show error msg in Arabic, or should I extends all needed Validators ?

Thanks,

vekexasia commented 8 years ago

Just create The translations and submit a pull request :)

Il 01 ago 2016 12:14 PM, "megadmini" notifications@github.com ha scritto:

Hi, I need to show error msg for Arabic users which not supported ( https://github.com/vekexasia/android-edittext-validator/tree/09a1a466e687e9afb4eef0daf3f179cdae8b967f/library/res ) So I use [whatever:emptyErrorString="@string/msg_invalid_data_empty"] into my layout xml file. But it only shows fr msg which is the default language of the phone. Even I force my app to use Arabic language (all other UI are correctly in Arabic). And when I use a Validator from java like this

MultiValidator tmpValidator = new AndValidator(); tmpValidator.enqueue(new FormAlphaNumericValidator(getResources().getString(R.string.msg_invalid_data_format))); tmpValidator.enqueue(new EmptyValidator(getResources().getString(R.string.msg_invalid_data_empty))); mScannedDocNumber.addValidator(tmpValidator);

My FormAlphaNumericValidator extends AlphaNumericValidator show correctly the error msg in Arabic. But not the EmptyValidator. Are there a better way to show error msg in Arabic, or should I extends all needed Validators ?

Thanks,

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/vekexasia/android-edittext-validator/issues/46, or mute the thread https://github.com/notifications/unsubscribe-auth/AAMPS5-YTot2a_ca1Bzh0jBD7BZcbfQ8ks5qbccAgaJpZM4JZcJV .

mahermeg17 commented 8 years ago

OK. I will. But just to confirm, passing a custom string to the constructor do not really change the error msg ? new EmptyValidator(getResources().getString(R.string.msg_invalid_data_empty)));

vekexasia commented 8 years ago

Depends on the validator. but correct way to localize is to create proper string values for the desired language

On Mon, Aug 1, 2016 at 1:23 PM, megadmini notifications@github.com wrote:

OK. I will. But just to confirm, passing a custom string to the constructor do not really change the error msg ? new EmptyValidator(getResources().getString(R.string.msg_invalid_data_empty)));

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/vekexasia/android-edittext-validator/issues/46#issuecomment-236555090, or mute the thread https://github.com/notifications/unsubscribe-auth/AAMPS14VuIEdJU8kD2NvdDEcRSkCuMuLks5qbdcZgaJpZM4JZcJV .

Andrea Baccega [image: Email]me@andreabaccega.com [image: Hangouts]vekexasia@gmail.com [image: Personal site] http://www.andreabaccega.com/ [image: Linkedin Profile] http://it.linkedin.com/in/andreabaccega [image: Facebook] https://www.facebook.com/andrea.baccega [image: Google+] https://plus.google.com/109217393200753135791 [image: Twitter] http://twitter.com/veke87 [image: StackOverflow] http://stackoverflow.com/users/314407/andrea-baccega [image: GitHub] https://github.com/vekexasia

mahermeg17 commented 8 years ago

waiting for the pull acceptation :)

vekexasia commented 8 years ago

Done, will release it today :) thank you and sorry for the delay.