Java Doc for Resources.java in  » Internationalization-Localization » RBManager » com » ibm » rbm » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Internationalization Localization » RBManager » com.ibm.rbm 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   com.ibm.rbm.Resources

Resources
public class Resources (Code)
A class not to be instantiated. Provides methods for translating items from a resource bundle. To use this class make sure you first call initBundle(). Once this is done, calling any of the getTranslation() methods will return the appropriate String.
author:
   Jared Jackson
See Also:   com.ibm.rbm.RBManager




Method Summary
public static  String[]getAvailableLocales()
     Returns an array of strings containing the locale encoding (e.g.
public static  StringgetCountry(String encoding)
     Given a locale encoding, returns the country portion of that encoding.
For instance 'en_US', 'sp_US', both return 'US'
Returns null if no country is specified (e.g.
public static  StringgetLanguage(String encoding)
     Given a locale encoding, returns the language portion of that encoding.
public static  LocalegetLocale()
     Returns the currently set Locales object.
public static  StringgetTranslation(String key)
     Looks up a translation in the currently set Locale by the NLS lookup key provided.
public static  StringgetTranslation(String key, String lookup)
     Gets a translation given the currently set locale, a lookup key, and a single lookup item replacement.
public static  StringgetTranslation(String key, String[] lookup)
     Gets a translation given the currently set locale, a lookup key, and zero or more lookup item replacements. Lookup items are contextual translation material stored in the resource according to the format dictated in the java.text package.
public static  StringgetVariant(String encoding)
     Given a locale encoding, returns the variant portion of that encoding.
For instance 'en_GB_EURO', 'de_DE_EURO', both return 'EURO'
Returns null if no variant is specified (e.g.
public static  voidinitBundle()
     Initialize the properties of this resource bundle.
public static  voidsetLocale(Locale locale)
    



Method Detail
getAvailableLocales
public static String[] getAvailableLocales()(Code)
Returns an array of strings containing the locale encoding (e.g. 'en_US', 'de', etc.) of the locales defined in the current resource bundle. These are all of the locales for which unique translation of resource bundle items are possible. If a locale encoding is used to query on that is not in this array, the base class translation will be returned.



getCountry
public static String getCountry(String encoding)(Code)
Given a locale encoding, returns the country portion of that encoding.
For instance 'en_US', 'sp_US', both return 'US'
Returns null if no country is specified (e.g. 'en' or 'de')



getLanguage
public static String getLanguage(String encoding)(Code)
Given a locale encoding, returns the language portion of that encoding.
For instance 'en', 'en_US', 'en_GB', all return 'en'



getLocale
public static Locale getLocale()(Code)
Returns the currently set Locales object.



getTranslation
public static String getTranslation(String key)(Code)
Looks up a translation in the currently set Locale by the NLS lookup key provided. If no resource by that key is found, the key itself is returned.



getTranslation
public static String getTranslation(String key, String lookup)(Code)
Gets a translation given the currently set locale, a lookup key, and a single lookup item replacement. For an understanding of the lookup item replacement see getTranslation(String key, String[] lookup).



getTranslation
public static String getTranslation(String key, String[] lookup)(Code)
Gets a translation given the currently set locale, a lookup key, and zero or more lookup item replacements. Lookup items are contextual translation material stored in the resource according to the format dictated in the java.text package. In short, numbered markers are replaced by strings passed in as parameters.

For example, suppose you have the following resource:

myResource = Hello {1}, Isn't this a great {2}?

You want to replace the '{1}' witht the current user name and the '{2}' with the name of the day today. You can do this by calling:

String lookups[] = { "Joe", "Friday" };
Resources.getTranslation("myResource", lookups);

The result would be:

'Hello Joe, Isn't this a great Friday?'

This method (as well as the getTranslation(String key, String lookup) method) is useful for using nested lookups from the resource bundle. For instance, the above line could be replaced with:

String lookups[] = { getUserName(), Resources.getTranslation("Friday") };




getVariant
public static String getVariant(String encoding)(Code)
Given a locale encoding, returns the variant portion of that encoding.
For instance 'en_GB_EURO', 'de_DE_EURO', both return 'EURO'
Returns null if no variant is specified (e.g. 'en' or 'en_US')



initBundle
public static void initBundle()(Code)
Initialize the properties of this resource bundle. This method must be called once before any other method can be called (unless that method performs a check that calls this method). This is also the method to use in case the resource data on the data store has changed and those changes need to be reflected in future use of this class.



setLocale
public static void setLocale(Locale locale)(Code)
Set the locale to be used when making a query on the resource



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.