Class SystemConfigTransformUtils
Utility class for transforming and normalizing system configuration strings.
Inherited Members
Namespace: Serenity.SystemConfiguration.Domain.Helpers
Assembly: Serenity.SystemConfiguration.Domain.dll
Syntax
public static class SystemConfigTransformUtils
Methods
ApplyCharacterLimit(string, int)
Applies a character limit to a string.
Declaration
public static string ApplyCharacterLimit(string s, int limit)
Parameters
| Type | Name | Description |
|---|---|---|
| string | s | The input string to limit. |
| int | limit | The maximum number of characters allowed. If less than or equal to zero, no limit is applied. |
Returns
| Type | Description |
|---|---|
| string | The string truncated to the specified limit, or the original string if no limit is applied. |
ApplyStringTransform(string, StringTransform)
Applies a specified string transformation.
Declaration
public static string ApplyStringTransform(string s, StringTransform t)
Parameters
| Type | Name | Description |
|---|---|---|
| string | s | The input string to transform. |
| StringTransform | t | The type of transformation to apply. |
Returns
| Type | Description |
|---|---|
| string | The transformed string. |
ExtractLanguageCode(string)
Extracts the language code from a culture code. Ie "en-US" -> "en"
Declaration
public static string ExtractLanguageCode(string culture)
Parameters
| Type | Name | Description |
|---|---|---|
| string | culture | The culture code to extract the language from. |
Returns
| Type | Description |
|---|---|
| string | The extracted language code. |
ExtractRegionCode(string)
Extracts the region code from a culture code. Ie "en-US" -> "US"
Declaration
public static string ExtractRegionCode(string culture)
Parameters
| Type | Name | Description |
|---|---|---|
| string | culture | The culture code to extract the region from. |
Returns
| Type | Description |
|---|---|
| string | The extracted region code. |
NormalizeCulture(string)
Normalizes culture codes to standard format. Ie "en_us" -> "en-US"
Declaration
public static string NormalizeCulture(string culture)
Parameters
| Type | Name | Description |
|---|---|---|
| string | culture | The culture code to normalize. |
Returns
| Type | Description |
|---|---|
| string | The normalized culture code. |
NormalizeLanguageByNames(string)
Normalizes a language name to its ISO 639-1 two-letter code.
Declaration
public static string NormalizeLanguageByNames(string raw)
Parameters
| Type | Name | Description |
|---|---|---|
| string | raw | The language name to normalize (e.g., "English", "Español"). |
Returns
| Type | Description |
|---|---|
| string | The ISO 639-1 two-letter language code if found; otherwise, returns the input string in lowercase. |