1 /** 2 Language Translation. 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.translation; 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.classdb; 23 import godot.resource; 24 import godot.reference; 25 /** 26 Language Translation. 27 28 Translations are resources that can be loaded/unloaded on demand. They map a string to another string. 29 */ 30 @GodotBaseClass struct Translation 31 { 32 enum string _GODOT_internal_name = "Translation"; 33 public: 34 @nogc nothrow: 35 union { godot_object _godot_object; Resource _GODOT_base; } 36 alias _GODOT_base this; 37 alias BaseClasses = AliasSeq!(typeof(_GODOT_base), typeof(_GODOT_base).BaseClasses); 38 package(godot) __gshared bool _classBindingInitialized = false; 39 package(godot) static struct _classBinding 40 { 41 __gshared: 42 @GodotName("set_locale") GodotMethod!(void, String) setLocale; 43 @GodotName("get_locale") GodotMethod!(String) getLocale; 44 @GodotName("add_message") GodotMethod!(void, String, String) addMessage; 45 @GodotName("get_message") GodotMethod!(String, String) getMessage; 46 @GodotName("erase_message") GodotMethod!(void, String) eraseMessage; 47 @GodotName("get_message_list") GodotMethod!(PoolStringArray) getMessageList; 48 @GodotName("get_message_count") GodotMethod!(long) getMessageCount; 49 @GodotName("_set_messages") GodotMethod!(void, PoolStringArray) _setMessages; 50 @GodotName("_get_messages") GodotMethod!(PoolStringArray) _getMessages; 51 } 52 bool opEquals(in Translation other) const { return _godot_object.ptr is other._godot_object.ptr; } 53 Translation opAssign(T : typeof(null))(T n) { _godot_object.ptr = null; } 54 bool opEquals(typeof(null) n) const { return _godot_object.ptr is null; } 55 mixin baseCasts; 56 static Translation _new() 57 { 58 static godot_class_constructor constructor; 59 if(constructor is null) constructor = _godot_api.godot_get_class_constructor("Translation"); 60 if(constructor is null) return typeof(this).init; 61 return cast(Translation)(constructor()); 62 } 63 @disable new(size_t s); 64 /** 65 66 */ 67 void setLocale(StringArg0)(in StringArg0 locale) 68 { 69 checkClassBinding!(typeof(this))(); 70 ptrcall!(void)(_classBinding.setLocale, _godot_object, locale); 71 } 72 /** 73 74 */ 75 String getLocale() const 76 { 77 checkClassBinding!(typeof(this))(); 78 return ptrcall!(String)(_classBinding.getLocale, _godot_object); 79 } 80 /** 81 Add a message for translation. 82 */ 83 void addMessage(StringArg0, StringArg1)(in StringArg0 src_message, in StringArg1 xlated_message) 84 { 85 checkClassBinding!(typeof(this))(); 86 ptrcall!(void)(_classBinding.addMessage, _godot_object, src_message, xlated_message); 87 } 88 /** 89 Return a message for translation. 90 */ 91 String getMessage(StringArg0)(in StringArg0 src_message) const 92 { 93 checkClassBinding!(typeof(this))(); 94 return ptrcall!(String)(_classBinding.getMessage, _godot_object, src_message); 95 } 96 /** 97 Erase a message. 98 */ 99 void eraseMessage(StringArg0)(in StringArg0 src_message) 100 { 101 checkClassBinding!(typeof(this))(); 102 ptrcall!(void)(_classBinding.eraseMessage, _godot_object, src_message); 103 } 104 /** 105 Return all the messages (keys). 106 */ 107 PoolStringArray getMessageList() const 108 { 109 checkClassBinding!(typeof(this))(); 110 return ptrcall!(PoolStringArray)(_classBinding.getMessageList, _godot_object); 111 } 112 /** 113 114 */ 115 long getMessageCount() const 116 { 117 checkClassBinding!(typeof(this))(); 118 return ptrcall!(long)(_classBinding.getMessageCount, _godot_object); 119 } 120 /** 121 122 */ 123 void _setMessages(in PoolStringArray arg0) 124 { 125 Array _GODOT_args = Array.empty_array; 126 _GODOT_args.append(arg0); 127 String _GODOT_method_name = String("_set_messages"); 128 this.callv(_GODOT_method_name, _GODOT_args); 129 } 130 /** 131 132 */ 133 PoolStringArray _getMessages() const 134 { 135 Array _GODOT_args = Array.empty_array; 136 String _GODOT_method_name = String("_get_messages"); 137 return this.callv(_GODOT_method_name, _GODOT_args).as!(RefOrT!PoolStringArray); 138 } 139 /** 140 141 */ 142 @property PoolStringArray messages() 143 { 144 return _getMessages(); 145 } 146 /// ditto 147 @property void messages(PoolStringArray v) 148 { 149 _setMessages(v); 150 } 151 /** 152 153 */ 154 @property String locale() 155 { 156 return getLocale(); 157 } 158 /// ditto 159 @property void locale(String v) 160 { 161 setLocale(v); 162 } 163 }