Skip to content
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

Merged
merged 5 commits into from
Nov 15, 2017
Merged

Conversation

EduardRindt-4F
Copy link
Contributor

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.

Copy link
Contributor

@OlgaMaciaszek OlgaMaciaszek left a 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:
Copy link
Contributor

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?

Copy link
Contributor Author

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).

Copy link
Contributor

@OlgaMaciaszek OlgaMaciaszek Nov 10, 2017

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.

Copy link
Contributor Author

@EduardRindt-4F EduardRindt-4F Nov 13, 2017

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 {
Copy link
Contributor

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?

Copy link
Contributor Author

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.
Copy link
Contributor

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?

Copy link
Contributor Author

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) {
Copy link
Contributor

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?

Copy link
Contributor Author

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();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add static import.

Copy link
Contributor Author

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
Copy link
Contributor

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?

Copy link
Contributor Author

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
Copy link
Contributor

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK

@EduardRindt-4F
Copy link
Contributor Author

I've replied to some objections and added a commit with fixes of the rest.

@OlgaMaciaszek
Copy link
Contributor

@EduardRindt-4F I have left you one more comment that requires fixing regarding the language codes. Please have a look.

@EduardRindt-4F
Copy link
Contributor Author

A fix is ready for another review iteration.

@OlgaMaciaszek
Copy link
Contributor

@EduardRindt-4F thank you for the changes. I do agree it is less intuitive, but it is consistent with the previous contributions.
I have created an issue to address this: #93 .
Also, I have noticed one more thing that should be fixed - the tests are written in Groovy. The semicolons at the end of the lines are not needed there. Please remove them.

@EduardRindt-4F
Copy link
Contributor Author

Cleaned-up & added one more unit test.

@OlgaMaciaszek OlgaMaciaszek merged commit be4ea2b into Devskiller:master Nov 15, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants