Translation

package
v0.0.0-...-d9f4d4e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 9, 2025 License: MIT Imports: 20 Imported by: 0

Documentation

Overview

Package Translation provides methods for working with Translation object instances.

Index

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 Any

type Any interface {
	gd.IsClass
	AsTranslation() Instance
}

type Implementation

type Implementation = implementation

Implementation implements Interface with empty methods.

type Instance

type Instance [1]gdclass.Translation

[Translation]s 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.

See [Interface] for methods that can be overridden by a [Class] that extends it.

%!(EXTRA string=Translation)

var Nil Instance

Nil is a nil/null instance of the class. Equivalent to the zero value.

func New

func New() Instance

func (Instance) AddMessage

func (self Instance) AddMessage(src_message string, xlated_message string)

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

func (self Instance) AddPluralMessage(src_message string, xlated_messages []string)

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.

func (Instance) AsObject

func (self Instance) AsObject() [1]gd.Object

func (Instance) AsRefCounted

func (self Instance) AsRefCounted() [1]gd.RefCounted

func (Instance) AsResource

func (self Instance) AsResource() Resource.Instance

func (Instance) AsTranslation

func (self Instance) AsTranslation() Instance

func (Instance) EraseMessage

func (self Instance) EraseMessage(src_message string)

Erases a message.

func (Instance) GetMessage

func (self Instance) GetMessage(src_message string) string

Returns a message's translation.

func (Instance) GetMessageCount

func (self Instance) GetMessageCount() int

Returns the number of existing messages.

func (Instance) GetMessageList

func (self Instance) GetMessageList() []string

Returns all the messages (keys).

func (Instance) GetPluralMessage

func (self Instance) GetPluralMessage(src_message string, src_plural_message string, n int) string

Returns a message's translation involving plurals. The number [param 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.

func (Instance) GetTranslatedMessageList

func (self Instance) GetTranslatedMessageList() []string

Returns all the messages (translated text).

func (Instance) Locale

func (self Instance) Locale() string

func (Instance) SetLocale

func (self Instance) SetLocale(value string)

func (*Instance) UnsafePointer

func (self *Instance) UnsafePointer() unsafe.Pointer

func (Instance) Virtual

func (self Instance) Virtual(name string) reflect.Value

type Interface

type Interface interface {
	//Virtual method to override [method get_plural_message].
	GetPluralMessage(src_message string, src_plural_message string, n int, context string) string
	//Virtual method to override [method get_message].
	GetMessage(src_message string, context string) string
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL