Drag[en]gine Script Module DragonScript  1.21
Dragengine.LanguagePack Class Reference

Immutable language pack resources. More...

Inheritance diagram for Dragengine.LanguagePack:

Public Member Functions

Management
String getFilename ()
 Normalized filename the language pack has been loaded from. More...
 
String getIdentifier ()
 Unique identifier. More...
 
UnicodeString getName ()
 Name in native language. More...
 
UnicodeString getDescription ()
 Description in native language. More...
 
UnicodeString translate (String name)
 Translation for entry name or missing text if absent. More...
 
UnicodeString translate (String name, UnicodeString defaultValue)
 Translation for entry name or default value if absent. More...
 
UnicodeString getMissingText ()
 Text used for missing translations. More...
 
bool equals (Object other)
 LanguagePack is equal to another object. More...
 
int hashCode ()
 Hash code for use as dictionary keys. More...
 

Constructors

LanguagePack new (String filename)
 Load language pack from file. More...
 
static void loadAsynchron (String filename, ResourceListener listener)
 Load language pack from file asynchronously. More...
 

Detailed Description

Immutable language pack resources.

Language pack contain a list of entries assigning translations to names

This is a native class. It can not be subclassed.

Member Function Documentation

◆ equals()

bool Dragengine.LanguagePack.equals ( Object  other)

LanguagePack is equal to another object.

Implements Object.equals(Object).

Returns
true if other is of type LanguagePack and both point to the same engine language pack resource.

◆ getDescription()

UnicodeString Dragengine.LanguagePack.getDescription ( )

Description in native language.

This string can be optionally shown to the user to describe the language pack in more detail, for example if the language uses some kind of dialect.

◆ getFilename()

String Dragengine.LanguagePack.getFilename ( )

Normalized filename the language pack has been loaded from.

◆ getIdentifier()

String Dragengine.LanguagePack.getIdentifier ( )

Unique identifier.

Version
1.16

This is used to uniquely identify the language pack.

◆ getMissingText()

UnicodeString Dragengine.LanguagePack.getMissingText ( )

Text used for missing translations.

Version
1.16

◆ getName()

UnicodeString Dragengine.LanguagePack.getName ( )

Name in native language.

This string is typically shown in language settings screens to the user.

◆ hashCode()

int Dragengine.LanguagePack.hashCode ( )

Hash code for use as dictionary keys.

Implements Object.hashCode().

◆ loadAsynchron()

static void Dragengine.LanguagePack.loadAsynchron ( String  filename,
ResourceListener  listener 
)
static

Load language pack from file asynchronously.

Registers a request in the game engine to load an language pack. Once finished or if the file is already loaded the listener is used to deliver the loaded language pack or null if the loading failed.

◆ new()

LanguagePack Dragengine.LanguagePack.new ( String  filename)

Load language pack from file.

If the language pack file has been already loaded it is assigned to this object. If the language pack is not loaded yet the engine loads the language pack. This call blocks until the language pack is fully loaded and ready to be used. For asynchronous loading use loadAsynchron(). Multiple objects can point to the same loaded language pack resource. Once no object instance uses an language pack file anymore it is released from memory.

◆ translate() [1/2]

UnicodeString Dragengine.LanguagePack.translate ( String  name)

Translation for entry name or missing text if absent.

◆ translate() [2/2]

UnicodeString Dragengine.LanguagePack.translate ( String  name,
UnicodeString  defaultValue 
)

Translation for entry name or default value if absent.


The documentation for this class was generated from the following file: