Extension-Druid/docs/modules/LangText.html
2024-10-19 11:22:24 +03:00

381 lines
12 KiB
HTML

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<head>
<title>Defold Druid UI Framework</title>
<link rel="stylesheet" href="../ldoc_fixed.css" type="text/css" />
</head>
<body>
<div id="container">
<div id="product">
<div id="product_logo"></div>
<div id="product_name"><big><b></b></big></div>
<div id="product_description"></div>
</div> <!-- id="product" -->
<div id="main">
<!-- Menu -->
<div id="navigation">
<br/>
<h1>Druid</h1>
<ul>
<li><a href="../index.html">Index</a></li>
</ul>
<h2>Contents</h2>
<ul>
<li><a href="#Functions">Functions</a></li>
<li><a href="#Fields">Fields</a></li>
</ul>
<h2>Modules</h2>
<ul class="nowrap">
<li><a href="../modules/BackHandler.html">BackHandler</a></li>
<li><a href="../modules/BaseComponent.html">BaseComponent</a></li>
<li><a href="../modules/Blocker.html">Blocker</a></li>
<li><a href="../modules/Button.html">Button</a></li>
<li><a href="../modules/DataList.html">DataList</a></li>
<li><a href="../modules/Drag.html">Drag</a></li>
<li><a href="../modules/Druid.html">Druid</a></li>
<li><a href="../modules/DruidEvent.html">DruidEvent</a></li>
<li><a href="../modules/DruidInstance.html">DruidInstance</a></li>
<li><a href="../modules/DynamicGrid.html">DynamicGrid</a></li>
<li><a href="../modules/Helper.html">Helper</a></li>
<li><a href="../modules/Hotkey.html">Hotkey</a></li>
<li><a href="../modules/Hover.html">Hover</a></li>
<li><a href="../modules/Input.html">Input</a></li>
<li><strong>LangText</strong></li>
<li><a href="../modules/Layout.html">Layout</a></li>
<li><a href="../modules/Progress.html">Progress</a></li>
<li><a href="../modules/RichInput.html">RichInput</a></li>
<li><a href="../modules/RichText.html">RichText</a></li>
<li><a href="../modules/Scroll.html">Scroll</a></li>
<li><a href="../modules/Slider.html">Slider</a></li>
<li><a href="../modules/StaticGrid.html">StaticGrid</a></li>
<li><a href="../modules/Swipe.html">Swipe</a></li>
<li><a href="../modules/Text.html">Text</a></li>
<li><a href="../modules/Timer.html">Timer</a></li>
</ul>
</div>
<div id="content">
<h1>Module <code>LangText</code></h1>
<p>Component to wrap over GUI Text nodes with localization helpers
<p> <b># Overview #</b>
<p> • The initialization of druid.set_text_function is required to enable localization
using the localization ID.</p>
<p>
<p> • The LangText component supports up to 7 string format parameters.
This limitation exists due to certain issues with using ... arguments.
<p> <b># Notes #</b>
<p> <a href="https://insality.github.io/druid/druid/index.html?example=texts_lang_text" target="_blank"><b>Example Link</b></a></p>
<h2><a href="#Functions">Functions</a></h2>
<table class="function_list">
<tr>
<td class="name" nowrap><a href="#format">format(self, a, b, c, d, e, f, g)</a></td>
<td class="summary">Format string with new text params on localized text</td>
</tr>
<tr>
<td class="name" nowrap><a href="#init">init(self, node, locale_id, adjust_type)</a></td>
<td class="summary">The <a href="../modules/LangText.html#">LangText</a> constructor</td>
</tr>
<tr>
<td class="name" nowrap><a href="#set_to">set_to(self, text)</a></td>
<td class="summary">Setup raw text to lang_text component</td>
</tr>
<tr>
<td class="name" nowrap><a href="#translate">translate(self, locale_id, a, b, c, d, e, f, g)</a></td>
<td class="summary">Translate the text by locale_id</td>
</tr>
</table>
<h2><a href="#Fields">Fields</a></h2>
<table class="function_list">
<tr>
<td class="name" nowrap><a href="#node">node</a></td>
<td class="summary">Text node</td>
</tr>
<tr>
<td class="name" nowrap><a href="#on_change">on_change</a></td>
<td class="summary">On change text callback</td>
</tr>
<tr>
<td class="name" nowrap><a href="#text">text</a></td>
<td class="summary">The text component</td>
</tr>
</table>
<br/>
<br/>
<h2 class="section-header "><a name="Functions"></a>Functions</h2>
<dl class="function">
<dt>
<a name = "format"></a>
<strong>format(self, a, b, c, d, e, f, g)</strong>
</dt>
<dd>
Format string with new text params on localized text
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">LangText</span></span>
<a href="../modules/LangText.html#">LangText</a>
</li>
<li><span class="parameter">a</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a> or <span class="type">nil</span></span>
Optional param to string.format
</li>
<li><span class="parameter">b</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a> or <span class="type">nil</span></span>
Optional param to string.format
</li>
<li><span class="parameter">c</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a> or <span class="type">nil</span></span>
Optional param to string.format
</li>
<li><span class="parameter">d</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a> or <span class="type">nil</span></span>
Optional param to string.format
</li>
<li><span class="parameter">e</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a> or <span class="type">nil</span></span>
Optional param to string.format
</li>
<li><span class="parameter">f</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a> or <span class="type">nil</span></span>
Optional param to string.format
</li>
<li><span class="parameter">g</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a> or <span class="type">nil</span></span>
Optional param to string.format
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">LangText</span></span>
Current instance
</ol>
</dd>
<dt>
<a name = "init"></a>
<strong>init(self, node, locale_id, adjust_type)</strong>
</dt>
<dd>
The <a href="../modules/LangText.html#">LangText</a> constructor
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">LangText</span></span>
<a href="../modules/LangText.html#">LangText</a>
</li>
<li><span class="parameter">node</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a> or <a class="type" href="../modules/LangText.html#node">node</a></span>
The node_id or gui.get_node(node_id)
</li>
<li><span class="parameter">locale_id</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a> or <span class="type">nil</span></span>
Default locale id or text from node as default
</li>
<li><span class="parameter">adjust_type</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a> or <span class="type">nil</span></span>
Adjust type for text. By default is DOWNSCALE. Look const.TEXT_ADJUST for reference
</li>
</ul>
</dd>
<dt>
<a name = "set_to"></a>
<strong>set_to(self, text)</strong>
</dt>
<dd>
Setup raw text to lang_text component
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">LangText</span></span>
<a href="../modules/LangText.html#">LangText</a>
</li>
<li><span class="parameter">text</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
Text for text node
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">LangText</span></span>
Current instance
</ol>
</dd>
<dt>
<a name = "translate"></a>
<strong>translate(self, locale_id, a, b, c, d, e, f, g)</strong>
</dt>
<dd>
Translate the text by locale_id
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">LangText</span></span>
<a href="../modules/LangText.html#">LangText</a>
</li>
<li><span class="parameter">locale_id</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
Locale id
</li>
<li><span class="parameter">a</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a> or <span class="type">nil</span></span>
Optional param to string.format
</li>
<li><span class="parameter">b</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a> or <span class="type">nil</span></span>
Optional param to string.format
</li>
<li><span class="parameter">c</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a> or <span class="type">nil</span></span>
Optional param to string.format
</li>
<li><span class="parameter">d</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a> or <span class="type">nil</span></span>
Optional param to string.format
</li>
<li><span class="parameter">e</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a> or <span class="type">nil</span></span>
Optional param to string.format
</li>
<li><span class="parameter">f</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a> or <span class="type">nil</span></span>
Optional param to string.format
</li>
<li><span class="parameter">g</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a> or <span class="type">nil</span></span>
Optional param to string.format
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">LangText</span></span>
Current instance
</ol>
</dd>
</dl>
<h2 class="section-header "><a name="Fields"></a>Fields</h2>
<dl class="function">
<dt>
<a name = "node"></a>
<strong>node</strong>
</dt>
<dd>
Text node
<ul>
<li><span class="parameter">node</span>
<span class="types"><a class="type" href="../modules/LangText.html#node">node</a></span>
</li>
</ul>
</dd>
<dt>
<a name = "on_change"></a>
<strong>on_change</strong>
</dt>
<dd>
On change text callback
<ul>
<li><span class="parameter">on_change</span>
<span class="types"><span class="type">DruidEvent</span></span>
<a href="../modules/DruidEvent.html#">DruidEvent</a>
</li>
</ul>
</dd>
<dt>
<a name = "text"></a>
<strong>text</strong>
</dt>
<dd>
The text component
<ul>
<li><span class="parameter">text</span>
<span class="types"><span class="type">Text</span></span>
<a href="../modules/Text.html#">Text</a>
</li>
</ul>
</dd>
</dl>
</div> <!-- id="content" -->
</div> <!-- id="main" -->
<div id="about">
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc TESTING</a></i>
<i style="float:right;">Last updated 2015-01-01 12:00:00 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>
</html>