-
Notifications
You must be signed in to change notification settings - Fork 85
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
Creating Locale with specified Language script #250
Conversation
… language script into consideration
LocaleUtils from lang3 package support creation of locales with variants. |
Thanks for the reply. Looking at the source code of LocaleUtils, there seams to be no way to specify Script, although IETF BCP 47 standard https://tools.ietf.org/search/bcp47#section-2.1 , which Java documentation for Locale cites, specifies a way to denote a script within the language tag. |
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.
Works as described.
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.
It works as described. The name of the LocaleUtility might introduce confusion, because the Utils suffix is used for some Vitro utility classes. However, naming this class LocaleUtils might introduce importing classes issues, i.e. mixing the newly added class with org.apache.commons.lang3.LocaleUtils. Therefore, there is some sense in keeping this name. I approve this PR.
The base branch was changed.
* Creating a util function to convert Locale string to Locale, but take language script into consideration * emptz commit to trigger auto build
What does this pull request do?
Adds a LocaleUtility class which expands LocaleUtil from lang3 package. LocaleUtil does not support creation of Locales with script specified (Latin, Cyrillic, etc.). LocaleUtility checks if the string that represents locale contains script. If so, it creates Locale using Locale.Builder class, otherwise calls the LocaleUtil.toLocale() as it was done before.
What's new?
Now we can specify locales like sr_Latn_RS or sr_Cyrl_RS, which was not the case before.
How should this be tested?
Only way to see the difference is to have Locales of same languages but in different scripts.
Interested parties
@VIVO-project/vivo-committers