Package com.jk.core.locale
Class JKLocale
java.lang.Object
com.jk.core.locale.JKLocale
- All Implemented Interfaces:
Serializable
This class represents a locale (language and regional settings)
- Version:
- 1.0
- Author:
- Dr. Jalal H. Kiswani
- See Also:
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionJKLocale()
This method initiates a newJKLocale
This method constructs a newJKLocale
with the provides identifier, name and short name.JKLocale
(int id, String name, String shortName, JKLocaleDirection direction) This method constructs a newJKLocale
with the provides identifier, name and short name, direction. -
Method Summary
Modifier and TypeMethodDescriptionstatic JKLocale
This method gets the default locale.This method get the locale direction.int
getId()
This method gets the locale identifier (ID).getName()
This method gets the locale name.This method gets the locale short name.boolean
This method checks whether this locale direction is left-to-right or not.static void
setDefaultLocale
(JKLocale defaultLocale) This method sets this locale default locale.void
setDirection
(JKLocaleDirection direction) Sets the direction.void
setId
(int languageId) This method sets the locale identifier (ID) to the provided value.void
This method sets the locale name to the provided value.void
setShortName
(String shortName) This method sets the locale short name to the specified value.toString()
Returns a string representation of the object.static JKLocale
valueOf
(int languageId) This method return the locale that corresponds to the specified language identifier (ID).static JKLocale
This method returns the locale that corresponds to the specified language short name.
-
Field Details
-
ARABIC
Represents the Arabic locale. -
ENGLISH
Represents the English locale.
-
-
Constructor Details
-
JKLocale
public JKLocale()This method initiates a newJKLocale
-
JKLocale
This method constructs a newJKLocale
with the provides identifier, name and short name.This method sets the Left-to-Right direction to this locale by default.
- Parameters:
id
- Specifies the locale identifier (ID).name
- Specifies the locale name.shortName
- Specifies the locale short name, usually made up of two letters.
-
JKLocale
This method constructs a newJKLocale
with the provides identifier, name and short name, direction.- Parameters:
id
- Specifies the locale identifier (ID).name
- Specifies the locale name.shortName
- Specifies the locale short name, usually made up of two letters.direction
- Specifies the locale language reading direction.
-
-
Method Details
-
valueOf
This method return the locale that corresponds to the specified language identifier (ID).ID: 1 (represents Arabic Locale)
ID: 2 (represents English Locale)
- Parameters:
languageId
- Specifies the language locale identifier (ID).- Returns:
- the locale that is associated with the provided identifier (ID).
-
valueOf
This method returns the locale that corresponds to the specified language short name.Arabic: ar.
English: en.
- Parameters:
localeString
- Specifies the locale short name, usually made up of two letters.- Returns:
- the locale that is associated with the provided short name.
-
getId
public int getId()This method gets the locale identifier (ID).- Returns:
- the locale identifier (ID).
-
setId
public void setId(int languageId) This method sets the locale identifier (ID) to the provided value.- Parameters:
languageId
- Specifies the new locale identifier (ID).
-
getName
This method gets the locale name.- Returns:
- the locale name.
-
setName
This method sets the locale name to the provided value.- Parameters:
languageName
- Specifies the new locale name.
-
getShortName
This method gets the locale short name.- Returns:
- the locale short name, usually made up of two letters.
-
setShortName
This method sets the locale short name to the specified value.- Parameters:
shortName
- Specifies the new locale short name, usually made up of two letters.
-
toString
Returns a string representation of the object. -
setDirection
Sets the direction.- Parameters:
direction
- the new direction
-
getDirection
This method get the locale direction.- Returns:
- the locale direction.
-
isLeftToRight
public boolean isLeftToRight()This method checks whether this locale direction is left-to-right or not.- Returns:
- true, if locale direction is left-to=right, false otherwise.
-
getDefaultLocale
This method gets the default locale.- Returns:
- the default locale.
-
setDefaultLocale
This method sets this locale default locale.- Parameters:
defaultLocale
- Specifies the new default locale.
-