dlangui/i18n.html

154 lines
5.4 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta charset='utf-8'>
<meta http-equiv="X-UA-Compatible" content="chrome=1">
<link href='https://fonts.googleapis.com/css?family=Chivo:900' rel='stylesheet' type='text/css'>
<link rel="stylesheet" type="text/css" href="stylesheets/stylesheet.css" media="screen" />
<link rel="stylesheet" type="text/css" href="stylesheets/pygment_trac.css" media="screen" />
<link rel="stylesheet" type="text/css" href="stylesheets/print.css" media="print" />
<!--[if lt IE 9]>
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<title>DlangUI - cross platform GUI library for D programming language - dlangui.core.i18n</title>
</head>
<body>
<div id="container">
<div class="inner">
<header>
<h1>DlangUI</h1>
<h2>Cross Platform GUI for D programming language</h2>
</header>
<section id="downloads" class="clearfix">
<a href="index.html" id="home" class="button"><span>Home</span></a>
<a href="api.html" id="home" class="button"><span>API Docs</span></a>
<a href="https://github.com/buggins/dlangui/zipball/master" id="download-zip" class="button"><span>Download .zip</span></a>
<!--a href="https://github.com/buggins/dlangui/tarball/master" id="download-tar-gz" class="button"><span>Download .tar.gz</span></a-->
<a href="https://github.com/buggins/dlangui" id="view-on-github" class="button"><span>View on GitHub</span></a>
</section>
<hr>
<section id="main_content">
<h1>dlangui.core.i18n</h1>
<!-- Generated by Ddoc from src/dlangui/core/i18n.d -->
This module contains internationalization support implementation.
<br><br>
Translation files contain of simple key=value pair lines.
<br><br>
STRING_RESOURCE_ID=Translation text.
<br><br>
Supports fallback to another translation file (e.g. default language).
<br><br>
<br><br>
<br><br>
<b>Synopsis:</b><br>
<pre class="d_code"><font color=blue>import</font> dlangui.core.<u>i18n</u>;
<font color=green>// use global i18n object to get translation for string ID
</font>dstring translated = <u>i18n</u>.get(<font color=red>"STR_FILE_OPEN"</font>);
<font color=green>// UIString type can hold either string resource id or dstring raw value.
</font>UIString text;
<font color=green>// assign resource id as string
</font>text = <font color=red>"ID_FILE_EXIT"</font>;
<font color=green>// or assign raw value as dstring
</font>text = <font color=red>"some text"d</font>;
<font color=green>// i18n.get() will automatically be invoked when getting UIString value (e.g. using alias this).
</font>dstring translated = text;
</pre>
<br><br>
<b>License:</b><br>
Boost License 1.0
<br><br>
<b>Authors:</b><br>
Vadim Lopatin, coolreader.org@gmail.com<br><br>
<dl><dt><big><a name="UIString"></a>struct <u>UIString</u>;
</big></dt>
<dd>container for UI string - either raw value or string resource ID<br><br>
<dl><dt><big><a name="UIString.this"></a> this(string <i>id</i>);
</big></dt>
<dd>create string with i18n resource <i>id</i><br><br>
</dd>
<dt><big><a name="UIString.this"></a> this(dstring <i>value</i>);
</big></dt>
<dd>create string with raw <i>value</i><br><br>
</dd>
<dt><big><a name="UIString.value"></a>const @property dstring <u>value</u>();
</big></dt>
<dd>get <u>value</u> (either raw or translated by id)<br><br>
</dd>
<dt><big><a name="UIString.value"></a>@property void <u>value</u>(dstring <i>newValue</i>);
</big></dt>
<dd>set raw <u>value</u><br><br>
</dd>
<dt><big><a name="UIString.opAssign"></a>ref UIString <u>opAssign</u>(dstring <i>rawValue</i>);
</big></dt>
<dd>assign raw value<br><br>
</dd>
<dt><big><a name="UIString.opAssign"></a>ref UIString <u>opAssign</u>(string <i>ID</i>);
</big></dt>
<dd>assign <i>ID</i><br><br>
</dd>
</dl>
</dd>
<dt><big><a name="UIStringList"></a>class <u>UIStringList</u>;
</big></dt>
<dd>UI string translator<br><br>
<dl><dt><big><a name="UIStringList.clear"></a>void <u>clear</u>();
</big></dt>
<dd>remove all items<br><br>
</dd>
<dt><big><a name="UIStringList.set"></a>void <u>set</u>(string <i>id</i>, dstring <i>value</i>);
</big></dt>
<dd><u>set</u> item <i>value</i><br><br>
</dd>
<dt><big><a name="UIStringList.get"></a>const dstring <u>get</u>(string <i>id</i>);
</big></dt>
<dd><u>get</u> item value, <b>null</b> if translation is not found for <i>id</i><br><br>
</dd>
<dt><big><a name="UIStringList.load"></a>bool <u>load</u>(std.<i>stream</i>.InputStream <i>stream</i>);
</big></dt>
<dd><u>load</u> strings from <i>stream</i><br><br>
</dd>
<dt><big><a name="UIStringList.load"></a>bool <u>load</u>(string[] <i>filenames</i>);
</big></dt>
<dd><u>load</u> strings from file (utf8, id=value lines)<br><br>
</dd>
</dl>
</dd>
</dl>
</section>
<footer>
Dlangui is maintained by <a href="https://github.com/buggins">buggins</a><br>
This page was generated by <a href="http://pages.github.com">GitHub Pages</a>. Tactile theme by <a href="https://twitter.com/jasonlong">Jason Long</a>.
</footer>
</div>
</div>
</body>
</html>