Class Localization
A collection of localization related helper utilities.
Inheritance
Namespace: GDX
Syntax
[VisualScriptingCompatible((short)8)]
public static class Localization
Fields
| Improve this Doc View SourceByteSizes
An array of strings representative for file size formats.
Declaration
public static readonly string[] ByteSizes
Field Value
Type | Description |
---|---|
System.String[] |
FilenameTimestampFormat
A filename safe System.DateTime.ToString(System.String).
Declaration
public const string FilenameTimestampFormat = "yyyyMMdd_HHmmss"
Field Value
Type | Description |
---|---|
System.String |
LocalTimestampFormat
The local ISO 8601 compliant System.DateTime.ToString(System.String).
Declaration
public const string LocalTimestampFormat = "yyyy-MM-dd HH\\:mm\\:ss"
Field Value
Type | Description |
---|---|
System.String |
UtcTimestampFormat
The UTC ISO 8601 compliant System.DateTime.ToString(System.String).
Declaration
public const string UtcTimestampFormat = "yyyy-MM-ddTHH\\:mm\\:ss.fffffffzzz"
Field Value
Type | Description |
---|---|
System.String |
Methods
| Improve this Doc View SourceGetHumanReadableFileSize(Int64)
Creates a more human readable System.String of a byte size.
Declaration
public static string GetHumanReadableFileSize(long base2Size)
Parameters
Type | Name | Description |
---|---|---|
System.Int64 | base2Size | The number of bytes (binary) to measure. |
Returns
Type | Description |
---|---|
System.String | A human readable version of the provided |
Examples
A byte size of 1024, will return a string of 1 KB.
| Improve this Doc View SourceGetIETF_BCP47(Localization.Language)
Get the IETF BCP 47 language code for targetLanguage
.
Declaration
public static string GetIETF_BCP47(this Localization.Language targetLanguage)
Parameters
Type | Name | Description |
---|---|---|
Localization.Language | targetLanguage | The target Localization.Language. |
Returns
Type | Description |
---|---|
System.String | The language code. |
Remarks
Two additional non-compliant values may be returned DEV or DEFAULT.
GetISO639_1(Localization.Language)
Get the ISO 639-1 language code for targetLanguage
.
Declaration
public static string GetISO639_1(this Localization.Language targetLanguage)
Parameters
Type | Name | Description |
---|---|---|
Localization.Language | targetLanguage | The target Localization.Language. |
Returns
Type | Description |
---|---|
System.String | The language code. |
Remarks
Two additional non-compliant values may be returned DEV or DEFAULT.
GetSystemLanguage()
Get the Localization.Language equivalent of the UnityEngine.SystemLanguage.
Declaration
public static Localization.Language GetSystemLanguage()
Returns
Type | Description |
---|---|
Localization.Language | The appropriate Localization.Language, or default. |
GetTimestampFormat(Localization.Language)
Get the localized System.DateTime.System.DateTime.ToString(System.String) for
targetLanguage
.
Declaration
public static string GetTimestampFormat(this Localization.Language targetLanguage)
Parameters
Type | Name | Description |
---|---|---|
Localization.Language | targetLanguage | The target Localization.Language. |
Returns
Type | Description |
---|---|
System.String | The format System.String. |
SetDefaultCulture()
Sets the current threads culture to a defined setting in Config.
Declaration
public static void SetDefaultCulture()
Remarks
Can be used to avoid issues with culture settings without a Gregorian Calendar. Configurable to automatically execute after assemblies are loaded.