Dulitha, There is existing implementation to support i18n in Jaggery. Why don't you sync up with Jaggery team and improve/fix what's already there?
On Fri, Dec 19, 2014 at 7:11 AM, Dulitha Wijewantha <[email protected]> wrote: > > Hi guys, > I have been thinking about localization for bit and thought the > traditional localization method using .properties file and ResourceBundle > wouldn't be much of help considering the way we have components. There is > also a known set of disadvantages using ResourceBundles [1]. > > Use cases I see are below > 1) Localize the product based on a configuration > 2) Localize components based on user preference. > > Both these aspects depends on the component - for example API Store should > support a way for the user to view the store in different language. For IS > - it should send emails in the user's preferred language. For CDM - the > license for agents should be presented to the user on preferred language. > > So my proposal is to make a LocalizationManagerUtil using registry as the > persistence for the locale files. This Util class will have below 2 methods > > 1) getLocalizedFile(String fileName, Locale locale) > 2) getLocalizedString(String namespace, String key, Locale locale) > > getLocalizedFile() method will be used to load templates/files that a > specific to languages - examples would be terms and conditions, policies, > email templates etc. Behind the scene these will be stored in the registry > and served based on the localization requested. > > getLocalizedString() method will be used to load strings that are > presented to the users. This method takes a namespace so that we can > partition it based on a component/product. > > Also these methods will use the global locale in case the locale is not > sent to the method. Few questionable aspects I have are below > > - Errors - how to handle if a string for a locale is not found > - Loading/Reloading locals from files for the first to the registry > - Where in registry to store the files > - Performance and caching > > I started a POC level implementation on CDM core utils [2]. WDYT guys? > > [1] - http://www.javapractices.com/topic/TopicAction.do?Id=208 > [2] - https://gist.github.com/dulichan/ef99784e5a6e5332e5c1 > > Cheers~ > > -- > Dulitha Wijewantha (Chan) > Software Engineer - Mobile Development > WSO2 Inc > Lean.Enterprise.Mobileware > * ~Email [email protected] <[email protected]>* > * ~Mobile +94712112165 <%2B94712112165>* > * ~Website dulitha.me <http://dulitha.me>* > * ~Twitter @dulitharw <https://twitter.com/dulitharw>* > *~Github @dulichan <https://github.com/dulichan>* > *~SO @chan <http://stackoverflow.com/users/813471/chan>* > > _______________________________________________ > Architecture mailing list > [email protected] > https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture > > -- /sumedha m: +94 773017743 b : bit.ly/sumedha
_______________________________________________ Architecture mailing list [email protected] https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture
