org.opcfoundation.ua.builtintypes
Class LocalizedText

java.lang.Object
  extended by org.opcfoundation.ua.builtintypes.LocalizedText

public final class LocalizedText
extends Object

This primitive DataType is specified as a string that is composed of a language component and a country/region component as specified by RFC 3066. The <country/region> component is always preceded by a hyphen. The format of the LocaleId string is shown below: <language>[-<country/region>], where <language> is the two letter ISO 639 code for a language, <country/region> is the two letter ISO 3166 code for the country/region. The rules for constructing LocaleIds defined by RFC 3066 are restricted for OPC UA as follows: d) OPC UA permits only zero or one <country/region> component to follow the <language> component, e) OPC UA also permits the "-CHS" and "-CHT" three-letter <country/region> codes for "Simplified" and "Traditional" Chinese locales. f) OPC UA also allows the use of other <country/region> codes as deemed necessary by the client or the server. Example: English en English (US) en-US German de German (Germany) de-DE German (Austrian) de-AT See Country Codes http://www.iso.org/iso/english_country_names_and_code_elements See Language Codes http://www.loc.gov/standards/iso639-2/php/English_list.php

Author:
Toni Kalajainen (toni.kalajainen@vtt.fi)
See Also:
http://www.ietf.org/rfc/rfc3066.txt, Locale

Field Summary
static LocalizedText EMPTY
           
static LocalizedText EMPTY_EN
           
static NodeId ID
           
static Pattern LOCALE_PATTERN
          The pattern of the locale part
static Locale NO_LOCALE
           
static LocalizedText NULL
           
static Locale NULL_LOCALE
           
 
Constructor Summary
LocalizedText(String text)
          Create new Localized Text with locale NO_LOCALE
LocalizedText(String text, Locale locale)
          Create new localized text
LocalizedText(String text, String localeId)
          Create new Localized Text
 
Method Summary
static LocalizedText english(String text)
          Create a english text
 boolean equals(Object obj)
           
 Locale getLocale()
          Get locale object
 String getLocaleId()
          Get the whole locale string
 String getText()
           
 int hashCode()
           
static Locale toLocale(String localeId)
          Convert UA LocateId to Locale
static String toLocaleId(Locale locale)
          Convert Locale to UA LocaleId String
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

LOCALE_PATTERN

public static final Pattern LOCALE_PATTERN
The pattern of the locale part


NO_LOCALE

public static final Locale NO_LOCALE

NULL_LOCALE

public static final Locale NULL_LOCALE

ID

public static final NodeId ID

NULL

public static final LocalizedText NULL

EMPTY

public static final LocalizedText EMPTY

EMPTY_EN

public static final LocalizedText EMPTY_EN
Constructor Detail

LocalizedText

public LocalizedText(String text,
                     String localeId)
Create new Localized Text

Parameters:
text - Localized text or null
localeId - <language>[-<country/region>] or null

LocalizedText

public LocalizedText(String text)
Create new Localized Text with locale NO_LOCALE

Parameters:
text - the text

LocalizedText

public LocalizedText(String text,
                     Locale locale)
Create new localized text

Parameters:
text - or null
locale - locale or null
Method Detail

toLocale

public static Locale toLocale(String localeId)
Convert UA LocateId to Locale

Parameters:
localeId - or null
Returns:
locale or null

toLocaleId

public static String toLocaleId(Locale locale)
Convert Locale to UA LocaleId String

Parameters:
locale - locale or null
Returns:
LocaleId or null

english

public static LocalizedText english(String text)
Create a english text

Parameters:
text - string
Returns:
english text

hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

getLocaleId

public String getLocaleId()
Get the whole locale string

Returns:
LocaleId

getLocale

public Locale getLocale()
Get locale object

Returns:
locale or null

getText

public String getText()

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2018. All rights reserved.