:: com :: sun :: star :: i18n ::

interface XTransliteration
Base Hierarchy
::com::sun::star::uno::XInterface
 |
 +-XTransliteration
Description
Character conversions like case folding or Hiragana to Katakana.

Transliteration is a character to character conversion but it is not always a one to one mapping between characters. Transliteration modules are primarily used by collation, and search and replace modules to perform approximate search. It can also be used to format the numbers in different numbering systems.

In order to select transliteration modules for different purposes, they are classified with attributes of TransliterationType .

For Western languages there would be three transliteration modules available to compare two mixed case strings: upper to lower, lower to upper, and ignore case.

A typical calling sequence of transliteration is

  1. getAvailableModules()
  2. loadModulesByImplNames()
  3. equals()
or another one is
  1. loadModule()
  2. transliterate()


Methods' Summary
getName Unique ASCII name to identify a module. This name is used to get its localized name for menus, dialogs etc. The behavior is undefined for TransliterationType::CASCADE modules.
getType Return the attribute(s) associated with this transliterator object, as defined in TransliterationType . The value is determined by the transliteration modules. For example, for UPPERCASE_LOWERCASE, a ONE_TO_ONE is returned, for IGNORE_CASE, IGNORE is returned.
loadModule Load instance of predefined module - old style method.
loadModuleNew Load a sequence of instances of predefined modules - supersedes method XTransliteration::loadModule() .
loadModuleByImplName Load instance of UNO registered module.
loadModulesByImplNames Load a sequence of instances of transliteration modules. Output of one module is feeded as input to the next module in the sequence. The object created by this call has TransliterationType CASCADE and IGNORE types.
getAvailableModules List the available transliteration modules for a given locale. It can be filtered based on its type.
transliterate Transliterate a substring. This method can be called if the object doesn't have TransliterationType IGNORE attribute.
folding [ DEPRECATED ]
equals Match two substrings and find if they are equivalent as per this transliteration.
transliterateRange Transliterate one set of characters to another.
compareSubstring Compare 2 substrings.
compareString Compare 2 strings.
Methods' Details
getName
string
getName();
 
 

Description
Unique ASCII name to identify a module. This name is used to get its localized name for menus, dialogs etc. The behavior is undefined for TransliterationType::CASCADE modules.
getType
short
getType();
 
 

Description
Return the attribute(s) associated with this transliterator object, as defined in TransliterationType . The value is determined by the transliteration modules. For example, for UPPERCASE_LOWERCASE, a ONE_TO_ONE is returned, for IGNORE_CASE, IGNORE is returned.
loadModule
void
loadModule(
 
[in] TransliterationModules
[in] ::com::sun::star::lang::Locale
 
eModType,
aLocale );

Description
Load instance of predefined module - old style method.
loadModuleNew
void
loadModuleNew(
 
[in] sequence< TransliterationModulesNew >
[in] ::com::sun::star::lang::Locale
 
aModType,
aLocale );

Description
Load a sequence of instances of predefined modules - supersedes method XTransliteration::loadModule() .
loadModuleByImplName
void
loadModuleByImplName(
 
[in] string
[in] ::com::sun::star::lang::Locale
 
aImplName,
aLocale );

Description
Load instance of UNO registered module.

Each transliteration module is registered under a different service name. The convention for the service name is com.sun.star.i18n.Transliteration.l10n.{implName}. The {implName} is a unique name used to identify a module. The implName is used to get a localized name for the transliteration module. The implName is used in locale data to list the available transliteration modules for the locale. There are some transliteration modules that are always available. The names of those modules are listed as enum TransliterationModules names. For modules not listed there it is possible to load them directly by their implName.

Parameter aImplName
The module's {implName} under which it is registered with com.sun.star.i18n.Transliteration.l10n.{implName}.
loadModulesByImplNames
void
loadModulesByImplNames(
 
[in] sequence< string >
[in] ::com::sun::star::lang::Locale
 
aImplNameList,
aLocale );

Description
Load a sequence of instances of transliteration modules. Output of one module is feeded as input to the next module in the sequence. The object created by this call has TransliterationType CASCADE and IGNORE types.
Parameter aImplNameList
Only IGNORE type modules can be specified.
getAvailableModules
sequence< string >
getAvailableModules(
 
[in] ::com::sun::star::lang::Locale
[in] short
 
aLocale,
nType );

Description
List the available transliteration modules for a given locale. It can be filtered based on its type.
Parameter nType
A bitmask field of values defined in TransliterationType
transliterate
string
transliterate(
 
[in] string
[in] long
[in] long
[out] sequence< long >
 
aInStr,
nStartPos,
nCount,
rOffset );

Description
Transliterate a substring. This method can be called if the object doesn't have TransliterationType IGNORE attribute.
Parameter aStr
The input string.
Parameter nStartPos
Start position within aStr from where transliteration starts.
Parameter nCount
Number of codepoints to be transliterated.
Parameter rOffset
To find the grapheme of input string corresponding to the grapheme of output string, rOffset provides the offset array whose index is the offset of output string, the element containing the position within the input string before transliteration.
folding
string
folding(
 
[in] string
[in] long
[in] long
[out] sequence< long >
 
aInStr,
nStartPos,
nCount,
rOffset );

[ DEPRECATED ]
equals
boolean
equals(
 
[in] string
[in] long
[in] long
[out] long
[in] string
[in] long
[in] long
[out] long
 
aStr1,
nPos1,
nCount1,
rMatch1,
aStr2,
nPos2,
nCount2,
rMatch2 );

Description
Match two substrings and find if they are equivalent as per this transliteration.

This method can be called if the object has TransliterationType IGNORE attribute.

Returns the number of matched code points in any case, even if strings are not equal, for example:
equals( "a", 0, 1, nMatch1, "aaa", 0, 3, nMatch2 )
returns false and nMatch:=1 and nMatch2:=1
equals( "aab", 0, 3, nMatch1, "aaa", 0, 3, nMatch2 )
returns false and nMatch:=2 and nMatch2:=2

Parameter aStr1
First string to match.
Parameter nPos1
Start position within aStr1.
Parameter nCount1
Number of code points to use of aStr1.
Parameter rMatch1
Returns number of matched code points in aStr1.
Parameter aStr2
Second string to match.
Parameter nPos2
Start position within aStr2.
Parameter nCount2
Number of code points to use of aStr2.
Parameter rMatch2
Returns number of matched code points in aStr2.
Returns
true if the substrings are equal per this transliteration
false else.
transliterateRange
sequence< string >
transliterateRange(
 
[in] string
[in] string
 
aStr1,
aStr2 );

Description
Transliterate one set of characters to another.

This method is intended for getting corresponding ranges and can be called if the object has TransliterationType IGNORE attribute.

For example: generic CASE_IGNORE transliterateRange( "a", "i" ) returns {"A","I","a","i"}, transliterateRange( "a", "a" ) returns {"A","A","a","a"}.

Use this transliteration to create regular expresssions like [a-i] --> [A-Ia-i].

Returns
String sequence containing corresponding transliterated pairs of characters to represent a range.
compareSubstring
long
compareSubstring(
 
[in] string
[in] long
[in] long
[in] string
[in] long
[in] long
 
aStr1,
nOff1,
nLen1,
aStr2,
nOff2,
nLen2 );

Description
Compare 2 substrings.
Parameter aStr1
First string.
Parameter nOff1
Offset (from 0) of the first substring.
Parameter nLen1
Length (from offset) of the first substring.
Parameter aStr2
Second string.
Parameter nOff2
Offset (from 0) of the second substring.
Parameter nLen2
Length (from offset) of the second substring.
Returns
1 if the first substring is greater than the second substring
0 if the first substring is equal to the second substring
-1 if the first substring is less than the second substring
compareString
long
compareString(
 
[in] string
[in] string
 
aStr1,
aStr2 );

Description
Compare 2 strings.
Returns
1 if the first string is greater than the second string
0 if the first string is equal to the second string
-1 if the first string is less than the second string
Top of Page