Package com.dassault_systemes.catweb.tools.resource

   
Class Language

 
Class Hierarchy
java.lang.Object
  |
  +-com.dassault_systemes.catweb.tools.resource.Language
Class Location

Framework : PortalBase

Module : PLBtools

Class Description

public abstract class Language

Abstract Class for NLS widgets and messages management. This class need to be extended by the developers for their components. The Locale selected by the end user is automatically updated at the launch of the Portal.

Field Summary
protected String messagesFile
protected PropertyResourceBundle messagesRB
protected String widgetsFile
protected PropertyResourceBundle widgetsRB

Constructor Summary
Language(String _widgetsFile, String _messagesFile)
Constructor with the name of widget and message NLS files

Method Summary
public String _getMessagesString(String key)
Returns the translated nessage sepcified by its key in the current locale.
public String _getWidgetsString(String key)
Returns the translated widget name sepcified by its key in the current locale.
protected PropertyResourceBundle createResourceBundle(String baseFilename)
Creates and returns a PropertyResourceBundle object with a baseFileName using the Class to find a file named [baseFileName]_[2letter ISO639 code language].properties Example : widgets_en.properties
public static Locale getLocale()
Returns the current Locale used by the Portal
public static void registerLanguage(Language language)
Register all the languages so that we can change their locale if a locale modification occurs
public static void setLocale(Locale newLocale)
Sets the Locale used by the Portal


Field Detail

messagesFile

    protected String messagesFile


messagesRB

    protected PropertyResourceBundle messagesRB


widgetsFile

    protected String widgetsFile


widgetsRB

    protected PropertyResourceBundle widgetsRB


Constructor Detail

Language

    Language(String _widgetsFile, String _messagesFile)

Constructor with the name of widget and message NLS files


Method Detail

_getMessagesString

    public String _getMessagesString(String key)

Returns the translated nessage sepcified by its key in the current locale. If the key is not found in the messages file, the key value is returned.


_getWidgetsString

    public String _getWidgetsString(String key)

Returns the translated widget name sepcified by its key in the current locale. If the key is not found in the widgets file, the key value is returned.


createResourceBundle

    protected PropertyResourceBundle createResourceBundle(String baseFilename)

Creates and returns a PropertyResourceBundle object with a baseFileName using the Class to find a file named [baseFileName]_[2letter ISO639 code language].properties Example : widgets_en.properties

Return:
null if the file for the current locale is not found

getLocale

    public static Locale getLocale()

Returns the current Locale used by the Portal


registerLanguage

    public static void registerLanguage(Language language)

Register all the languages so that we can change their locale if a locale modification occurs


setLocale

    public static void setLocale(Locale newLocale)

Sets the Locale used by the Portal



Copyright © 2000, Dassault Systèmes. All rights reserved