[ https://issues.apache.org/jira/browse/OFBIZ-9488?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16207531#comment-16207531 ]
Pradhan Yash Sharma commented on OFBIZ-9488: -------------------------------------------- Hello Jacques, The Java Programming language contains internationalization support for language tags, language tag filtering, and language tag lookup. These features are specified by IETF BCP 47. A builder is used to build instances of Locale from values configured by the setters. Unlike the Locale constructors, the Builder checks if a value configured by a setter satisfies the syntax requirements defined by the Locale class. A Locale object created by a Builder is well-formed and can be transformed to a well-formed IETF BCP 47 language tag without losing information. Please refer this link for more detail https://docs.oracle.com/javase/7/docs/api/java/util/Locale.Builder.html. I've also created a sub ticket for implementing the same. Thanks for raising this concern it will help others also. > Usage of factory method or Builder pattern for Locale object creation and > usage. > -------------------------------------------------------------------------------- > > Key: OFBIZ-9488 > URL: https://issues.apache.org/jira/browse/OFBIZ-9488 > Project: OFBiz > Issue Type: Improvement > Components: framework > Affects Versions: 16.11.03 > Reporter: Pradhan Yash Sharma > Assignee: Deepak Dixit > Priority: Minor > Fix For: Upcoming Release > > Attachments: OFBIZ-9488.patch, OFBIZ-9488.patch > > > Usage of factory method or Builder pattern for Locale object creation and > usage. > Locale aLocale = Locale.forLanguageTag("en-US"); > Locale bLocale = new > Locale.Builder().setLanguage("en").setRegion("US").build(); > https://docs.oracle.com/javase/tutorial/i18n/locale/index.html > There are many instances on which new Locale() is used instead of this we can > use UtilMisc.ensureLocale() -- This message was sent by Atlassian JIRA (v6.4.14#64029)