Documentation
¶
Overview ¶
Translations are resources that can be loaded and unloaded on demand. They map a collection of strings to their individual translations, and they also provide convenience methods for pluralization.
Index ¶
- type Advanced
- type Any
- type Expanded
- type Extension
- type ID
- type Implementation
- type Instance
- func (self Instance) AddMessage(src_message string, xlated_message string)
- func (self Instance) AddPluralMessage(src_message string, xlated_messages []string)
- func (self Instance) AsObject() [1]gd.Object
- func (self Instance) AsRefCounted() [1]gd.RefCounted
- func (self Instance) AsResource() Resource.Instance
- func (self Instance) AsTranslation() Instance
- func (self Instance) EraseMessage(src_message string)
- func (self Instance) GetMessage(src_message string) string
- func (self Instance) GetMessageCount() int
- func (self Instance) GetMessageList() []string
- func (self Instance) GetPluralMessage(src_message string, src_plural_message string, n int) string
- func (self Instance) GetTranslatedMessageList() []string
- func (self Instance) ID() ID
- func (self Instance) Locale() string
- func (self Instance) MoreArgs() MoreArgs
- func (self Instance) SetLocale(value string)
- func (self *Instance) SetObject(obj [1]gd.Object) bool
- func (self Instance) Virtual(name string) reflect.Value
- type Interface
- type MoreArgs
- func (self MoreArgs) AddMessage(src_message string, xlated_message string, context string)
- func (self MoreArgs) AddPluralMessage(src_message string, xlated_messages []string, context string)
- func (self MoreArgs) EraseMessage(src_message string, context string)
- func (self MoreArgs) GetMessage(src_message string, context string) string
- func (self MoreArgs) GetPluralMessage(src_message string, src_plural_message string, n int, context string) string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Advanced ¶
type Advanced = class
Advanced exposes a 1:1 low-level instance of the class, undocumented, for those who know what they are doing.
type Extension ¶
Extension can be embedded in a new struct to create an extension of this class. T should be the type that is embedding this [Extension]See Interface for methods that can be overridden by T.
func (*Extension[T]) AsRefCounted ¶
func (self *Extension[T]) AsRefCounted() [1]gd.RefCounted
func (*Extension[T]) AsResource ¶
func (*Extension[T]) AsTranslation ¶
type ID ¶
ID is a typed object ID (reference) to an instance of this class, use it to store references to objects with unknown lifetimes, as an ID will not panic on use if the underlying object has been destroyed.
type Implementation ¶
type Implementation = implementation
Implementation implements Interface with empty methods.
type Instance ¶
type Instance [1]gdclass.Translation
Instance of the class with convieniently typed arguments and results.
var Nil Instance
Nil is a nil/null instance of the class. Equivalent to the zero value.
func (Instance) AddMessage ¶
Adds a message if nonexistent, followed by its translation.
An additional context could be used to specify the translation context or differentiate polysemic words.
func (Instance) AddPluralMessage ¶
Adds a message involving plural translation if nonexistent, followed by its translation.
An additional context could be used to specify the translation context or differentiate polysemic words.
Note: Plurals are only supported in gettext-based translations (PO), not CSV.
func (Instance) AsRefCounted ¶
func (self Instance) AsRefCounted() [1]gd.RefCounted
func (Instance) AsResource ¶
func (Instance) AsTranslation ¶
func (Instance) EraseMessage ¶
Erases a message.
func (Instance) GetMessage ¶
Returns a message's translation.
func (Instance) GetMessageCount ¶
Returns the number of existing messages.
func (Instance) GetMessageList ¶
Returns all the messages (keys).
func (Instance) GetPluralMessage ¶
Returns a message's translation involving plurals.
The number 'n' is the number or quantity of the plural object. It will be used to guide the translation system to fetch the correct plural form for the selected language.
Note: Plurals are only supported in gettext-based translations (PO), not CSV.
func (Instance) GetTranslatedMessageList ¶
Returns all the messages (translated text).
type Interface ¶
type Interface interface { // Virtual method to override [GetPluralMessage]. // // [GetPluralMessage]: https://pkg.go.dev/graphics.gd/classdb/Translation#Instance.GetPluralMessage GetPluralMessage(src_message string, src_plural_message string, n int, context string) string // Virtual method to override [GetMessage]. // // [GetMessage]: https://pkg.go.dev/graphics.gd/classdb/Translation#Instance.GetMessage GetMessage(src_message string, context string) string }
type MoreArgs ¶
type MoreArgs [1]gdclass.Translation
MoreArgs is a container for Instance functions with additional 'optional' arguments.
func (MoreArgs) AddMessage ¶
Adds a message if nonexistent, followed by its translation.
An additional context could be used to specify the translation context or differentiate polysemic words.
func (MoreArgs) AddPluralMessage ¶
Adds a message involving plural translation if nonexistent, followed by its translation.
An additional context could be used to specify the translation context or differentiate polysemic words.
Note: Plurals are only supported in gettext-based translations (PO), not CSV.
func (MoreArgs) EraseMessage ¶
Erases a message.
func (MoreArgs) GetMessage ¶
Returns a message's translation.
func (MoreArgs) GetPluralMessage ¶
func (self MoreArgs) GetPluralMessage(src_message string, src_plural_message string, n int, context string) string
Returns a message's translation involving plurals.
The number 'n' is the number or quantity of the plural object. It will be used to guide the translation system to fetch the correct plural form for the selected language.
Note: Plurals are only supported in gettext-based translations (PO), not CSV.