dlangui.core.i18n

DLANGUI library.

This module contains internationalization support implementation.

Translation files contain of simple key=value pair lines.

STRING_RESOURCE_ID=Translation text.

Supports fallback to another translation file (e.g. default language).





Synopsis:
import dlangui.core.i18n;

// use global i18n object to get translation for string ID
dstring translated = i18n.get("STR_FILE_OPEN");

// UIString type can hold either string resource id or dstring raw value.
UIString text;

// assign resource id as string
text = "ID_FILE_EXIT";
// or assign raw value as dstring
text = "some text"d;

// i18n.get() will automatically be invoked when getting UIString value (e.g. using alias this).
dstring translated = text;



License:
Boost License 1.0

Authors:
Vadim Lopatin, coolreader.org@gmail.com

struct UIString;
container for UI string - either raw value or string resource ID

this(string id);
create string with i18n resource id

this(dstring value);
create string with raw value

const @property dstring value();
get value (either raw or translated by id)

@property void value(dstring newValue);
set raw value

ref UIString opAssign(dstring rawValue);
assign raw value

ref UIString opAssign(string ID);
assign ID

class UIStringList;
UI string translator

void clear();
remove all items

void set(string id, dstring value);
set item value

const dstring get(string id);
get item value, null if translation is not found for id

bool load(std.stream.InputStream stream);
load strings from stream

bool load(string filename);
load strings from file (utf8, id=value lines)


Page generated by Ddoc. Vadim Lopatin, 2014