Class LocalizedStrings
- Namespace
- SharpDX.DirectWrite
- Assembly
- SharpDX.Direct2D1.dll
[Guid("08256209-099a-4b34-b86d-c22b110e7771")]
public class LocalizedStrings : ComObject
- Inheritance
-
LocalizedStrings
Constructors
LocalizedStrings(nint)
public LocalizedStrings(nint nativePtr)
Parameters
nativePtr
nint
Properties
Count
Gets the number of language/string pairs.
public int Count { get; }
Property Value
Methods
FindLocaleName(string, out int)
Gets the zero-based index of the locale name/string pair with the specified locale name.
public RawBool FindLocaleName(string localeName, out int index)
Parameters
localeName
stringA null-terminated array of characters containing the locale name to look for.
index
intThe zero-based index of the locale name/string pair. This method initializes index to UINT_MAX.
Returns
- RawBool
When this method returns, contains TRUE if the locale name exists; otherwise, SharpDX.Result.False. This method initializes exists to SharpDX.Result.False.
Remarks
Note that if the locale name does not exist, the return value is a success and the exists parameter is SharpDX.Result.False. If you are getting the font family name for a font and the specified locale name does not exist, one option is to set the index to 0 as shown below. There is always at least one locale for a font family.
UINT32 index = 0;
SharpDX.Mathematics.Interop.RawBool exists = false; wchar_t localeName[LOCALE_NAME_MAX_LENGTH]; if (SUCCEEDED(hr))
{ // Get the default locale for this user. int defaultLocaleSuccess = GetUserDefaultLocaleName(localeName, LOCALE_NAME_MAX_LENGTH); // If the default locale is returned, find that locale name, otherwise use "en-us". if (defaultLocaleSuccess) { hr = pFamilyNames->FindLocaleName(localeName, &index, &exists); } if (SUCCEEDED(hr) & & !exists) // if the above find did not find a match, retry with US English { hr = pFamilyNames->FindLocaleName(L"en-us", &index, &exists); }
} // If the specified locale doesn't exist, select the first on the list.
if (!exists) index = 0;
GetLocaleName(int)
Get the locale name from the language.
public string GetLocaleName(int index)
Parameters
index
intZero-based index of the locale name to be retrieved.
Returns
- string
The locale name from the language
GetString(int)
Get the string from the language/string pair.
public string GetString(int index)
Parameters
index
intZero-based index of the string from the language/string pair to be retrieved.
Returns
- string
The locale name from the language
Operators
explicit operator LocalizedStrings(nint)
public static explicit operator LocalizedStrings(nint nativePtr)
Parameters
nativePtr
nint