using System; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; namespace BansheeEngine { /** @addtogroup Localization * @{ */ /// /// String handle. Provides a wrapper around an Unicode string, primarily for localization purposes. /// /// Actual value for this string is looked up in a global string table based on the provided identifier string and /// currently active language. If such value doesn't exist then the identifier is used as is. /// /// Use {0}, {1}, etc. in the string value for values that might change dynamically. /// public partial class LocString : ScriptObject { private LocString(bool __dummy0) { } /// /// Creates a new localized string with the specified identifier. If the identifier doesn't previously exist in the /// string table, identifier value will also be used for initializing the default language version of the string. /// /// String you can use for later referencing the localized string. /// Unique identifier of the string table to retrieve the string from. public LocString(string identifier, uint stringTableId = 0) { Internal_HString(this, identifier, stringTableId); } /// /// Creates a new localized string with the specified identifier and sets the default language version of the string. If /// a string with that identifier already exists default language string will be updated. /// /// String you can use for later referencing the localized string. /// /// Default string to assign to the specified identifier. Language to which it will be assigned depends on the /// StringTable::DEFAULT_LANGUAGE value. /// /// Unique identifier of the string table to retrieve the string from. public LocString(string identifier, string defaultString, uint stringTableId = 0) { Internal_HString0(this, identifier, defaultString, stringTableId); } /// Creates a new empty localized string. /// Unique identifier of the string table to retrieve the string from. public LocString(uint stringTableId) { Internal_HString1(this, stringTableId); } /// Creates a new empty localized string. public LocString() { Internal_HString2(this); } /// /// Sets a value of a string parameter. Parameters are specified as bracketed values within the string itself (for /// example {0}, {1}) etc. Use ^ as an escape character. /// public void SetParameter(uint idx, string value) { Internal_setParameter(mCachedPtr, idx, value); } [MethodImpl(MethodImplOptions.InternalCall)] private static extern void Internal_HString(LocString managedInstance, string identifier, uint stringTableId); [MethodImpl(MethodImplOptions.InternalCall)] private static extern void Internal_HString0(LocString managedInstance, string identifier, string defaultString, uint stringTableId); [MethodImpl(MethodImplOptions.InternalCall)] private static extern void Internal_HString1(LocString managedInstance, uint stringTableId); [MethodImpl(MethodImplOptions.InternalCall)] private static extern void Internal_HString2(LocString managedInstance); [MethodImpl(MethodImplOptions.InternalCall)] private static extern string Internal_getValue(IntPtr thisPtr); [MethodImpl(MethodImplOptions.InternalCall)] private static extern void Internal_setParameter(IntPtr thisPtr, uint idx, string value); } /** @} */ }