1 /** 2 Server that manages all translations. Translations can be set to it and removed from it. 3 4 Copyright: 5 Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. 6 Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) 7 Copyright (c) 2017-2018 Godot-D contributors 8 9 License: $(LINK2 https://opensource.org/licenses/MIT, MIT License) 10 11 12 */ 13 module godot.translationserver; 14 import std.meta : AliasSeq, staticIndexOf; 15 import std.traits : Unqual; 16 import godot.d.meta; 17 import godot.core; 18 import godot.c; 19 import godot.d.bind; 20 import godot.d.reference; 21 import godot.object; 22 import godot.translation; 23 /** 24 Server that manages all translations. Translations can be set to it and removed from it. 25 */ 26 @GodotBaseClass struct TranslationServerSingleton 27 { 28 enum string _GODOT_internal_name = "TranslationServer"; 29 public: 30 @nogc nothrow: 31 union { godot_object _godot_object; GodotObject _GODOT_base; } 32 alias _GODOT_base this; 33 alias BaseClasses = AliasSeq!(typeof(_GODOT_base), typeof(_GODOT_base).BaseClasses); 34 package(godot) __gshared bool _classBindingInitialized = false; 35 package(godot) static struct _classBinding 36 { 37 __gshared: 38 godot_object _singleton; 39 immutable char* _singletonName = "TranslationServer"; 40 @GodotName("set_locale") GodotMethod!(void, String) setLocale; 41 @GodotName("get_locale") GodotMethod!(String) getLocale; 42 @GodotName("get_locale_name") GodotMethod!(String, String) getLocaleName; 43 @GodotName("translate") GodotMethod!(String, String) translate; 44 @GodotName("add_translation") GodotMethod!(void, Translation) addTranslation; 45 @GodotName("remove_translation") GodotMethod!(void, Translation) removeTranslation; 46 @GodotName("clear") GodotMethod!(void) clear; 47 } 48 bool opEquals(in TranslationServerSingleton other) const { return _godot_object.ptr is other._godot_object.ptr; } 49 TranslationServerSingleton opAssign(T : typeof(null))(T n) { _godot_object.ptr = null; } 50 bool opEquals(typeof(null) n) const { return _godot_object.ptr is null; } 51 mixin baseCasts; 52 static TranslationServerSingleton _new() 53 { 54 static godot_class_constructor constructor; 55 if(constructor is null) constructor = _godot_api.godot_get_class_constructor("TranslationServer"); 56 if(constructor is null) return typeof(this).init; 57 return cast(TranslationServerSingleton)(constructor()); 58 } 59 @disable new(size_t s); 60 /** 61 62 */ 63 void setLocale(StringArg0)(in StringArg0 locale) 64 { 65 checkClassBinding!(typeof(this))(); 66 ptrcall!(void)(_classBinding.setLocale, _godot_object, locale); 67 } 68 /** 69 70 */ 71 String getLocale() const 72 { 73 checkClassBinding!(typeof(this))(); 74 return ptrcall!(String)(_classBinding.getLocale, _godot_object); 75 } 76 /** 77 78 */ 79 String getLocaleName(StringArg0)(in StringArg0 locale) const 80 { 81 checkClassBinding!(typeof(this))(); 82 return ptrcall!(String)(_classBinding.getLocaleName, _godot_object, locale); 83 } 84 /** 85 86 */ 87 String translate(StringArg0)(in StringArg0 message) const 88 { 89 checkClassBinding!(typeof(this))(); 90 return ptrcall!(String)(_classBinding.translate, _godot_object, message); 91 } 92 /** 93 94 */ 95 void addTranslation(Translation translation) 96 { 97 checkClassBinding!(typeof(this))(); 98 ptrcall!(void)(_classBinding.addTranslation, _godot_object, translation); 99 } 100 /** 101 102 */ 103 void removeTranslation(Translation translation) 104 { 105 checkClassBinding!(typeof(this))(); 106 ptrcall!(void)(_classBinding.removeTranslation, _godot_object, translation); 107 } 108 /** 109 110 */ 111 void clear() 112 { 113 checkClassBinding!(typeof(this))(); 114 ptrcall!(void)(_classBinding.clear, _godot_object); 115 } 116 } 117 /// Returns: the TranslationServerSingleton 118 @property @nogc nothrow pragma(inline, true) 119 TranslationServerSingleton TranslationServer() 120 { 121 checkClassBinding!TranslationServerSingleton(); 122 return TranslationServerSingleton(TranslationServerSingleton._classBinding._singleton); 123 }