Wednesday Aug 13, 2008

One resource bundle per One Application - I18n and L10n will be easy

<script type="text/javascript"> var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www."); document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E")); </script> <script type="text/javascript"> var pageTracker = _gat._getTracker("UA-2367267-3"); pageTracker._trackPageview(); </script>

First what is with this some what mystry title.

In simple words , I would like to highlight advantage of keeping only one resource bundle( aka. one property file which contains all the localizable messages) per One Application.

Source of insipiration was Liferay.

Let me give you more idea of how it will look like.

1) Make sure all your translatable strings are put on one property file  ex. Language.properties

This will help to your customer who might want to add new langauge or want to add new strings to existing language or change strings to existing langauge. Easy to find where to do localization.

2) Organized it well . Define a rule to write key name.

ex. first_name=First Name

     account_number=Account Number

This will help to easily find of what this key represents in localized bundle.

3) Keep it in Alphabetical order

This will ensure that duplicate properties does not exists in your bundle.

4) Now you can keep common utility class which will load the bundle based on Locale user wanted

This will help all your other class as they do not need to bother about loading bundle. They can focus on solving business logic (that's where money comes from)

Last but not the least ... Innovation is mother of all invension ... so innovate whether it is necessasity or not :-) ...


About

Mahipalsinh Rana

Search

Categories
Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today