Translation
A language translation that maps a collection of strings to their individual translations.
Translation.swift:17class 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.
Superclasses
class Resource
Base class for serializable objects.
Citizens in SwiftGodot
Conformances
protocol CustomStringConvertible
A type with a customized textual representation.
protocol Equatable
A type that can be compared for value equality.
protocol Hashable
A type that can be hashed into a
Hasher
to produce an integer hash value.protocol Identifiable<ID>
A class of types whose instances hold the value of an entity with stable identity.
protocol VariantRepresentable
Types that conform to VariantRepresentable can be stored directly in
Variant
with no conversion. These include all of the Variant types from Godot (for exampleGString
,Rect
,Plane
), Godot objects (those that subclass SwiftGodot.Object) as well as the built-in Swift types UInt8, Int64 and Double.protocol VariantStorable
Types that conform to VariantStorable can be stored in a Variant and can be extracted back out of a Variant.
Type members
Instance members
var locale: String
The locale of the translation.
func addMessage(srcMessage: StringName, xlatedMessage: StringName, context: StringName
) Adds a message if nonexistent, followed by its translation.
func addPluralMessage(srcMessage: StringName, xlatedMessages: PackedStringArray, context: StringName
) Adds a message involving plural translation if nonexistent, followed by its translation.
func eraseMessage(srcMessage: StringName, context: StringName
) Erases a message.
func getMessage(srcMessage: StringName, context: StringName
) -> StringName Returns a message’s translation.
func getMessageCount(
) -> Int32 Returns the number of existing messages.
func getMessageList(
) -> PackedStringArray Returns all the messages (keys).
func getPluralMessage(srcMessage: StringName, srcPluralMessage: StringName, n: Int32, context: StringName
) -> StringName Returns a message’s translation involving plurals.
func getTranslatedMessageList(
) -> PackedStringArray Returns all the messages (translated text).
Show implementation details (2)
Hide implementation details
func _getMessage(srcMessage: StringName, context: StringName
) -> StringName Virtual method to override
getMessage(srcMessage:context:)
.func _getPluralMessage(srcMessage: StringName, srcPluralMessage: StringName, n: Int32, context: StringName
) -> StringName Virtual method to override
getPluralMessage(srcMessage:srcPluralMessage:n:context:)
.
Subclasses
class OptimizedTranslation
An optimized translation, used by default for CSV Translations.