public class OwString extends Object
Utility class OwString used to localize strings.
Alfresco Workdesk
Copyright (c) Alfresco Software, Inc.
All rights reserved.
For licensing information read the license.txt file or
go to: http://wiki.alfresco.com
Modifier and Type | Field and Description |
---|---|
static String |
LABEL_PREFIX
prefix for labels
|
protected String |
m_strDefaultDisplayName
default displayname if key was not found
|
protected String |
m_strKeyName
key for localization
|
Constructor and Description |
---|
OwString(String strLabel_p)
construct a label (symbolic name or metadata) that can be localized later using getString(Locale locale_p)
|
OwString(String strKeyyName_p,
String strDefaultDisplayName_p)
construct a string that can be localized later using getString(Locale locale_p)
|
OwString(String strLabelOrKey_p,
String strDefaultDisplayName_p,
boolean fTreatAsLabel_p)
construct a string that can be localized later using getString(Locale locale_p)
|
Modifier and Type | Method and Description |
---|---|
String |
getDefaultDisplayName()
get the default displayname
|
String |
getKey()
get the key
|
String |
getString(Locale locale_p)
localize this String
|
static boolean |
hasLabel(Locale local_p,
String strLabel_p)
check if a label (symbolic name or metadata) is defined
|
static String |
localize(Locale local_p,
String strKey_p,
String strText_p)
localizes a string
|
static String |
localize1(Locale local_p,
String strKey_p,
String strText_p,
String strAttribute1_p)
localizes a string with additional parameter that is replaced with %1
|
static String |
localize2(Locale local_p,
String strKey_p,
String strText_p,
String strAttribute1_p,
String strAttribute2_p)
localizes a string with additional parameter that is replaced with %1
|
static String |
localize3(Locale local_p,
String strKey_p,
String strText_p,
String strAttribute1_p,
String strAttribute2_p,
String strAttribute3_p)
localizes a string with additional parameter that is replaced with %1
|
static String |
localizeLabel(Locale local_p,
String strLabel_p)
localizes a label (symbolic name or metadata)
|
static String |
localizeLabel(Locale local_p,
String strLabel_p,
String strDefault_p)
localizes a label (symbolic name or metadata)
|
static void |
putAll(Locale locale_p,
Map properties_p)
Adds the given key mapped localization properties to the current text mappings.
|
static void |
putLabel(Locale locale_p,
String key_p,
String label_p)
Adds the given key mapped label to the current text mappings.
|
static void |
replaceAll(StringBuffer strIn_p,
String strPattern_p,
String strReplacement_p)
replaces all occurrences of strPattern_p with strReplacement_p
|
static void |
replaceAll(StringBuilder strIn_p,
String pattern_p,
String replacement_p)
Replace all occurrences of the provided pattern with the replacement String.
|
static String |
replaceAll(String strIn_p,
String strPattern_p,
String strReplacement_p)
replaces all occurrences of strPattern_p with strReplaceMent_p
NOTE: This function might be replaced by String.replaceAll(...) function,
which is provided in JDK 1.4.
|
String |
toString() |
protected String m_strKeyName
protected String m_strDefaultDisplayName
public static final String LABEL_PREFIX
public OwString(String strKeyyName_p, String strDefaultDisplayName_p)
strKeyyName_p
- String unique localize key for display namestrDefaultDisplayName_p
- String default display namepublic OwString(String strLabelOrKey_p, String strDefaultDisplayName_p, boolean fTreatAsLabel_p)
strLabelOrKey_p
- String (like a symbolic name) or a unique keystrDefaultDisplayName_p
- String default display namefTreatAsLabel_p
- boolean true = strLabelOrKey_p is a label, false = strLabelOrKey_p is a unique keypublic OwString(String strLabel_p)
strLabel_p
- String label (like a symbolic name)public String getKey()
public String getDefaultDisplayName()
public String getString(Locale locale_p)
locale_p
- Locale to usepublic static void replaceAll(StringBuffer strIn_p, String strPattern_p, String strReplacement_p)
strIn_p
- StringBuffer to replacestrPattern_p
- String to look forstrReplacement_p
- replacement stringpublic static void replaceAll(StringBuilder strIn_p, String pattern_p, String replacement_p)
strIn_p
- StringBuilderpattern_p
- String pattern to replacereplacement_p
- String replacement for patternpublic static String replaceAll(String strIn_p, String strPattern_p, String strReplacement_p)
strIn_p
- String to replacestrPattern_p
- String to look forstrReplacement_p
- replacement stringpublic static String localizeLabel(Locale local_p, String strLabel_p)
local_p
- Locale to usestrLabel_p
- label that should be localizedpublic static boolean hasLabel(Locale local_p, String strLabel_p)
local_p
- Locale to usestrLabel_p
- label that should be localizedpublic static String localize(Locale local_p, String strKey_p, String strText_p)
local_p
- Locale to usestrKey_p
- Key value used to retrieve localized string from resourcestrText_p
- current language Textpublic static String localizeLabel(Locale local_p, String strLabel_p, String strDefault_p)
local_p
- Locale to usestrLabel_p
- label that should be localizedstrDefault_p
- default if label does not existpublic static String localize1(Locale local_p, String strKey_p, String strText_p, String strAttribute1_p)
local_p
- Locale to usestrKey_p
- Key value used to retrieve localized string from resourcestrText_p
- current language TextstrAttribute1_p
- String that replaces %1 tokenspublic static String localize2(Locale local_p, String strKey_p, String strText_p, String strAttribute1_p, String strAttribute2_p)
local_p
- Locale to usestrKey_p
- Key value used to retrieve localized string from resourcestrText_p
- current language TextstrAttribute1_p
- String that replaces %1 tokensstrAttribute2_p
- String that replaces %2 tokenspublic static String localize3(Locale local_p, String strKey_p, String strText_p, String strAttribute1_p, String strAttribute2_p, String strAttribute3_p)
local_p
- Locale to usestrKey_p
- Key value used to retrieve localized string from resourcestrText_p
- current language TextstrAttribute1_p
- String that replaces %1 tokensstrAttribute2_p
- String that replaces %2 tokensstrAttribute3_p
- String that replaces %3 tokenspublic static void putAll(Locale locale_p, Map properties_p) throws Exception
locale_p
- properties_p
- Exception
Copyright © 2014 Alfresco Business Solutions. All Rights Reserved.