123 lines
34 KiB
HTML
123 lines
34 KiB
HTML
<!DOCTYPE html><html class="default"><head><meta charSet="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>Translations | @maxgraph/core</title><meta name="description" content="Documentation for @maxgraph/core"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="../assets/style.css"/><link rel="stylesheet" href="../assets/highlight.css"/><script async src="../assets/search.js" id="search-script"></script></head><body><script>document.body.classList.add(localStorage.getItem("tsd-theme") || "os")</script><header><div class="tsd-page-toolbar"><div class="container"><div class="table-wrap"><div class="table-cell" id="tsd-search" data-base=".."><div class="field"><label for="tsd-search-field" class="tsd-widget search no-caption">Search</label><input type="text" id="tsd-search-field"/></div><ul class="results"><li class="state loading">Preparing search index...</li><li class="state failure">The search index is not available</li></ul><a href="../index.html" class="title">@maxgraph/core</a></div><div class="table-cell" id="tsd-widgets"><div id="tsd-filter"><a href="#" class="tsd-widget options no-caption" data-toggle="options">Options</a><div class="tsd-filter-group"><div class="tsd-select" id="tsd-filter-visibility"><span class="tsd-select-label">All</span><ul class="tsd-select-list"><li data-value="public">Public</li><li data-value="protected">Public/Protected</li><li data-value="private" class="selected">All</li></ul></div> <input type="checkbox" id="tsd-filter-inherited" checked/><label class="tsd-widget" for="tsd-filter-inherited">Inherited</label></div></div><a href="#" class="tsd-widget menu no-caption" data-toggle="menu">Menu</a></div></div></div></div><div class="tsd-page-title"><div class="container"><ul class="tsd-breadcrumb"><li><a href="../index.html">@maxgraph/core</a></li><li><a href="Translations.html">Translations</a></li></ul><h1>Class Translations</h1></div></div></header><div class="container container-main"><div class="row"><div class="col-8 col-content"><section class="tsd-panel tsd-comment"><div class="tsd-comment tsd-typography"><div class="lead">
|
|
<p>Implements internationalization. You can provide any number of
|
|
resource files on the server using the following format for the
|
|
filename: name[-en].properties. The en stands for any lowercase
|
|
2-character language shortcut (eg. de for german, fr for french).</p>
|
|
</div><div><p>If the optional language extension is omitted, then the file is used as a
|
|
default resource which is loaded in all cases. If a properties file for a
|
|
specific language exists, then it is used to override the settings in the
|
|
default resource. All entries in the file are of the form key=value. The
|
|
values may then be accessed in code via <get>. Lines without
|
|
equal signs in the properties files are ignored.</p>
|
|
<p>Resource files may either be added programmatically using
|
|
<add> or via a resource tag in the UI section of the
|
|
editor configuration file, eg:</p>
|
|
<pre><code class="language-javascript"><span class="hl-11"><</span><span class="hl-10">Editor</span><span class="hl-11">></span><br/><span class="hl-1"> </span><span class="hl-11"><</span><span class="hl-12">ui</span><span class="hl-11">></span><br/><span class="hl-1"> </span><span class="hl-11"><</span><span class="hl-12">resource</span><span class="hl-1"> </span><span class="hl-13">basename</span><span class="hl-1">=</span><span class="hl-6">"examples/resources/mxWorkflow"</span><span class="hl-11">/></span>
|
|
</code></pre>
|
|
<p>The above element will load examples/resources/mxWorkflow.properties as well
|
|
as the language specific file for the current language, if it exists.</p>
|
|
<p>Values may contain placeholders of the form {1}...{n} where each placeholder
|
|
is replaced with the value of the corresponding array element in the params
|
|
argument passed to {@link Resources#get}. The placeholder {1} maps to the first
|
|
element in the array (at index 0).</p>
|
|
<p>See <Client.language> for more information on specifying the default
|
|
language or disabling all loading of resources.</p>
|
|
<p>Lines that start with a # sign will be ignored.</p>
|
|
<p>Special characters</p>
|
|
<p>To use unicode characters, use the standard notation (eg. \u8fd1) or %u as a
|
|
prefix (eg. %u20AC will display a Euro sign). For normal hex encoded strings,
|
|
use % as a prefix, eg. %F6 will display a "o umlaut" (ö).</p>
|
|
<p>See <resourcesEncoded> to disable this. If you disable this, make sure that
|
|
your files are UTF-8 encoded.</p>
|
|
<p>Asynchronous loading</p>
|
|
<p>By default, the core adds two resource files synchronously at load time.
|
|
To load these files asynchronously, set {@link LoadResources} to false
|
|
before loading Client.js and use {@link Resources#loadResources} instead.</p>
|
|
</div></div></section><section class="tsd-panel tsd-hierarchy"><h3>Hierarchy</h3><ul class="tsd-hierarchy"><li><span class="target">Translations</span></li></ul></section><section class="tsd-panel-group tsd-index-group"><h2>Index</h2><section class="tsd-panel tsd-index-panel"><div class="tsd-index-content"><section class="tsd-index-section "><h3>Constructors</h3><ul class="tsd-index-list"><li class="tsd-kind-constructor tsd-parent-kind-class"><a href="Translations.html#constructor" class="tsd-kind-icon">constructor</a></li></ul></section><section class="tsd-index-section "><h3>Properties</h3><ul class="tsd-index-list"><li class="tsd-kind-property tsd-parent-kind-class tsd-is-static"><a href="Translations.html#extension" class="tsd-kind-icon">extension</a></li><li class="tsd-kind-property tsd-parent-kind-class tsd-is-static"><a href="Translations.html#loadDefaultBundle" class="tsd-kind-icon">load<wbr/>Default<wbr/>Bundle</a></li><li class="tsd-kind-property tsd-parent-kind-class tsd-is-static"><a href="Translations.html#loadSpecialBundle" class="tsd-kind-icon">load<wbr/>Special<wbr/>Bundle</a></li><li class="tsd-kind-property tsd-parent-kind-class tsd-is-static"><a href="Translations.html#resources" class="tsd-kind-icon">resources</a></li><li class="tsd-kind-property tsd-parent-kind-class tsd-is-static"><a href="Translations.html#resourcesEncoded" class="tsd-kind-icon">resources<wbr/>Encoded</a></li></ul></section><section class="tsd-index-section "><h3>Methods</h3><ul class="tsd-index-list"><li class="tsd-kind-method tsd-parent-kind-class tsd-is-static"><a href="Translations.html#add" class="tsd-kind-icon">add</a></li><li class="tsd-kind-method tsd-parent-kind-class tsd-is-static"><a href="Translations.html#get" class="tsd-kind-icon">get</a></li><li class="tsd-kind-method tsd-parent-kind-class tsd-is-static"><a href="Translations.html#getDefaultBundle" class="tsd-kind-icon">get<wbr/>Default<wbr/>Bundle</a></li><li class="tsd-kind-method tsd-parent-kind-class tsd-is-static"><a href="Translations.html#getSpecialBundle" class="tsd-kind-icon">get<wbr/>Special<wbr/>Bundle</a></li><li class="tsd-kind-method tsd-parent-kind-class tsd-is-static"><a href="Translations.html#isLanguageSupported" class="tsd-kind-icon">is<wbr/>Language<wbr/>Supported</a></li><li class="tsd-kind-method tsd-parent-kind-class tsd-is-static"><a href="Translations.html#loadResources" class="tsd-kind-icon">load<wbr/>Resources</a></li><li class="tsd-kind-method tsd-parent-kind-class tsd-is-static"><a href="Translations.html#parse" class="tsd-kind-icon">parse</a></li><li class="tsd-kind-method tsd-parent-kind-class tsd-is-static"><a href="Translations.html#replacePlaceholders" class="tsd-kind-icon">replace<wbr/>Placeholders</a></li></ul></section></div></section></section><section class="tsd-panel-group tsd-member-group "><h2>Constructors</h2><section class="tsd-panel tsd-member tsd-kind-constructor tsd-parent-kind-class"><a id="constructor" class="tsd-anchor"></a><h3>constructor</h3><ul class="tsd-signatures tsd-kind-constructor tsd-parent-kind-class"><li class="tsd-signature tsd-kind-icon">new <wbr/>Translations<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="Translations.html" class="tsd-signature-type" data-tsd-kind="Class">Translations</a></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><h4 class="tsd-returns-title">Returns <a href="Translations.html" class="tsd-signature-type" data-tsd-kind="Class">Translations</a></h4></li></ul></section></section><section class="tsd-panel-group tsd-member-group "><h2>Properties</h2><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class tsd-is-static"><a id="extension" class="tsd-anchor"></a><h3><span class="tsd-flag ts-flagStatic">Static</span> extension</h3><div class="tsd-signature tsd-kind-icon">extension<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> = '.txt'</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/maxgraph/maxgraph/blob/598b60e2f/packages/core/src/util/Translations.ts#L69">util/Translations.ts:69</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
|
|
<p>Specifies the extension used for language files. Default is {@link ResourceExtension}.</p>
|
|
</div></div></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class tsd-is-static"><a id="loadDefaultBundle" class="tsd-anchor"></a><h3><span class="tsd-flag ts-flagStatic">Static</span> load<wbr/>Default<wbr/>Bundle</h3><div class="tsd-signature tsd-kind-icon">load<wbr/>Default<wbr/>Bundle<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol"> = true</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/maxgraph/maxgraph/blob/598b60e2f/packages/core/src/util/Translations.ts#L81">util/Translations.ts:81</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
|
|
<p>Specifies if the default file for a given basename should be loaded.
|
|
Default is true.</p>
|
|
</div></div></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class tsd-is-static"><a id="loadSpecialBundle" class="tsd-anchor"></a><h3><span class="tsd-flag ts-flagStatic">Static</span> load<wbr/>Special<wbr/>Bundle</h3><div class="tsd-signature tsd-kind-icon">load<wbr/>Special<wbr/>Bundle<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol"> = true</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/maxgraph/maxgraph/blob/598b60e2f/packages/core/src/util/Translations.ts#L87">util/Translations.ts:87</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
|
|
<p>Specifies if the specific language file file for a given basename should
|
|
be loaded. Default is true.</p>
|
|
</div></div></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class tsd-is-static"><a id="resources" class="tsd-anchor"></a><h3><span class="tsd-flag ts-flagStatic">Static</span> resources</h3><div class="tsd-signature tsd-kind-icon">resources<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">{}</span><span class="tsd-signature-symbol"> = {}</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/maxgraph/maxgraph/blob/598b60e2f/packages/core/src/util/Translations.ts#L64">util/Translations.ts:64</a></li></ul></aside><div class="tsd-type-declaration"><h4>Type declaration</h4><ul class="tsd-parameters"><li class="tsd-parameter-index-signature"><h5><span class="tsd-signature-symbol">[</span>key: <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">]: </span><span class="tsd-signature-type">string</span></h5></li></ul></div></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class tsd-is-static"><a id="resourcesEncoded" class="tsd-anchor"></a><h3><span class="tsd-flag ts-flagStatic">Static</span> resources<wbr/>Encoded</h3><div class="tsd-signature tsd-kind-icon">resources<wbr/>Encoded<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol"> = false</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/maxgraph/maxgraph/blob/598b60e2f/packages/core/src/util/Translations.ts#L75">util/Translations.ts:75</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
|
|
<p>Specifies whether or not values in resource files are encoded with \u or
|
|
percentage. Default is false.</p>
|
|
</div></div></section></section><section class="tsd-panel-group tsd-member-group "><h2>Methods</h2><section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-static"><a id="add" class="tsd-anchor"></a><h3><span class="tsd-flag ts-flagStatic">Static</span> add</h3><ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-is-static"><li class="tsd-signature tsd-kind-icon">add<span class="tsd-signature-symbol">(</span>basename<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span>, lan<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">string</span>, callback<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">Function</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/maxgraph/maxgraph/blob/598b60e2f/packages/core/src/util/Translations.ts#L175">util/Translations.ts:175</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
|
|
<p>Adds the default and current language properties file for the specified
|
|
basename. Existing keys are overridden as new files are added. If no
|
|
callback is used then the request is synchronous.</p>
|
|
</div><div><p>Example:</p>
|
|
<p>At application startup, additional resources may be
|
|
added using the following code:</p>
|
|
<pre><code class="language-javascript"><span class="hl-0">mxResources</span><span class="hl-1">.</span><span class="hl-2">add</span><span class="hl-1">(</span><span class="hl-6">'resources/editor'</span><span class="hl-1">);</span>
|
|
</code></pre>
|
|
</div></div><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5>basename: <span class="tsd-signature-type">string</span></h5><div class="tsd-comment tsd-typography"><div class="lead">
|
|
<p>The basename for which the file should be loaded.</p>
|
|
</div></div></li><li><h5>lan: <span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> = null</span></h5><div class="tsd-comment tsd-typography"><div class="lead">
|
|
<p>The language for which the file should be loaded.</p>
|
|
</div></div></li><li><h5>callback: <span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">Function</span><span class="tsd-signature-symbol"> = null</span></h5><div class="tsd-comment tsd-typography"><div class="lead">
|
|
<p>Optional callback for asynchronous loading.</p>
|
|
</div></div></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4></li></ul></section><section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-static"><a id="get" class="tsd-anchor"></a><h3><span class="tsd-flag ts-flagStatic">Static</span> get</h3><ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-is-static"><li class="tsd-signature tsd-kind-icon">get<span class="tsd-signature-symbol">(</span>key<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span>, params<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">[]</span>, defaultValue<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">string</span></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/maxgraph/maxgraph/blob/598b60e2f/packages/core/src/util/Translations.ts#L305">util/Translations.ts:305</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
|
|
<p>Returns the value for the specified resource key.</p>
|
|
</div><div><p>Example:
|
|
To read the value for 'welomeMessage', use the following:</p>
|
|
<pre><code class="language-javascript"><span class="hl-3">let</span><span class="hl-1"> </span><span class="hl-0">result</span><span class="hl-1"> = </span><span class="hl-0">mxResources</span><span class="hl-1">.</span><span class="hl-2">get</span><span class="hl-1">(</span><span class="hl-6">'welcomeMessage'</span><span class="hl-1">) || </span><span class="hl-6">''</span><span class="hl-1">;</span>
|
|
</code></pre>
|
|
<p>This would require an entry of the following form in
|
|
one of the English language resource files:</p>
|
|
<pre><code class="language-javascript"><span class="hl-0">welcomeMessage</span><span class="hl-1">=</span><span class="hl-0">Welcome</span><span class="hl-1"> </span><span class="hl-0">to</span><span class="hl-1"> </span><span class="hl-0">mxGraph</span><span class="hl-1">!</span>
|
|
</code></pre>
|
|
<p>The part behind the || is the string value to be used if the given
|
|
resource is not available.</p>
|
|
</div></div><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5>key: <span class="tsd-signature-type">string</span></h5><div class="tsd-comment tsd-typography"><div class="lead">
|
|
<p>String that represents the key of the resource to be returned.</p>
|
|
</div></div></li><li><h5>params: <span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol"> = null</span></h5><div class="tsd-comment tsd-typography"><div class="lead">
|
|
<p>Array of the values for the placeholders of the form {1}...{n}
|
|
to be replaced with in the resulting string.</p>
|
|
</div></div></li><li><h5>defaultValue: <span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> = null</span></h5><div class="tsd-comment tsd-typography"><div class="lead">
|
|
<p>Optional string that specifies the default return value.</p>
|
|
</div></div></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">string</span></h4></li></ul></section><section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-static"><a id="getDefaultBundle" class="tsd-anchor"></a><h3><span class="tsd-flag ts-flagStatic">Static</span> get<wbr/>Default<wbr/>Bundle</h3><ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-is-static"><li class="tsd-signature tsd-kind-icon">get<wbr/>Default<wbr/>Bundle<span class="tsd-signature-symbol">(</span>basename<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span>, lan<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">string</span></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/maxgraph/maxgraph/blob/598b60e2f/packages/core/src/util/Translations.ts#L110">util/Translations.ts:110</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
|
|
<p>Hook for subclassers to return the URL for the special bundle. This
|
|
implementation returns basename + <extension> or null if
|
|
<loadDefaultBundle> is false.</p>
|
|
</div></div><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5>basename: <span class="tsd-signature-type">string</span></h5><div class="tsd-comment tsd-typography"><div class="lead">
|
|
<p>The basename for which the file should be loaded.</p>
|
|
</div></div></li><li><h5>lan: <span class="tsd-signature-type">string</span></h5><div class="tsd-comment tsd-typography"><div class="lead">
|
|
<p>The current language.</p>
|
|
</div></div></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">string</span></h4></li></ul></section><section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-static"><a id="getSpecialBundle" class="tsd-anchor"></a><h3><span class="tsd-flag ts-flagStatic">Static</span> get<wbr/>Special<wbr/>Bundle</h3><ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-is-static"><li class="tsd-signature tsd-kind-icon">get<wbr/>Special<wbr/>Bundle<span class="tsd-signature-symbol">(</span>basename<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span>, lan<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">string</span></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/maxgraph/maxgraph/blob/598b60e2f/packages/core/src/util/Translations.ts#L136">util/Translations.ts:136</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
|
|
<p>Hook for subclassers to return the URL for the special bundle. This
|
|
implementation returns basename + '_' + lan + <extension> or null if
|
|
<loadSpecialBundle> is false or lan equals <Client.defaultLanguage>.</p>
|
|
</div><div><p>If {@link Resources#languages} is not null and <Client.language> contains
|
|
a dash, then this method checks if <isLanguageSupported> returns true
|
|
for the full language (including the dash). If that returns false the
|
|
first part of the language (up to the dash) will be tried as an extension.</p>
|
|
<p>If {@link Resources#language} is null then the first part of the language is
|
|
used to maintain backwards compatibility.</p>
|
|
</div></div><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5>basename: <span class="tsd-signature-type">string</span></h5><div class="tsd-comment tsd-typography"><div class="lead">
|
|
<p>The basename for which the file should be loaded.</p>
|
|
</div></div></li><li><h5>lan: <span class="tsd-signature-type">string</span></h5><div class="tsd-comment tsd-typography"><div class="lead">
|
|
<p>The language for which the file should be loaded.</p>
|
|
</div></div></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">string</span></h4></li></ul></section><section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-static"><a id="isLanguageSupported" class="tsd-anchor"></a><h3><span class="tsd-flag ts-flagStatic">Static</span> is<wbr/>Language<wbr/>Supported</h3><ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-is-static"><li class="tsd-signature tsd-kind-icon">is<wbr/>Language<wbr/>Supported<span class="tsd-signature-symbol">(</span>lan<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">boolean</span></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/maxgraph/maxgraph/blob/598b60e2f/packages/core/src/util/Translations.ts#L95">util/Translations.ts:95</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
|
|
<p>Hook for subclassers to disable support for a given language. This
|
|
implementation returns true if lan is in <Client.languages>.</p>
|
|
</div></div><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5>lan: <span class="tsd-signature-type">string</span></h5><div class="tsd-comment tsd-typography"><div class="lead">
|
|
<p>The current language.</p>
|
|
</div></div></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">boolean</span></h4></li></ul></section><section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-static"><a id="loadResources" class="tsd-anchor"></a><h3><span class="tsd-flag ts-flagStatic">Static</span> load<wbr/>Resources</h3><ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-is-static"><li class="tsd-signature tsd-kind-icon">load<wbr/>Resources<span class="tsd-signature-symbol">(</span>callback<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Function</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/maxgraph/maxgraph/blob/598b60e2f/packages/core/src/util/Translations.ts#L360">util/Translations.ts:360</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
|
|
<p>Loads all required resources asynchronously. Use this to load the graph and
|
|
editor resources if {@link LoadResources} is false.</p>
|
|
</div></div><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5>callback: <span class="tsd-signature-type">Function</span></h5><div class="tsd-comment tsd-typography"><div class="lead">
|
|
<p>Callback function for asynchronous loading.</p>
|
|
</div></div></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4></li></ul></section><section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-static"><a id="parse" class="tsd-anchor"></a><h3><span class="tsd-flag ts-flagStatic">Static</span> parse</h3><ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-is-static"><li class="tsd-signature tsd-kind-icon">parse<span class="tsd-signature-symbol">(</span>text<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/maxgraph/maxgraph/blob/598b60e2f/packages/core/src/util/Translations.ts#L252">util/Translations.ts:252</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
|
|
<p>Parses the key, value pairs in the specified
|
|
text and stores them as local resources.</p>
|
|
</div></div><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5>text: <span class="tsd-signature-type">string</span></h5></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4></li></ul></section><section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-static"><a id="replacePlaceholders" class="tsd-anchor"></a><h3><span class="tsd-flag ts-flagStatic">Static</span> replace<wbr/>Placeholders</h3><ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-is-static"><li class="tsd-signature tsd-kind-icon">replace<wbr/>Placeholders<span class="tsd-signature-symbol">(</span>value<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span>, params<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/maxgraph/maxgraph/blob/598b60e2f/packages/core/src/util/Translations.ts#L327">util/Translations.ts:327</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
|
|
<p>Replaces the given placeholders with the given parameters.</p>
|
|
</div></div><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5>value: <span class="tsd-signature-type">string</span></h5><div class="tsd-comment tsd-typography"><div class="lead">
|
|
<p>String that contains the placeholders.</p>
|
|
</div></div></li><li><h5>params: <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">[]</span></h5><div class="tsd-comment tsd-typography"><div class="lead">
|
|
<p>Array of the values for the placeholders of the form {1}...{n}
|
|
to be replaced with in the resulting string.</p>
|
|
</div></div></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">string</span></h4></li></ul></section></section></div><div class="col-4 col-menu menu-sticky-wrap menu-highlight"><nav class="tsd-navigation primary"><ul><li class=""><a href="../index.html">Exports</a></li><li class=" tsd-kind-namespace"><a href="../modules/DomHelpers.html">Dom<wbr/>Helpers</a></li><li class=" tsd-kind-namespace"><a href="../modules/cloneUtils.html">clone<wbr/>Utils</a></li><li class=" tsd-kind-namespace"><a href="../modules/constants.html">constants</a></li><li class=" tsd-kind-namespace"><a href="../modules/domUtils.html">dom<wbr/>Utils</a></li><li class=" tsd-kind-namespace"><a href="../modules/eventUtils.html">event<wbr/>Utils</a></li><li class=" tsd-kind-namespace"><a href="../modules/gestureUtils.html">gesture<wbr/>Utils</a></li><li class=" tsd-kind-namespace"><a href="../modules/mathUtils.html">math<wbr/>Utils</a></li><li class=" tsd-kind-namespace"><a href="../modules/stringUtils.html">string<wbr/>Utils</a></li><li class=" tsd-kind-namespace"><a href="../modules/styleUtils.html">style<wbr/>Utils</a></li><li class=" tsd-kind-namespace"><a href="../modules/utils.html">utils</a></li><li class=" tsd-kind-namespace"><a href="../modules/xmlUtils.html">xml<wbr/>Utils</a></li></ul></nav><nav class="tsd-navigation secondary menu-sticky"><ul><li class="current tsd-kind-class"><a href="Translations.html" class="tsd-kind-icon">Translations</a><ul><li class="tsd-kind-constructor tsd-parent-kind-class"><a href="Translations.html#constructor" class="tsd-kind-icon">constructor</a></li><li class="tsd-kind-property tsd-parent-kind-class tsd-is-static"><a href="Translations.html#extension" class="tsd-kind-icon">extension</a></li><li class="tsd-kind-property tsd-parent-kind-class tsd-is-static"><a href="Translations.html#loadDefaultBundle" class="tsd-kind-icon">load<wbr/>Default<wbr/>Bundle</a></li><li class="tsd-kind-property tsd-parent-kind-class tsd-is-static"><a href="Translations.html#loadSpecialBundle" class="tsd-kind-icon">load<wbr/>Special<wbr/>Bundle</a></li><li class="tsd-kind-property tsd-parent-kind-class tsd-is-static"><a href="Translations.html#resources" class="tsd-kind-icon">resources</a></li><li class="tsd-kind-property tsd-parent-kind-class tsd-is-static"><a href="Translations.html#resourcesEncoded" class="tsd-kind-icon">resources<wbr/>Encoded</a></li><li class="tsd-kind-method tsd-parent-kind-class tsd-is-static"><a href="Translations.html#add" class="tsd-kind-icon">add</a></li><li class="tsd-kind-method tsd-parent-kind-class tsd-is-static"><a href="Translations.html#get" class="tsd-kind-icon">get</a></li><li class="tsd-kind-method tsd-parent-kind-class tsd-is-static"><a href="Translations.html#getDefaultBundle" class="tsd-kind-icon">get<wbr/>Default<wbr/>Bundle</a></li><li class="tsd-kind-method tsd-parent-kind-class tsd-is-static"><a href="Translations.html#getSpecialBundle" class="tsd-kind-icon">get<wbr/>Special<wbr/>Bundle</a></li><li class="tsd-kind-method tsd-parent-kind-class tsd-is-static"><a href="Translations.html#isLanguageSupported" class="tsd-kind-icon">is<wbr/>Language<wbr/>Supported</a></li><li class="tsd-kind-method tsd-parent-kind-class tsd-is-static"><a href="Translations.html#loadResources" class="tsd-kind-icon">load<wbr/>Resources</a></li><li class="tsd-kind-method tsd-parent-kind-class tsd-is-static"><a href="Translations.html#parse" class="tsd-kind-icon">parse</a></li><li class="tsd-kind-method tsd-parent-kind-class tsd-is-static"><a href="Translations.html#replacePlaceholders" class="tsd-kind-icon">replace<wbr/>Placeholders</a></li></ul></li></ul></nav></div></div></div><footer class="with-border-bottom"><div class="container"><h2>Legend</h2><div class="tsd-legend-group"><ul class="tsd-legend"><li class="tsd-kind-constructor tsd-parent-kind-class"><span class="tsd-kind-icon">Constructor</span></li><li class="tsd-kind-property tsd-parent-kind-class"><span class="tsd-kind-icon">Property</span></li><li class="tsd-kind-method tsd-parent-kind-class"><span class="tsd-kind-icon">Method</span></li><li class="tsd-kind-accessor tsd-parent-kind-class"><span class="tsd-kind-icon">Accessor</span></li></ul><ul class="tsd-legend"><li class="tsd-kind-property tsd-parent-kind-class tsd-is-inherited"><span class="tsd-kind-icon">Inherited property</span></li><li class="tsd-kind-method tsd-parent-kind-class tsd-is-inherited"><span class="tsd-kind-icon">Inherited method</span></li><li class="tsd-kind-accessor tsd-parent-kind-class tsd-is-inherited"><span class="tsd-kind-icon">Inherited accessor</span></li></ul><ul class="tsd-legend"><li class="tsd-kind-property tsd-parent-kind-class tsd-is-static"><span class="tsd-kind-icon">Static property</span></li><li class="tsd-kind-method tsd-parent-kind-class tsd-is-static"><span class="tsd-kind-icon">Static method</span></li></ul></div><h2>Settings</h2><p>Theme <select id="theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></p></div></footer><div class="container tsd-generator"><p>Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p></div><div class="overlay"></div><script src="../assets/main.js"></script></body></html> |