Closed kipcole9 closed 3 years ago
Thanks @kipcole9, this looks great!
When translating a territory name a style parameter is required in this code. It defaults to :standard. Some tests make other assumptions
I think, it's fine to just change/remove tests that assumes the wrong behavior.
This PR returns an error when translating a subdivision that has no translation. The current tests assume that {:ok, nil} is returned. I changed the behaviour to match translate_territory/4`
Yeah, it make sense to keep the same behavior, I'm just wondering if it could be improved with a better error message. With that and the fallback chain in mind, I suspect your intention is to only return an error message, if we can't resolve the translation right?
If you don't mind then I can push a commit that fixes the tests and merge this in.
Let me know what you think.
I think, it's fine to just change/remove tests that assumes the wrong behavior.
Happy to do so if thats ok with you.
I suspect your intention is to only return an error message, if we can't resolve the translation right?
Yes, that was my thinking. I think thats consistent with the other functions in the library unless I missed something.
Have updated and pushed so I think good for a merge if you're ok with it (CI is processing). Will look at fallback processing as the next step after this part is good to go.
style
parameter and to reuse already generated backend data including newinverted_territories/1
mappings.inverted_territories/1
mappings.Cldr.Territory.normalize_name/1
.There are 9 tests that do not pass and they fit into the following categories:
When translating a territory name a style parameter is required in this code. It defaults to
:standard
. Some tests make other assumptions.This PR returns an error when translating a subdivision that has no translation. The current tests assume that
{:ok, nil}
is returned. I changed the behaviour to match translate_territory/4`.The code does not at this time use the locale fallback chain when a locale doesn't have territory or division data. This will be added in a separate PR.
CLDR data, but design, doesn't duplicate data when its the same across locale inheritance hence for this data, using the fallback chain is required.