Java Doc for Messages.java in  » J2EE » Expresso » com » jcorporate » expresso » core » i18n » 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 » J2EE » Expresso » com.jcorporate.expresso.core.i18n 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   com.jcorporate.expresso.core.i18n.Messages

Messages
public class Messages extends java.lang.Object (Code)
Messages.java The Messages object provides a way to gain access to the appropriate local-language version of a message, and to provide substitution of parameters in the message string if necessary. The appropriate local language is determined by means of the following:

Created on January 10, 2001, 8:35 AM
author:
   Michael Nash



Field Summary
final public static  StringLOCALE_KEY
    

Constructor Summary
public  Messages()
    

Method Summary
public static  voidestablishLocale(HttpServletRequest req)
     Figure out a Locale by reading the current request.
public static  LocalegetDefaultLocale()
    
public static  LocalegetLocale(HttpServletRequest req)
    
public static  StringgetString(String schemaClass, Locale l, String stringCode, Object[] args)
     The "full" form of getString must specify a schema, language and country.
public static  StringgetString(String stringCode)
    
public static  StringgetString(String stringCode, Object[] args)
     Convenience method that gets a string with arguments using the default schema (e.g.
public static  StringgetString(String schemaClass, String stringCode)
    
public static  StringgetString(Stack schemaStack, Locale ourLocale, String stringCode, Object[] args)
    
public static  StringgetString(String schemaClass, HttpServletRequest req, String stringCode, Object[] args)
    
public static  StringgetString(Locale l, String stringCode)
    
public static  StringgetString(Locale l, String stringCode, Object[] args)
    
public static  StringgetString(String schemaClass, Locale l, String stringCode)
    
public static  StringgetString(String schemaClass, String stringCode, Object[] args)
     If we have no information about what language we should be using, we use the defaults out of the properties file if present.
public static  StringgetString(HttpServletRequest req, String stringCode)
    
public static  StringgetString(HttpServletRequest req, String stringCode, String firstReplace)
    
public  StringgetString(HttpServletRequest req, String stringCode, String firstReplace, String secondReplace)
    
public  StringgetString(HttpServletRequest req, String stringCode, String firstReplace, String secondReplace, String thirdReplace)
    
public static  StringgetStringByPath(String bundlePath, String language, String country, String stringCode, Object[] args)
    
public static  StringgetStringForUser(int uid, String dbName, String schemaClass, String stringCode, Object[] args)
    
public static  StringgetStringRequired(String schemaClass, Locale l, String stringCode, Object[] args)
     Return a string out of our message bundle associated with the specified schemaClass, throwing an exception if it's not found
Parameters:
  schemaClass - the schema class
Parameters:
  l - the Locale
Parameters:
  stringCode - the string code
Parameters:
  args - any arguments.
public static  StringgetStringRequired(String schemaClass, String stringCode)
    
public static  StringgetStringRequired(Stack schemaStack, Locale ourLocale, String stringCode, Object[] args)
    
public static  StringgetStringUnrequired(Stack schemaStack, Locale ourLocale, String stringCode, Object[] args)
    
public static  voidsetDefaultSchema(String newDefault)
    

Field Detail
LOCALE_KEY
final public static String LOCALE_KEY(Code)




Constructor Detail
Messages
public Messages()(Code)
Creates new Class




Method Detail
establishLocale
public static void establishLocale(HttpServletRequest req) throws ServletException(Code)
Figure out a Locale by reading the current request. If there is a currently logged-in user, use that users UserPreference settings to determine the language. If there is no logged-in user, use the browser settings if available. If no user and no browser settings, use the context's default language. If there is no context default setting, use english. At the end of calling this method, the session will contain a locale object for this user, one way or another :-)



getDefaultLocale
public static Locale getDefaultLocale()(Code)
get default locale (much better to get it from user's request!!) locale based on 'default' config context
See Also:   Messages.getLocale(javax.servlet.http.HttpServletRequest)



getLocale
public static Locale getLocale(HttpServletRequest req) throws ServletException(Code)



getString
public static String getString(String schemaClass, Locale l, String stringCode, Object[] args)(Code)
The "full" form of getString must specify a schema, language and country. If we don't have one of these things, we use the convenience methods to determine them
Parameters:
  schemaClass - the schema class
Parameters:
  l - the Locale
Parameters:
  stringCode - the string code
Parameters:
  args - any arguments. translated string, or if not found, the stringCode



getString
public static String getString(String stringCode)(Code)
Convenience method to return a specified string from the default schema, with no arguments
Parameters:
  stringCode -



getString
public static String getString(String stringCode, Object[] args)(Code)
Convenience method that gets a string with arguments using the default schema (e.g. no specific schema specified) but with the specified arguments
Parameters:
  stringCode -
Parameters:
  args -



getString
public static String getString(String schemaClass, String stringCode)(Code)
get string translation
Parameters:
  schemaClass - name of schema
Parameters:
  stringCode - The string code to retrieve translated string, or if not found, the stringCode



getString
public static String getString(Stack schemaStack, Locale ourLocale, String stringCode, Object[] args)(Code)
Convenience method that gets a string using the schemaStack, looping through stack until the key is found
Parameters:
  schemaStack - A Stack of schemas
Parameters:
  ourLocale - The specified Locale Object
Parameters:
  stringCode - The string code to retrieve
Parameters:
  args - the formatting arguments for the String The properly formatted string as read from the messages bundle or the key if not found



getString
public static String getString(String schemaClass, HttpServletRequest req, String stringCode, Object[] args) throws ServletException(Code)
Convenience method to use the current default schema
Parameters:
  schemaClass -
Parameters:
  req -
Parameters:
  stringCode -
Parameters:
  args - translated string, or if not found, the stringCode



getString
public static String getString(Locale l, String stringCode)(Code)



getString
public static String getString(Locale l, String stringCode, Object[] args)(Code)



getString
public static String getString(String schemaClass, Locale l, String stringCode)(Code)
getString(schema, locale, stringCode) translated string, or if not found, the stringCode



getString
public static String getString(String schemaClass, String stringCode, Object[] args)(Code)
If we have no information about what language we should be using, we use the defaults out of the properties file if present. If there are no defaults in the property file, we use english
Parameters:
  schemaClass -
Parameters:
  stringCode -
Parameters:
  args - translated string, or if not found, the stringCode



getString
public static String getString(HttpServletRequest req, String stringCode) throws ServletException(Code)

Parameters:
  req -
Parameters:
  stringCode - translated string, or if not found, the stringCode



getString
public static String getString(HttpServletRequest req, String stringCode, String firstReplace) throws ServletException(Code)
Return a string out of our message bundle
Parameters:
  req -
Parameters:
  stringCode -
Parameters:
  firstReplace -



getString
public String getString(HttpServletRequest req, String stringCode, String firstReplace, String secondReplace) throws ServletException(Code)
Return a string out of our message bundle
Parameters:
  req -
Parameters:
  stringCode -
Parameters:
  firstReplace -
Parameters:
  secondReplace -



getString
public String getString(HttpServletRequest req, String stringCode, String firstReplace, String secondReplace, String thirdReplace) throws ServletException(Code)
Convenience method to return a string out of our message bundle, using the thres string arguments as the replacement arguments
Parameters:
  req -
Parameters:
  stringCode -
Parameters:
  firstReplace -
Parameters:
  secondReplace -
Parameters:
  thirdReplace -



getStringByPath
public static String getStringByPath(String bundlePath, String language, String country, String stringCode, Object[] args)(Code)
Variation on the above gets a string from a specified message bundle path
Parameters:
  bundlePath -
Parameters:
  language -
Parameters:
  country -
Parameters:
  stringCode -
Parameters:
  args -



getStringForUser
public static String getStringForUser(int uid, String dbName, String schemaClass, String stringCode, Object[] args)(Code)
use locale based on user ID, which is set as user preference; use with discrimination--it may be better to get locale from request
Parameters:
  uid -
Parameters:
  dbName -
Parameters:
  schemaClass -
Parameters:
  stringCode -
Parameters:
  args - translated string, or if not found, the stringCode
See Also:   Messages.getString(java.util.Locale,String)



getStringRequired
public static String getStringRequired(String schemaClass, Locale l, String stringCode, Object[] args) throws IllegalArgumentException(Code)
Return a string out of our message bundle associated with the specified schemaClass, throwing an exception if it's not found
Parameters:
  schemaClass - the schema class
Parameters:
  l - the Locale
Parameters:
  stringCode - the string code
Parameters:
  args - any arguments. java.lang.String
throws:
  IllegalArgumentException - if the given string code doesn't exist in the given bundle.



getStringRequired
public static String getStringRequired(String schemaClass, String stringCode)(Code)
Return a string out of our message bundle associated with the specified schemaClass, throwing an exception if it's not found
Parameters:
  schemaClass - the schema class
Parameters:
  stringCode - the string code java.lang.String
throws:
  IllegalArgumentException - if the given string code doesn't exist in the given bundle.



getStringRequired
public static String getStringRequired(Stack schemaStack, Locale ourLocale, String stringCode, Object[] args) throws IllegalArgumentException(Code)
Convenience method that gets a string using the schemaStack, looping through it until the key is found
Parameters:
  schemaStack - A Stack of schemas
Parameters:
  ourLocale - The specified Locale Object
Parameters:
  stringCode - The string code to retrieve
Parameters:
  args - the formatting arguments for the String The properly formatted string as read from the messages bundle or the key if not found
throws:
  IllegalArgumentException - if the given string code doesn't exist in any schema in stack.



getStringUnrequired
public static String getStringUnrequired(Stack schemaStack, Locale ourLocale, String stringCode, Object[] args) throws IllegalArgumentException(Code)
Convenience method that gets a string using the schemaStack, looping through it until the key is found
Parameters:
  schemaStack - A Stack of schemas
Parameters:
  ourLocale - The specified Locale Object
Parameters:
  stringCode - The string code to retrieve
Parameters:
  args - the formatting arguments for the String The properly formatted string as read from the messages bundle or the key if not found



setDefaultSchema
public static void setDefaultSchema(String newDefault)(Code)
Set the default schema to a class name of a Schema object
Parameters:
  newDefault -



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.