| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586 |
- using System;
- using System.Runtime.CompilerServices;
- using System.Runtime.InteropServices;
- namespace BansheeEngine
- {
- /** @addtogroup Localization
- * @{
- */
- /// <summary>
- /// 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.
- /// </summary>
- public partial class LocString : ScriptObject
- {
- private LocString(bool __dummy0) { }
- /// <summary>
- /// 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.
- /// </summary>
- /// <param name="identifier">String you can use for later referencing the localized string.</param>
- /// <param name="stringTableId">Unique identifier of the string table to retrieve the string from.</param>
- public LocString(string identifier, uint stringTableId = 0)
- {
- Internal_HString(this, identifier, stringTableId);
- }
- /// <summary>
- /// 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.
- /// </summary>
- /// <param name="identifier">String you can use for later referencing the localized string.</param>
- /// <param name="defaultString">
- /// Default string to assign to the specified identifier. Language to which it will be assigned depends on the
- /// StringTable::DEFAULT_LANGUAGE value.
- /// </param>
- /// <param name="stringTableId">Unique identifier of the string table to retrieve the string from.</param>
- public LocString(string identifier, string defaultString, uint stringTableId = 0)
- {
- Internal_HString0(this, identifier, defaultString, stringTableId);
- }
- /// <summary>Creates a new empty localized string.</summary>
- /// <param name="stringTableId">Unique identifier of the string table to retrieve the string from.</param>
- public LocString(uint stringTableId)
- {
- Internal_HString1(this, stringTableId);
- }
- /// <summary>Creates a new empty localized string.</summary>
- public LocString()
- {
- Internal_HString2(this);
- }
- /// <summary>
- /// 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.
- /// </summary>
- 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);
- }
- /** @} */
- }
|