Class LocalizableString
Data type used for strings in Spring configuration files that may need to be localized.
Inheritance
Inherited Members
Namespace: Sdl.Core.Globalization
Assembly: Sdl.Core.Globalization.dll
Syntax
public class LocalizableString
Remarks
If this object is constructed from a plain text string it works like a normal System.String
.
To reference a resource ID, create this object from a resource identifier string, in the following format:
resource://[AssemblyPath\AssemblyName]/[resource ID]
, where [AssemblyPath\AssemblyName]
is the name of the base assembly (with optional path) that the string resource is located in and
[resource ID]
is the ID of the string resource from which the localized string should be loaded.
The ResourceManager
is used to load the string from the assembly, so a localized
version of the string (depending on the current thread locale) should be returned if available.
Constructors
LocalizableString(String)
Create from a literal string or resource identifier.
Declaration
public LocalizableString(string content)
Parameters
Type | Name | Description |
---|---|---|
System.String | content | the literal string to use in the construction |
Remarks
If the content starts with "assembly://" it is deemed to be a resource identifier.
Resource identifiers use the following format:
assembly://[AssemblyPath\AssemblyName]/[resource ID]
, where [AssemblyPath\AssemblyName]
is the name of the base assembly that the string resource is located in (with an optional path,
specify this only for assemblies not located in the default application folder) and
[resource ID]
is the ID of the string resource from which the localized string should be loaded.
Properties
Content
Returns the localized text this string represents.
Declaration
public string Content { get; }
Property Value
Type | Description |
---|---|
System.String |
Remarks
Throws exceptions if using a resource ID and the assembly or string cannot be loaded.
IsResource
true
if the localizable text is retrieved from an assembly.
Declaration
public bool IsResource { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
RawContent
Returns the string or resource ID this localizable string uses to get the localized text.
Declaration
public string RawContent { get; }
Property Value
Type | Description |
---|---|
System.String |
Methods
ToString()
Returns the localized text this string represents.
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
System.String | The localized text this string represents. |