// WARNING - AUTOGENERATED - DO NOT EDIT
//
// Generated using `sharpie urho`
//
// Localization.cs
//
// Copyright 2015 Xamarin Inc. All rights reserved.
using System;
using System.Runtime.InteropServices;
using System.Collections.Generic;
using Urho.Urho2D;
using Urho.Gui;
using Urho.Resources;
using Urho.IO;
using Urho.Navigation;
using Urho.Network;
namespace Urho.Resources
{
///
/// %Localization subsystem. Stores all the strings in all languages.
///
public unsafe partial class Localization : UrhoObject
{
unsafe partial void OnLocalizationCreated ();
[Preserve]
public Localization (IntPtr handle) : base (handle)
{
OnLocalizationCreated ();
}
[Preserve]
protected Localization (UrhoObjectFlag emptyFlag) : base (emptyFlag)
{
OnLocalizationCreated ();
}
[DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
internal static extern int Localization_GetType (IntPtr handle);
private StringHash UrhoGetType ()
{
Runtime.ValidateRefCounted (this);
return new StringHash (Localization_GetType (handle));
}
[DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
internal static extern IntPtr Localization_GetTypeName (IntPtr handle);
private string GetTypeName ()
{
Runtime.ValidateRefCounted (this);
return Marshal.PtrToStringAnsi (Localization_GetTypeName (handle));
}
[DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
internal static extern int Localization_GetTypeStatic ();
private static StringHash GetTypeStatic ()
{
Runtime.Validate (typeof(Localization));
return new StringHash (Localization_GetTypeStatic ());
}
[DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
internal static extern IntPtr Localization_GetTypeNameStatic ();
private static string GetTypeNameStatic ()
{
Runtime.Validate (typeof(Localization));
return Marshal.PtrToStringAnsi (Localization_GetTypeNameStatic ());
}
[Preserve]
public Localization () : this (Application.CurrentContext)
{
}
[DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
internal static extern IntPtr Localization_Localization (IntPtr context);
[Preserve]
public Localization (Context context) : base (UrhoObjectFlag.Empty)
{
Runtime.Validate (typeof(Localization));
handle = Localization_Localization ((object)context == null ? IntPtr.Zero : context.Handle);
Runtime.RegisterObject (this);
OnLocalizationCreated ();
}
[DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
internal static extern int Localization_GetNumLanguages (IntPtr handle);
///
/// Return the number of languages.
///
private int GetNumLanguages ()
{
Runtime.ValidateRefCounted (this);
return Localization_GetNumLanguages (handle);
}
[DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
internal static extern int Localization_GetLanguageIndex (IntPtr handle);
///
/// Return the index number of current language. The index is determined by the order of loading.
///
private int GetLanguageIndex ()
{
Runtime.ValidateRefCounted (this);
return Localization_GetLanguageIndex (handle);
}
[DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
internal static extern int Localization_GetLanguageIndex0 (IntPtr handle, string language);
///
/// Return the index number of language. The index is determined by the order of loading.
///
public int GetLanguageIndex (string language)
{
Runtime.ValidateRefCounted (this);
return Localization_GetLanguageIndex0 (handle, language);
}
[DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
internal static extern IntPtr Localization_GetLanguage (IntPtr handle);
///
/// Return the name of current language.
///
private string GetLanguage ()
{
Runtime.ValidateRefCounted (this);
return Marshal.PtrToStringAnsi (Localization_GetLanguage (handle));
}
[DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
internal static extern IntPtr Localization_GetLanguage1 (IntPtr handle, int index);
///
/// Return the name of language.
///
public string GetLanguage (int index)
{
Runtime.ValidateRefCounted (this);
return Marshal.PtrToStringAnsi (Localization_GetLanguage1 (handle, index));
}
[DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
internal static extern void Localization_SetLanguage (IntPtr handle, int index);
///
/// Set current language.
///
public void SetLanguage (int index)
{
Runtime.ValidateRefCounted (this);
Localization_SetLanguage (handle, index);
}
[DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
internal static extern void Localization_SetLanguage2 (IntPtr handle, string language);
///
/// Set current language.
///
public void SetLanguage (string language)
{
Runtime.ValidateRefCounted (this);
Localization_SetLanguage2 (handle, language);
}
[DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
internal static extern IntPtr Localization_Get (IntPtr handle, string id);
///
/// Return a string in the current language. Returns String::EMPTY if id is empty. Returns id if translation is not found and logs a warning.
///
public string Get (string id)
{
Runtime.ValidateRefCounted (this);
return Marshal.PtrToStringAnsi (Localization_Get (handle, id));
}
[DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
internal static extern void Localization_Reset (IntPtr handle);
///
/// Clear all loaded strings.
///
public void Reset ()
{
Runtime.ValidateRefCounted (this);
Localization_Reset (handle);
}
[DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
internal static extern void Localization_LoadJSONFile (IntPtr handle, string name);
///
/// Load strings from JSONFile. The file should be UTF8 without BOM.
///
public void LoadJsonFile (string name)
{
Runtime.ValidateRefCounted (this);
Localization_LoadJSONFile (handle, name);
}
public override StringHash Type {
get {
return UrhoGetType ();
}
}
public override string TypeName {
get {
return GetTypeName ();
}
}
[Preserve]
public static StringHash TypeStatic {
get {
return GetTypeStatic ();
}
}
public static string TypeNameStatic {
get {
return GetTypeNameStatic ();
}
}
///
/// Return the number of languages.
///
public int NumLanguages {
get {
return GetNumLanguages ();
}
}
///
/// Return the index number of current language. The index is determined by the order of loading.
///
public int LanguageIndex {
get {
return GetLanguageIndex ();
}
}
///
/// Return the name of current language.
///
public string Language {
get {
return GetLanguage ();
}
}
}
}