arturmkrtchyan / iban4j

A Java library for generation and validation of the International Bank Account Numbers (IBAN ISO_13616) and Business Identifier Codes (BIC ISO_9362).
http://iban4j.org
Apache License 2.0
276 stars 125 forks source link

i18n of error messages #15

Closed mikegr closed 9 years ago

mikegr commented 10 years ago

Hi, I have created a fork in order to be able to localize the error message for an Android client. https://github.com/mikegr/iban4j/tree/iban4android My fork uses the Android string resource directly. I would like to enhance iban4j so that it can both be used for Java !and! Android development. Maybe we can refactor the exception to consist of an error code and error parameters, which are later translated to ResourceBundle+MessageFormat in Java and Context.getString in Android.

Any comments on that?

arturmkrtchyan commented 10 years ago

Sounds good to me. Can you sketch your first proposal and then we can review it ?

I really liked the idea to refactor the exception in order to expose more data.

arturmkrtchyan commented 10 years ago

Do you need these details in order to show specific messages in your UI ?

I think IbanFormatException can be enhanced to provide IBAN_ENTRY (e.g. account_number, bank_code, etc..), VALUE and CONSTRAINT (e.g. only_digits, only_letters).

Let me know if you need some support for implementing this.

mikegr commented 10 years ago

I have updated my fork, where I separated the Android code from the Java code. Please have a look!

arturmkrtchyan commented 10 years ago

Do you have the changes in non-android version ? If so just send me a pull request. Please make sure to get rid of android specific code in pull request as I want to keep it independent.

mikegr commented 10 years ago

I will separate the iban4j code from the iban4android code and come back.

arturmkrtchyan commented 9 years ago

Fixed with version 3.0.0