OWLNext    7.0
Borland's Object Windows Library for the modern age
Loading...
Searching...
No Matches
owl::TLocaleString Struct Reference

Designed to provide support for localized registration parameters, the TLocaleString Struct defines a localizable substitute for char* strings. More...

#include <owl/lclstrng.h>

Public Member Functions

const tcharTranslate (TLangId lang)
 translate string
 
 operator const tchar * () const
 return current string
 
void operator= (const tchar *str)
 
int Compare (const tchar *str, TLangId lang)
 insensitive compare
 

Static Public Member Functions

static TLangId GetSystemLangId ()
 platform-dependent implementation
 
static TLangId GetUserLangId ()
 platform-dependent implementation
 
static int IsNativeLangId (TLangId lang)
 returns bool true if native
 
static int CompareLang (const tchar *s1, const tchar *s2, TLangId)
 This function may be re-implemented with enhanced NLS support in another module.
 

Public Attributes

const tcharPrivate
 string pointer used for initialization
 

Static Public Attributes

static TLangId SystemDefaultLangId = TLocaleString::GetSystemLangId()
 The default language identifier.
 
static TLangId UserDefaultLangId = TLocaleString::GetUserLangId()
 The user-defined default language identifier.
 
static TLangId NativeLangId = TLocaleString::GetSystemLangId()
 The base language ID of non-localized strings.
 
static HINSTANCE Module = nullptr
 The handle of the file containing the resource.
 
static TLocaleString Null = {null_string}
 reference a null string
 

Detailed Description

Designed to provide support for localized registration parameters, the TLocaleString Struct defines a localizable substitute for char* strings.

localizable substitute for char*

These strings, which describe both OLE and non-OLE enabled objects to the user, are available in whatever language the user needs. This Struct supports ObjectWindows' Doc/View as well as ObjectComponents' OLE-enabled applications. The public member functions, which supply information about the user's language, the native language, and a description of the string marked for localization, simplify the process of translating and comparing strings in a given language.

To localize the string resource, TLocaleString uses several user-entered prefixes to determine what kind of string to translate. Each prefix must be followed by a valid resource identifier (a standard C identifier).The following table lists the prefixes TLocaleString uses to localize strings. Each prefix is followed by a sample entry.

  • @ TXY The string is a series of characters interpreted as a resource ID and is accessed only from a resource file. It is never used directly.
  • # 1045 The string is a series of digits interpreted as a resource ID and is accessed from a resource file. It is never used directly.
  • ! MyWindow The string is translated if it is not in the native language; otherwise, this string is used directly.

See the section on localizing symbol names in the ObjectWindows Programmer's Guide for more information about localizing strings.

Definition at line 68 of file lclstrng.h.

Member Function Documentation

◆ Compare()

int owl::TLocaleString::Compare ( const tchar * str,
TLangId lang )

insensitive compare

Using the specified language (lang), Compare compares TLocaleString with another string.

It uses the standard string compare and the language-specific collation scheme. It returns one of the following values:

  • 0 There is no match between the two strings.
  • 1 This string is greater than the other string.
  • -1 This string is less than the other string.

Definition at line 410 of file locale.cpp.

◆ CompareLang()

int owl::TLocaleString::CompareLang ( const tchar * s1,
const tchar * s2,
TLangId lang )
static

This function may be re-implemented with enhanced NLS support in another module.

Note
That module must be linked in before the library, to override this default implementation.

Definition at line 35 of file localeco.cpp.

◆ GetSystemLangId()

TLangId owl::TLocaleString::GetSystemLangId ( )
static

platform-dependent implementation

Returns the system language ID, which can be the same as the UserLangId.

Definition at line 17 of file localeco.cpp.

◆ GetUserLangId()

TLangId owl::TLocaleString::GetUserLangId ( )
static

platform-dependent implementation

Returns the user language ID.

For single user systems, this is the same as LangSysDefault. The language ID is a predefined number that represents a base language and dialect.

Definition at line 26 of file localeco.cpp.

◆ IsNativeLangId()

int owl::TLocaleString::IsNativeLangId ( TLangId lang)
static

returns bool true if native

Returns true if lang equals the native system language.

Definition at line 416 of file locale.cpp.

◆ operator const tchar *()

owl::TLocaleString::operator const tchar * ( ) const

return current string

Definition at line 384 of file locale.cpp.

References AUTOLANG_CACHEDLOAD, AUTOLANG_CACHEDNEUT, AUTOLANG_LOAD, AUTOLANG_RCID, and AUTOLANG_XLAT.

◆ operator=()

void owl::TLocaleString::operator= ( const tchar * str)
inline

Definition at line 74 of file lclstrng.h.

◆ Translate()

const tchar * owl::TLocaleString::Translate ( TLangId reqLang)

translate string

Translates the string to the given language.

Translate follows this order of preference in order to choose a language for translation:

  • 1. Base language and dialect.
  • 2. Base language and no dialect.
  • 3. Base language and another dialect.
  • 4. The native language of the resource itself.
  • 5. Returns 0 if unable to translate the string. (This can happen only if an @ or # prefix is used; otherwise, the ! prefix indicates that the string following is the native language itself.)

Definition at line 344 of file locale.cpp.

References AUTOLANG_CACHEDLOAD, AUTOLANG_CACHEDNEUT, AUTOLANG_LOAD, AUTOLANG_RCID, AUTOLANG_XLAT, owl::LangNeutral, owl::LangSysDefault, and owl::LangUserDefault.

Member Data Documentation

◆ Module

HINSTANCE owl::TLocaleString::Module = nullptr
static

The handle of the file containing the resource.

must define and set to resource module

Definition at line 93 of file lclstrng.h.

◆ NativeLangId

TLangId owl::TLocaleString::NativeLangId = TLocaleString::GetSystemLangId()
static

The base language ID of non-localized strings.

must define and set to lang. of literals

Definition at line 90 of file lclstrng.h.

◆ Null

TLocaleString owl::TLocaleString::Null = {null_string}
static

reference a null string

Definition at line 94 of file lclstrng.h.

◆ Private

const tchar* owl::TLocaleString::Private

string pointer used for initialization

Definition at line 77 of file lclstrng.h.

◆ SystemDefaultLangId

TLangId owl::TLocaleString::SystemDefaultLangId = TLocaleString::GetSystemLangId()
static

The default language identifier.

must define and set to system language

Definition at line 84 of file lclstrng.h.

◆ UserDefaultLangId

TLangId owl::TLocaleString::UserDefaultLangId = TLocaleString::GetUserLangId()
static

The user-defined default language identifier.

same as system language if single user

Definition at line 87 of file lclstrng.h.


The documentation for this struct was generated from the following files: