org.overlord.sramp.ui.client.services.i18n
Class LocalizationService

java.lang.Object
  extended by org.overlord.sramp.ui.client.services.AbstractService
      extended by org.overlord.sramp.ui.client.services.i18n.LocalizationService
All Implemented Interfaces:
ILocalizationService, IService

public class LocalizationService
extends AbstractService
implements ILocalizationService

A concrete implementation of an ILocalizationService.

Author:
eric.wittmann@redhat.com

Constructor Summary
LocalizationService()
          Constructor.
 
Method Summary
 String formatDate(Date date)
          Called to format the given date.
 String formatDateTime(Date dateTime)
          Called to format the given date/time.
protected  void initDictionary(Map<String,String> messages)
          Initializes the localization dictionary.
 void start(ServiceLifecycleContext context, IServiceLifecycleListener serviceListener)
          Called to start the service.
 String translate(String key, Object... args)
          Called to translate a message using whatever the current locale might be.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LocalizationService

public LocalizationService()
Constructor.

Method Detail

start

public void start(ServiceLifecycleContext context,
                  IServiceLifecycleListener serviceListener)
Description copied from interface: IService
Called to start the service. The service *must* call the IServiceListener back when it is done starting. This provides the Service with an opportunity to do asynchronous start logic.

Specified by:
start in interface IService
Overrides:
start in class AbstractService
See Also:
AbstractService.start(org.overlord.sramp.ui.client.services.ServiceLifecycleContext, org.overlord.sramp.ui.client.services.IServiceLifecycleListener)

initDictionary

protected void initDictionary(Map<String,String> messages)
Initializes the localization dictionary.

Parameters:
messages -

translate

public String translate(String key,
                        Object... args)
Description copied from interface: ILocalizationService
Called to translate a message using whatever the current locale might be.

Specified by:
translate in interface ILocalizationService
Parameters:
key - the message key
Returns:
the translated message
See Also:
ILocalizationService.translate(java.lang.String, java.lang.Object[])

formatDate

public String formatDate(Date date)
Description copied from interface: ILocalizationService
Called to format the given date.

Specified by:
formatDate in interface ILocalizationService
See Also:
ILocalizationService.formatDate(java.util.Date)

formatDateTime

public String formatDateTime(Date dateTime)
Description copied from interface: ILocalizationService
Called to format the given date/time.

Specified by:
formatDateTime in interface ILocalizationService
See Also:
ILocalizationService.formatDateTime(java.util.Date)


Copyright © 2012-2013 JBoss, a division of Red Hat. All Rights Reserved.