nemahaja commented on code in PR #17:
URL:
https://github.com/apache/sling-org-apache-sling-i18n/pull/17#discussion_r1808327765
##########
src/main/java/org/apache/sling/i18n/impl/JcrResourceBundleProvider.java:
##########
@@ -566,14 +573,36 @@ private JcrResourceBundle createResourceBundle(
* </ol>
*/
private Locale getParentLocale(Locale locale) {
- if (locale.getVariant().length() != 0) {
+ if (locale.getScript().length() != 0 && locale.getVariant().length()
!= 0) {
+ try {
+ return new Locale.Builder()
+ .setLanguage(locale.getLanguage())
+ .setRegion(locale.getCountry())
+ .setScript(locale.getScript())
+ .build();
+ } catch (IllformedLocaleException e) {
+ // fallback to previous implementation
Review Comment:
Indeed, the likelihood of this occurrence is quite low. Nevertheless, I have
implemented exception handling to account for any potential permutations or
combinations related to the locale. Additionally, I have updated the comment as
suggested.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]