-
Notifications
You must be signed in to change notification settings - Fork 143
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add locale for GE #92
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@EduardRindt-4F thanks for this PR. It looks good, but I've added a few comments. Please have a look.
@@ -147,6 +143,8 @@ private static FairyModule getFairyModuleForLocale(DataMaster dataMaster, Locale | |||
return new ZhFairyModule(dataMaster, randomGenerator); | |||
case DE: | |||
return new DeFairyModule(dataMaster, randomGenerator); | |||
case KA: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the language code GE or KA?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As mentioned in the PR description, this a rare case where a name of the country and language differs. 'GE' is the country (ISO 3166) , 'KA' is the language (https://www.loc.gov/standards/iso639-2/php/langcodes_name.php?iso_639_1=ka).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok. Looking back at it, the way it's done right now is inconsistent. We use language codes, while the fairy modules really represent specific locale, not only languages. I think you can keep either KA or GE here, but soon we should modify these enums to represent both language and country, cause there can be different document formats in same language speaking countries. However, either way, I would only stick with one of them for now till we get it fixed. Please choose one and stick to it in all your changes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, there is not much to be decided. The Georgian locale must have the 'ka' language as per ISO-639. If I don't want to change the language-to-module deduction logic in Bootstrap.getFairyModuleForLocale(...)
as well as the parser of control YAMLs, I have to stay with ka.
I do not like it (KaFairyModule
etc. is counter-intuitive), but I shall follow your rules.
See my latest commit, please.
/** | ||
* An address format typical for European countries but the UK and ex-Soviet union. | ||
*/ | ||
public abstract class ContinentalAddress extends AbstractAddress { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure if 2 levels of abstractions are needed here. Maybe it would be better to leave the implementation of the methods that most countries use in AbstractAddress
, and just override it in Ge
, En
and Zh
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe that the order of address parts ( street > number, ZIP > city) is really quite common for European countries, but nowhere else.
What is wrong with one intermediate class shared by four implementations?
this.baseProducer = baseProducer; | ||
} | ||
|
||
// District codes are not reachable at the moment. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does this mean that they are not reachable? Is there any list of codes or random numbers are being used?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I could not find the codes anywhere, GE Ministry of Interior has not published them.
} | ||
|
||
// A system of Ministry of Inferior Office codes is not known at the moment. | ||
private String getStateOfficeCode(String district) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does this mean that they are not known? Is there any list of codes or random numbers are being used?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The same as for district codes.
import spock.lang.Specification | ||
|
||
class GeAddressSpec extends Specification { | ||
private final String NEW_LN = System.lineSeparator(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add static import.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK
import spock.lang.Specification | ||
|
||
class GeNationalIdentityCardNumberProviderSpec extends Specification { | ||
private GeNationalIdentityCardNumberProvider generator |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe better idCardNumberProvider
or provider
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK
import spock.lang.Specification | ||
|
||
class GePassportNumberProviderSpec extends Specification { | ||
private GePassportNumberProvider generator |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe better idCardNumberProvider
or provider
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK
I've replied to some objections and added a commit with fixes of the rest. |
@EduardRindt-4F I have left you one more comment that requires fixing regarding the language codes. Please have a look. |
e74bc93
to
ff93656
Compare
A fix is ready for another review iteration. |
@EduardRindt-4F thank you for the changes. I do agree it is less intuitive, but it is consistent with the previous contributions. |
Cleaned-up & added one more unit test. |
An attempt to extend JFairy by the GE locale.
Note 1: ISO-639 code for Georgian language is "ka". I preferred using the (country code) "ge" wherever possible.
Note 2: I neither speak Georgian nor have any detailed knowledge of the country. The module is based just of information googled from the net.