-
Notifications
You must be signed in to change notification settings - Fork 469
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
Introduce subdivisions aliases #1662
Conversation
Aliases for subdivisions can be added in the `subdivisions_aliases` class attribute, a dictionary with the alias as key and the ISO3166-2 subdivision code as value. More than one alias can be added by adding more entries into the dictionary. The alias will be resolved only when populating the holidays for the subregion.
Adds a single character, a common abbreviation, the full German and English names as aliases for each state.
Adds the patron saint days (and one special other holiday) as bank holidays for each of the nine Austrian's subdivisions.
Thanks for the PR @sphh! As I mentioned earlier tests are very important in order to keep the library stable. |
Yes, I am with you. But as we have already started at the back (API has to be defined and tests should be written first), could you please tell me, if the API in added is something you can live with:
If that is ok with you and your ideas, I can do the tedious tasks of adding tests (if you don't want to do it) and updating the documentation (again if you as assumed native speaker are not better suited to do it). |
Yes, those 2 points sound good to me. Looking forward to reviewing the complete version of the code! Thank you for implementing this functionality! |
That's great. Thanks for confirming! I have another question, regarding the table in the section Available countries, which is down to personal liking: Where do you want to have the additional column with the subdivision aliases? Between the ‘Subdivisions’ and ‘Supported Languages’ columns or as last column. Personally I can see it in both places … |
This one needs more attention. I don't think we need to add a separate column for this. I expect the subdivisions aliases to be a very useful from UX perspective but not widely used feature. Maybe it'd be a good idea to keep it simple and add subdiv alias right to its ISO3166-2 value in brackets, e.g. |
Sounds like a sensible plan! |
…s in the README.rst.
- Reformating done by blake. - Type annotation complaints by mypy.
…ustrian holidays.
- Test subdivision aliases for default subdivision. - Adds bank holiday of default subdivision.
- In the README table aliases can be given after the sudivision in brackets.
The last commits update the README, adds or updates tests and adds one utility function. The tests flag up two problems:
I updated the test for subdivisions in table in the README, but there is no test to check, if the given aliases actually exist. Can I leave that to you? I frankly admit, that I am definitely not good at writing tests … |
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.
@sphh, this is an impressive contribution! Please look at some suggestions (Ukrainian translation mainly).
Co-authored-by: ~Jhellico <[email protected]>
Co-authored-by: ~Jhellico <[email protected]>
Co-authored-by: ~Jhellico <[email protected]>
Co-authored-by: ~Jhellico <[email protected]>
Co-authored-by: ~Jhellico <[email protected]>
Co-authored-by: ~Jhellico <[email protected]>
Co-authored-by: ~Jhellico <[email protected]>
No, cacert.org is just quoting an ÖNORM, which is the national equivalent to the ISO. As is DIN, ANSI, BS or any other national standard.
Yes, it is. But then they define it at the beginning and thus they can use whatever they like…
And here comes the ÖNORM in! I would say, the aliases should contain the full name, a one (or two-letter) designator without a period at the end and an abbreviation, hence
The English full name can be provided by the translation. |
You keep mentioning this as solution for the problem. Can I see a link to their standard regarding AT state names or whatever you use for your reasoning? I'm having a hard time to find examples of real use cases for the aliases we've been discussing for a while. Is there anything that can help answer, for example, this question: "why B / Bgld for Burgenland?"
I don't think we want to do the aliases localization. We have ISO subdivision codes for everyone. |
Yes, because the ÖNORM (or DIN or BS or ANSI) are the national versions of the ISO. I reference this, because in the beginning you insisted that everything has to be mentioned in standards. May I ask, why the national standards are not acceptable, but the international is?
If you want, you can buy their standards. Or you trust cacert.org to cite it correctly. Or see below. BTW have you tried to search for ‘AT-0’, the official ISO denomination? Did you get any results? I am still not sure, what you need, so that you can accept an alias? IMHO aliases are there to make life easier and there are many common aliases, which are in common use but not written down in laws or standards …
Here is my collection of supporting documents:
Would these documents alleviate your reservations?
I only mentioned this, because you mentioned the English and the local German versions in one go. Please do not combine these into one alias! |
- use confirmed subdivisoin aliases - update README - update l10n (comments and translation) - update snapshots - fix docs tests
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've updated this PR based on the information provided by @sphh. Thank you, that helped a lot with the subdiv aliases decision.
Let's work a bit more on this and get the change merged! I think we're very close. I'm a bit concerned with test_docs.py
tests complexity though -- it needs to be simplified later.
@sphh, @KJhellico please review this code once again when you have a chance.
Thanks! But why have the single letter aliases (B, K, N, O, S, St and V) been removed? I thought, it was decided, that they are ok …
Any reason why you don't take my approach with the single regexp? That makes the Python code simpler admittedly at the cost of a more complex regexp. Personally I find that approach easier to follow (especially if there is a comment, explaining what that regexp does). But I guess it is down to personal preferences (comments explaining the code always helps). |
I hadn't found any references to those aliases so I removed them from the initial version.
No, no reason. I picked up from the most recent code version. Feel free to change it back. Please also note I forgot to revert |
Would a copy of the official dictionary showing these abbreviations suffice? If yes, I'll create it.
I guess, you will find your commit, which changed it, faster than I do. Frankly, I already spent much too much time on all this for such a simple PR …
Very good, I noticed that (but has that been changed some time ago?) |
I created the list based on the materials you've provided as well as my own research results. Yes, the dictionary was one of the sources I used. My point is still the same -- if an alias is in a wide use in AT I'd like to have an evidence of that in any type of (semi-) official documents, gov sites, other sources. I have a broader question: why 2 aliases (full name + short name) isn't enough? Another question is that the list already contains two one-letter aliases -- how to deal with those cases? I'd like to have consistency at this level too. Ideally It'd be great to see a final state of the alias list from your perspective first.
The current code looks okay to me.
Not sure what you mean. I see that the current implementation differs from your original code. |
Because all aliases are in use: The full name (obviously), the abbreviations and the very short single letter abbreviation. For two subdivisions the abbreviation and the single letter are the same. That happens. You could also question, why NÖ and OÖ have all capital letters and the other abbreviations are upper- and lowercase. I am afraid, that's how living languages work (sadly no logic there at all …).
These are the aliases which were initially included in my pull request: If that's ok, I prepare the supporting document showing from the official dictionary showing the single (and that single twin) letter abbreviations. |
This is the supporting document for the single letter abbreviations: |
- update AT alias list - update HolidayBase::get_subdivision_aliases output - update README.rst
Thanks for compiling this! I ended up with the following with my own attempt to figure this out:
I still think 2 aliases would be sufficient for majority (maybe all) of cases. However, one of our lower priority goals is better user experience. So I believe this may be actually beneficial (according to at least one user from the target audience -- @sphh). I hope this is the final list of aliases everybody agrees on. I also updated PTAL! |
I am afraid, that is not my perception how they are used here in Austria. It might be confusing, that there are more than one abbreviations for one single state, but do not worry, all of these abbreviations are used in one way or the other in official and informal documents. Thanks for including them all! I really trust this is beneficial – at least for all Austrians.
I am more than happy with that list of aliases from the commit 6e85ec6 (Why wouldn't I, because these are exactly the aliases from my first commit…) Thanks. |
Not exactly the same but very close to it. Thanks for working with me on this @sphh 👍 @KJhellico could you review it when you get a chance? |
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.
LGTM! Just one suggestion, for l10n comments consistency.
Quality Gate failedFailed conditions |
Proposed change
Adds aliases for subdivision regions. Closes #1660
Type of change
Checklist
make pre-commit
, it didn't generate any changesmake test
, all tests passed locallyUpdating of the documentation and adding test cases still needs to be done. I just wanted to check, if you are happy with my implementation.