Spiffy UI Framework

org.spiffyui.server
Class JSLocaleUtil

java.lang.Object
  extended by org.spiffyui.server.JSLocaleUtil

public final class JSLocaleUtil
extends java.lang.Object

The JSLocaleUtil can handle finding the right filename of a JavaScript library for a given locale.


Method Summary
static java.lang.String getFile(java.lang.String resourceName, java.util.Locale locale, ServletContext context)
          Get the right file name for the specified resource name and the locale (which was already determined to be the best match locale).
static java.lang.String getFile(java.lang.String resourceName, java.util.Locale locale, ServletContext context, java.lang.String resourcePath)
          Get the right file name for the specified resource name and the locale (which was already determined to be the best match locale).
static java.util.List<java.util.Locale> getMinimumSupportedLocales(ServletContext context)
          Get the list of minimum supported locales.
static java.util.List<java.util.Locale> getMinimumSupportedLocales(ServletContext context, java.lang.String resourcePath)
          Get the list of minimum supported locales.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getFile

public static java.lang.String getFile(java.lang.String resourceName,
                                       java.util.Locale locale,
                                       ServletContext context)
                                throws ServletException
Get the right file name for the specified resource name and the locale (which was already determined to be the best match locale).

Parameters:
resourceName - The resource name. If your looking for a file like date-en-US.js the the resource name is date
locale - The locale of the requested file
context - the servlet context
Returns:
the file name
Throws:
ServletException - if there is an error accessing the servlet context

getFile

public static java.lang.String getFile(java.lang.String resourceName,
                                       java.util.Locale locale,
                                       ServletContext context,
                                       java.lang.String resourcePath)
                                throws ServletException
Get the right file name for the specified resource name and the locale (which was already determined to be the best match locale).

Parameters:
resourceName - The resource name. If your looking for a file like date-en-US.js the the resource name is date
locale - The locale of the requested file
context - the servlet context
resourcePath - the path in the WAR to look for the JavaScript localization files
Returns:
the file name
Throws:
ServletException - if there is an error accessing the servlet context

getMinimumSupportedLocales

public static java.util.List<java.util.Locale> getMinimumSupportedLocales(ServletContext context)
Get the list of minimum supported locales. This list is the smallest number of locales supported by one of the JavaScript files is the js/lib/i18n directory.

Parameters:
context - the servlet context for loading the available locales
Returns:
The minimum list of supported locales

getMinimumSupportedLocales

public static java.util.List<java.util.Locale> getMinimumSupportedLocales(ServletContext context,
                                                                          java.lang.String resourcePath)
Get the list of minimum supported locales. This list is the smallest number of locales supported by one of the JavaScript files is the js/lib/i18n directory.

Parameters:
context - the servlet context for loading the available locales
resourcePath - the path in the WAR to look for the JavaScript localization files
Returns:
The minimum list of supported locales

Spiffy UI Framework