-
-
Notifications
You must be signed in to change notification settings - Fork 23
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
Use ISO 3166-2 to identify the country and the subdivisions #388
Conversation
da9fa9c
to
0b6a495
Compare
8d144f9
to
5d618d7
Compare
d1d4c95
to
03fbfdb
Compare
926be47
to
8825f9c
Compare
8825f9c
to
3f160f4
Compare
SonarCloud Quality Gate failed. 0 Bugs 0.0% Coverage Catch issues before they fail your Quality Gate with our IDE extension SonarLint |
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.
Thank you for these improvements!
<dependency> | ||
<groupId>com.vitorsvieira</groupId> | ||
<artifactId>scala-iso_2.12</artifactId> | ||
<version>0.1.2</version> | ||
<scope>test</scope> | ||
</dependency> |
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.
This seems unmaintained since 2017.
Did you take a look at com.neovisionaries » nv-i18n with sources available under https://github.com/TakahikoKawasaki/nv-i18n ? This seems unmaintained since 2021 however as well, but seems way more popular/established and there seems to be some discussion on continuing maintenance.
This is really a pity, as this information changes so frequently. Shouldn't many people in the need for something like this? Why is there nothing good for this or what am I missing?
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.
Yes I know that is unmaintained and a scala library. But I found no better solution atm for the ISO 3166-2 Codes. nv-i18n does not support 3166-2 or? I could find anything there https://github.com/TakahikoKawasaki/nv-i18n/tree/master/src/main/java/com/neovisionaries/i18n
I already thought about creating an own, but that would be much more to do as I am willing to do atm.
So I thought it is a good compromise to use this lib, only in test, so replace it later.
@@ -230,7 +252,6 @@ country.description.in.jh = Jhārkhand | |||
country.description.in.jk = Jammu and Kashmīr | |||
country.description.in.ka = Karnātaka | |||
country.description.in.kl = Kerala | |||
country.description.in.la = Ladākh |
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.
Why did you remove this correct region code?
Having this would also be a requisite for #281 and I find it very confusing to have so many India subdivisions, but miss 2 of them. It is time intensive to find out, which one is missing.
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 because they were not used in the xml files? Maybe it was a mistake? same for *.tg
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.
We do not use these subdivision codes in the india holiday file, that is why I deleted it. We could add it again, but would not make any difference atm. I think if we want to support Ladākh
, we can do that in that pr.
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.
Yes, they are currently not used in the XML files, as the only special holidays for these regions are not yet supported, but all other holidays of India of course apply to them to.
e.g. Tasman (nz.tas
) has an empty holiday list as well, but is listed and e.g. Andorra (ad
) is also listed without having any reference in the XML files. I thought that it would be a good first step to complete the country list, that one knows what is there and what is missing and then complete the exact holidays afterwards, but that at least all regions can already be selected.
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.
hm I see what you mean. We can add them with an empty list, that is fine for me. We should create a small "guide" like "how we work" and list these decisions in the readme.
Did you try what is happening if you request the public holidays of in.la
? What does jollyday return?
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.
hm I see what you mean. We can add them with an empty list, that is fine for me. We should create a small "guide" like "how we work" and list these decisions in the readme.
Yes, that sound's like a good idea! :)
Did you try what is happening if you request the public holidays of
in.la
? What does jollyday return?
No, I didn't try it yet - I will once I find the time. Though, now that it is removed everywhere, it is probably not very interesting, as it will almost for sure bring up some error. The more interesting scenarios to me are for codes that are listed in the .properties
, but not the .xml
or vice versa.
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.
Did you try what is happening if you request the public holidays of in.la? What does jollyday return?
So: With the released version 0.22.0 I noticed the following:
When I try to get the Name of a subdivision that is not listed in the .xml
with holidayManager.getCalendarHierarchy().getChildren().get("<subdevision-code>").getDescription()
I receive the following error:
Exception in thread "main" java.lang.NullPointerException: Cannot invoke "de.focus_shift.jollyday.core.CalendarHierarchy.getDescription()" because the return value of "java.util.Map.get(Object)" is null
When I try to get the holidays of a subdivision that is not declared in the .xml
, it just outputs nothing. For both it thereby is not relevant, whether it is listed in the country_descriptions.properties
. I however believe, that the country codes should be a superset of the defined holiday regions, as it is just confusing otherwise and the .properties
file entries are relevant for localization and errors therein therefore more difficult to find.
I therefore come to the conclusion: every possible code should have a name in the country_descriptions.properties
already. Every subdivision without special holidays must be listed in the respective xml file with a designated, empty SubConfigurations
.
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.
see #430
@@ -243,7 +264,6 @@ country.description.in.pb = Punjab | |||
country.description.in.py = Puducherry | |||
country.description.in.rj = Rājasthān | |||
country.description.in.sk = Sikkim | |||
country.description.in.tg = Telangāna |
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.
Why did you remove this region code?
I find it very confusing to have so many India subdivisions, but miss 2 of them. It is time intensive to find out, which one is missing.
I just noticed however that on the 23rd of November the subdivision codes where now changed again and IN-OR is now IN-OD, IN-CT is IN-CG, IN-TG is IN-TS and IN-UT is IN-UK now. I will open a PR to fix this again as soon as possible.
See https://www.iso.org/obp/ui/#iso:code:3166:IN and https://en.wikipedia.org/wiki/ISO_3166-2:IN
closes #267
Todo: