Java Doc for TurbineLocalizationService.java in  » Web-Framework » TURBINE » org » apache » turbine » services » localization » 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 » Web Framework » TURBINE » org.apache.turbine.services.localization 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


org.apache.turbine.services.TurbineBaseService
   org.apache.turbine.services.localization.TurbineLocalizationService

TurbineLocalizationService
public class TurbineLocalizationService extends TurbineBaseService implements LocalizationService(Code)

This class is the single point of access to all localization resources. It caches different ResourceBundles for different Locales.

Usage example:

 LocalizationService ls = (LocalizationService) TurbineServices
 .getInstance().getService(LocalizationService.SERVICE_NAME);
 

Then call one of four methods to retrieve a ResourceBundle:

  • getBundle("MyBundleName")
  • getBundle("MyBundleName", httpAcceptLanguageHeader)
  • etBundle("MyBundleName", HttpServletRequest)
  • getBundle("MyBundleName", Locale)
  • etc.


author:
   Jonas Maurus
author:
   Jon S. Stevens
author:
   Frank Y. Kim
author:
   Daniel Rall
author:
   Leonard Richardson
author:
   Henning P. Schmiedehausen
version:
   $Id: TurbineLocalizationService.java 534527 2007-05-02 16:10:59Z tv $



Constructor Summary
public  TurbineLocalizationService()
     Constructor.

Method Summary
public  Stringformat(String bundleName, Locale locale, String key, Object arg1)
     Formats a localized value using the provided object.
Parameters:
  bundleName - The bundle in which to look for the localizable text.
Parameters:
  locale - The locale for which to format the text.
Parameters:
  key - The identifier for the localized text to retrieve,
Parameters:
  arg1 - The object to use as {0} when formatting the localized text.
public  Stringformat(String bundleName, Locale locale, String key, Object arg1, Object arg2)
     Formats a localized value using the provided objects.
Parameters:
  bundleName - The bundle in which to look for the localizable text.
Parameters:
  locale - The locale for which to format the text.
Parameters:
  key - The identifier for the localized text to retrieve,
Parameters:
  arg1 - The object to use as {0} when formatting the localized text.
Parameters:
  arg2 - The object to use as {1} when formatting the localized text.
public  Stringformat(String bundleName, Locale locale, String key, Object[] args)
     Looks up the value for key in the ResourceBundle referenced by bundleName, then formats that value for the specified Locale using args.
Parameters:
  bundleName - The bundle in which to look for the localizable text.
Parameters:
  locale - The locale for which to format the text.
Parameters:
  key - The identifier for the localized text to retrieve,
Parameters:
  args - The objects to use when formatting the localized text.
public  ResourceBundlegetBundle()
     This method returns a ResourceBundle given the bundle name "DEFAULT" and the default Locale information supplied in TurbineProperties.
public  ResourceBundlegetBundle(String bundleName)
     This method returns a ResourceBundle given the bundle name and the default Locale information supplied in TurbineProperties.
Parameters:
  bundleName - Name of bundle.
public  ResourceBundlegetBundle(String bundleName, String languageHeader)
     This method returns a ResourceBundle given the bundle name and the Locale information supplied in the HTTP "Accept-Language" header.
Parameters:
  bundleName - Name of bundle.
Parameters:
  languageHeader - A String with the language header.
public  ResourceBundlegetBundle(HttpServletRequest req)
     This method returns a ResourceBundle given the Locale information supplied in the HTTP "Accept-Language" header which is stored in HttpServletRequest.
Parameters:
  req - HttpServletRequest.
public  ResourceBundlegetBundle(String bundleName, HttpServletRequest req)
     This method returns a ResourceBundle given the bundle name and the Locale information supplied in the HTTP "Accept-Language" header which is stored in HttpServletRequest.
Parameters:
  bundleName - Name of the bundle to use if the request'slocale cannot be resolved.
Parameters:
  req - HttpServletRequest.
public  ResourceBundlegetBundle(RunData data)
     This method returns a ResourceBundle given the Locale information supplied in the HTTP "Accept-Language" header which is stored in RunData.
Parameters:
  data - Turbine information.
public  ResourceBundlegetBundle(String bundleName, RunData data)
     This method returns a ResourceBundle given the bundle name and the Locale information supplied in the HTTP "Accept-Language" header which is stored in RunData.
Parameters:
  bundleName - Name of bundle.
Parameters:
  data - Turbine information.
public  ResourceBundlegetBundle(String bundleName, Locale locale)
     This method returns a ResourceBundle for the given bundle name and the given Locale.
Parameters:
  bundleName - Name of bundle (or null for thedefault bundle).
Parameters:
  locale - The locale (or null for the localeindicated by the default language and country).
public  String[]getBundleNames()
    
public  StringgetDefaultBundleName()
     Retrieves the name of the default bundle (as specified in the config file).
public  StringgetDefaultCountry()
     Retrieves the default country (specified in the config file).
public  StringgetDefaultLanguage()
     Retrieves the default language (specified in the config file).
final public  LocalegetLocale(HttpServletRequest req)
    
public  LocalegetLocale(String header)
    
public  StringgetString(String bundleName, Locale locale, String key)
    
final protected  StringgetStringOrNull(ResourceBundle rb, String key)
     Gets localized text from a bundle if it's there.
public  voidinit()
     Called the first time the Service is used.
protected  voidinitBundleNames(String[] ignored)
     Initialize list of default bundle names.
public  voidsetBundle(String defaultBundle)
     This method sets the name of the first bundle in the search list (the "default" bundle).


Constructor Detail
TurbineLocalizationService
public TurbineLocalizationService()(Code)
Constructor.




Method Detail
format
public String format(String bundleName, Locale locale, String key, Object arg1)(Code)
Formats a localized value using the provided object.
Parameters:
  bundleName - The bundle in which to look for the localizable text.
Parameters:
  locale - The locale for which to format the text.
Parameters:
  key - The identifier for the localized text to retrieve,
Parameters:
  arg1 - The object to use as {0} when formatting the localized text. Formatted localized text.
See Also:   TurbineLocalizationService.format(String,Locale,String,Object[])



format
public String format(String bundleName, Locale locale, String key, Object arg1, Object arg2)(Code)
Formats a localized value using the provided objects.
Parameters:
  bundleName - The bundle in which to look for the localizable text.
Parameters:
  locale - The locale for which to format the text.
Parameters:
  key - The identifier for the localized text to retrieve,
Parameters:
  arg1 - The object to use as {0} when formatting the localized text.
Parameters:
  arg2 - The object to use as {1} when formatting the localized text. Formatted localized text.
See Also:   TurbineLocalizationService.format(String,Locale,String,Object[])



format
public String format(String bundleName, Locale locale, String key, Object[] args)(Code)
Looks up the value for key in the ResourceBundle referenced by bundleName, then formats that value for the specified Locale using args.
Parameters:
  bundleName - The bundle in which to look for the localizable text.
Parameters:
  locale - The locale for which to format the text.
Parameters:
  key - The identifier for the localized text to retrieve,
Parameters:
  args - The objects to use when formatting the localized text. Localized, formatted text identified bykey.



getBundle
public ResourceBundle getBundle()(Code)
This method returns a ResourceBundle given the bundle name "DEFAULT" and the default Locale information supplied in TurbineProperties. A localized ResourceBundle.



getBundle
public ResourceBundle getBundle(String bundleName)(Code)
This method returns a ResourceBundle given the bundle name and the default Locale information supplied in TurbineProperties.
Parameters:
  bundleName - Name of bundle. A localized ResourceBundle.



getBundle
public ResourceBundle getBundle(String bundleName, String languageHeader)(Code)
This method returns a ResourceBundle given the bundle name and the Locale information supplied in the HTTP "Accept-Language" header.
Parameters:
  bundleName - Name of bundle.
Parameters:
  languageHeader - A String with the language header. A localized ResourceBundle.



getBundle
public ResourceBundle getBundle(HttpServletRequest req)(Code)
This method returns a ResourceBundle given the Locale information supplied in the HTTP "Accept-Language" header which is stored in HttpServletRequest.
Parameters:
  req - HttpServletRequest. A localized ResourceBundle.



getBundle
public ResourceBundle getBundle(String bundleName, HttpServletRequest req)(Code)
This method returns a ResourceBundle given the bundle name and the Locale information supplied in the HTTP "Accept-Language" header which is stored in HttpServletRequest.
Parameters:
  bundleName - Name of the bundle to use if the request'slocale cannot be resolved.
Parameters:
  req - HttpServletRequest. A localized ResourceBundle.



getBundle
public ResourceBundle getBundle(RunData data)(Code)
This method returns a ResourceBundle given the Locale information supplied in the HTTP "Accept-Language" header which is stored in RunData.
Parameters:
  data - Turbine information. A localized ResourceBundle.



getBundle
public ResourceBundle getBundle(String bundleName, RunData data)(Code)
This method returns a ResourceBundle given the bundle name and the Locale information supplied in the HTTP "Accept-Language" header which is stored in RunData.
Parameters:
  bundleName - Name of bundle.
Parameters:
  data - Turbine information. A localized ResourceBundle.



getBundle
public ResourceBundle getBundle(String bundleName, Locale locale)(Code)
This method returns a ResourceBundle for the given bundle name and the given Locale.
Parameters:
  bundleName - Name of bundle (or null for thedefault bundle).
Parameters:
  locale - The locale (or null for the localeindicated by the default language and country). A localized ResourceBundle.



getBundleNames
public String[] getBundleNames()(Code)

See Also:   org.apache.turbine.services.localization.LocalizationService.getBundleNames



getDefaultBundleName
public String getDefaultBundleName()(Code)
Retrieves the name of the default bundle (as specified in the config file).
See Also:   org.apache.turbine.services.localization.LocalizationService.getDefaultBundleName



getDefaultCountry
public String getDefaultCountry()(Code)
Retrieves the default country (specified in the config file).



getDefaultLanguage
public String getDefaultLanguage()(Code)
Retrieves the default language (specified in the config file).



getLocale
final public Locale getLocale(HttpServletRequest req)(Code)

See Also:   org.apache.turbine.services.localization.LocalizationService.getLocale(HttpServletRequest)



getLocale
public Locale getLocale(String header)(Code)

See Also:   org.apache.turbine.services.localization.LocalizationService.getLocale(String)



getString
public String getString(String bundleName, Locale locale, String key)(Code)

exception:
  MissingResourceException - Specified key cannot be matched.
See Also:   org.apache.turbine.services.localization.LocalizationService.getString(StringLocaleString)



getStringOrNull
final protected String getStringOrNull(ResourceBundle rb, String key)(Code)
Gets localized text from a bundle if it's there. Otherwise, returns null (ignoring a possible MissingResourceException).



init
public void init() throws InitializationException(Code)
Called the first time the Service is used.



initBundleNames
protected void initBundleNames(String[] ignored)(Code)
Initialize list of default bundle names.
Parameters:
  ignored - Ignored.



setBundle
public void setBundle(String defaultBundle)(Code)
This method sets the name of the first bundle in the search list (the "default" bundle).
Parameters:
  defaultBundle - Name of default bundle.



Methods inherited from org.apache.turbine.services.TurbineBaseService
public void init(Object data) throws InitializationException(Code)(Java Doc)
public void init(ServletConfig config) throws InitializationException(Code)(Java Doc)
public void init(RunData data) throws InitializationException(Code)(Java Doc)
public void init() throws InitializationException(Code)(Java Doc)
public void shutdown()(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.