261 lines
15 KiB
HTML
261 lines
15 KiB
HTML
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
<html xmlns="http://www.w3.org/1999/xhtml"><!-- InstanceBegin template="/Templates/BasicTemplate.dwt" codeOutsideHTMLIsLocked="false" -->
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
|
<!-- InstanceBeginEditable name="doctitle" -->
|
|
<title>Rewired Documentation | Localization</title>
|
|
<!-- InstanceEndEditable -->
|
|
<!-- InstanceParam name="isRoot" type="boolean" value="false" -->
|
|
<!-- InstanceParam name="wide" type="boolean" value="false" -->
|
|
<link href="files/css/styles.css" rel="stylesheet" type="text/css" />
|
|
<!-- Favicons -->
|
|
<link rel="icon" type="image/x-icon" href="/projects/rewired/files/images/favicon.ico?v=1" />
|
|
<!-- Apple Icons -->
|
|
<!-- For iPad with high-resolution Retina display running iOS = 7: -->
|
|
<link rel="apple-touch-icon-precomposed" sizes="152x152" href="files/images/favicon_152x152.png?v=1">
|
|
<!-- For iPad with high-resolution Retina display running iOS = 6: -->
|
|
<link rel="apple-touch-icon-precomposed" sizes="144x144" href="files/images/favicon_144x144.png?v=1">
|
|
<!-- For iPhone with high-resolution Retina display running iOS = 7: -->
|
|
<link rel="apple-touch-icon-precomposed" sizes="120x120" href="files/images/favicon_120x120.png?v=1">
|
|
<!-- For iPhone with high-resolution Retina display running iOS = 6: -->
|
|
<link rel="apple-touch-icon-precomposed" sizes="114x114" href="files/images/favicon_114x114.png?v=1">
|
|
<!-- For the iPad mini and the first- and second-generation iPad on iOS = 7: -->
|
|
<link rel="apple-touch-icon-precomposed" sizes="76x76" href="files/images/favicon_76x76.png?v=1">
|
|
<!-- For the iPad mini and the first- and second-generation iPad on iOS = 6: -->
|
|
<link rel="apple-touch-icon-precomposed" sizes="72x72" href="files/images/favicon_72x72.png?v=1">
|
|
<!-- For non-Retina iPhone, iPod Touch, and Android 2.1+ devices: -->
|
|
<link rel="apple-touch-icon-precomposed" href="files/images/favicon_57x57.png?v=1">
|
|
</head>
|
|
|
|
<body>
|
|
|
|
|
|
<div class="container">
|
|
|
|
<div class="google-search-bar">
|
|
<script>
|
|
(function() {
|
|
var cx = '007961148920562332911:oocvtwz5jce';
|
|
var gcse = document.createElement('script');
|
|
gcse.type = 'text/javascript';
|
|
gcse.async = true;
|
|
gcse.src = 'https://cse.google.com/cse.js?cx=' + cx;
|
|
var s = document.getElementsByTagName('script')[0];
|
|
s.parentNode.insertBefore(gcse, s);
|
|
})();
|
|
</script>
|
|
<gcse:search></gcse:search>
|
|
</div>
|
|
|
|
<div class="content">
|
|
|
|
|
|
|
|
<div class="page-body">
|
|
|
|
|
|
|
|
|
|
<div class="sidebar-nav">
|
|
<h4><a href="Documentation.html">Documentation</a></h4>
|
|
<ul>
|
|
<li><a href="Overview.html">Overview</a></li>
|
|
<li><a href="ReleaseNotes.txt">Release Notes</a></li>
|
|
</ul>
|
|
<strong>Essentials:</strong>
|
|
<ol>
|
|
<li><a href="Installation.html">Installation</a></li>
|
|
<li><a href="QuickStart.html">Quick Start</a></li>
|
|
<li><a href="BasicUsage.html">Basic Usage</a></li>
|
|
<li><a href="Deployment.html">Deployment</a></li>
|
|
<li><a href="BestPractices.html">Best Practices</a></li>
|
|
<li><a href="RewiredEditor.html">Rewired Editor</a></li>
|
|
<li><a href="http://guavaman.com/projects/rewired/docs/api-reference" target="_blank">API Reference</a></li>
|
|
</ol>
|
|
<strong>Concepts:</strong>
|
|
<ul>
|
|
<li><a href="InputManager.html">Input Manager</a></li>
|
|
<li><a href="Players.html">Players</a></li>
|
|
<li><a href="Actions.html">Actions</a></li>
|
|
<li><a href="InputBehaviors.html">Input Behaviors</a></li>
|
|
<li><a href="Controllers.html">Controllers</a></li>
|
|
<li><a href="ControllerMaps.html">Controller Maps</a></li>
|
|
<li><a href="ControllerTemplates.html">Controller Templates</a></li>
|
|
<li><a href="MapCategories.html">Map Categories</a></li>
|
|
<li><a href="Layouts.html">Layouts</a></li>
|
|
<li><a href="LayoutManager.html">Layout Manager</a></li>
|
|
<li><a href="MapEnabler.html">Map Enabler</a></li>
|
|
<li><a href="CustomControllers.html">Custom Controllers</a></li>
|
|
</ul>
|
|
<strong>Extras:</strong>
|
|
<ul>
|
|
<li><a href="ControlMapper.html" title="Control Mapper">Control Mapper</a></li>
|
|
<li><a href="Glyphs.html" title="Glyphs">Glyphs</a></li>
|
|
<li><a href="TouchControls.html" title="Touch Controls">Touch Controls</a></li>
|
|
<li><a href="UnityInputOverride.html" title="Unity Input Override">Unity Input Override</a></li>
|
|
</ul>
|
|
<strong>Misc:</strong>
|
|
<ul>
|
|
<li><a href="RewiredStandaloneInputModule.html">Rewired Standalone Input Module</a></li>
|
|
<li><a href="ComponentControls.html" title="Component Controls">Component Controls</a></li>
|
|
<li><a href="PlayerControllers.html" title="Player Controllers">Player Controllers</a></li>
|
|
<li><a href="InputMapper.html" title="Input Mapper">Input Mapper</a></li>
|
|
<li><a href="UserDataStore.html" title="User Data Store">User Data Store</a></li>
|
|
<li><a href="CustomPlatforms.html" title="User Data Store">Custom Platforms</a></li>
|
|
<li><a href="Localization.html" title="Localization">Localization</a></li>
|
|
</ul>
|
|
<strong>How To's:</strong>
|
|
<ul>
|
|
<li><a href="HowTos.html">See all topics...</a></li>
|
|
</ul>
|
|
<strong>Help:</strong>
|
|
<ul>
|
|
<li><a href="SupportedControllers.html" title="Supported Controllers">Supported Controllers</a></li>
|
|
<li><a href="Overview.html#tested-platforms" title="Tested Platforms">Tested Platforms</a></li>
|
|
<li><a href="Troubleshooting.html" title="Troubleshooting">Troubleshooting</a></li>
|
|
<li><a href="KnownIssues.html">Known Issues</a></li>
|
|
<li><a href="SpecialPlatformSupport.html" title="Special Platform Support">Special Platform Support</a></li>
|
|
<li><a href="Examples.html" title="Examples">Examples</a></li>
|
|
<li><a href="Integration.html">Integrations</a></li>
|
|
<li><a href="Updating.html" title="Updating Rewired">Updating Rewired</a></li>
|
|
</ul>
|
|
<strong>FAQ</strong>
|
|
<ul>
|
|
<li><a href="FAQ.html">See all topics...</a></li>
|
|
</ul>
|
|
<strong>Unity Help:</strong>
|
|
<ul>
|
|
<li><a href="http://docs.unity3d.com/Manual/" target="_blank">Unity Manual</a></li>
|
|
<li><a href="http://docs.unity3d.com/ScriptReference/" target="_blank">Unity Script Reference</a></li>
|
|
<li><a href="http://unity3d.com/learn/tutorials/modules" target="_blank">Unity Tutorials</a></li>
|
|
</ul>
|
|
<strong>Links:</strong>
|
|
<ul>
|
|
<li><a href="http://guavaman.com/projects/rewired">Rewired Website</a></li>
|
|
<li><a href="http://guavaman.com/projects/rewired/docs">Web Documentation</a></li>
|
|
</ul>
|
|
</div>
|
|
|
|
|
|
<div class="main-body">
|
|
<div class="logo"><a href="http://guavaman.com/projects/rewired" title="Rewired"><img src="files/images/rewired-logo.png" width="173" height="139" alt="Rewired" /></a></div>
|
|
|
|
<h1>
|
|
<!-- InstanceBeginEditable name="PageHeader" -->Localization
|
|
<!-- InstanceEndEditable -->
|
|
</h1>
|
|
|
|
<!-- InstanceBeginEditable name="MainBody" -->
|
|
|
|
<p>As of version 1.1.56.0, Rewired includes a localization system can be used to display localized names for controllers, controller elements, Actions, Action Categories, Map Categories, and other things. Anywhere a name is returned in the API, it will return a localized name if available.</p>
|
|
<h3><a name="contents" id="contents"></a>Contents</h3>
|
|
<ul>
|
|
<li><a href="#quick-setup">Quick Setup</a></li>
|
|
<li><a href="#namespace">Namespace</a></li>
|
|
<li><a href="#important-classes">Important Classes</a></li>
|
|
<li><a href="#localized-string-provider">Localized String Provider</a></li>
|
|
<li><a href="#key-format">Key Format</a> </li>
|
|
</ul>
|
|
<p> </p>
|
|
<hr />
|
|
<h3><a name="quick-setup" id="quick-setup"></a>Quick Setup</h3>
|
|
<p>Add the Localized String Provider component to the Rewired Input Manager (or a child object) by selecting the Game Object and from the menu:</p>
|
|
<ul>
|
|
<li>Component -> Rewired -> Localization ->Localized String Provider<br />
|
|
</li>
|
|
</ul>
|
|
<p>Create a JSON file with the keys and localized strings and <a href="#localized-string-provider-inspector">assign it in the inspector</a>. See <a href="#key-format">Key Format</a> and <a href="RewiredEditor.html#tools-export-keys">Exporting JSON keys</a> for more information on how to create the JSON file.</p>
|
|
<p> </p>
|
|
<hr />
|
|
<h3><a name="namespace" id="namespace"></a>Namespace</h3>
|
|
<p>All Localization-related classes are in the Rewired.Localization namespace.</p>
|
|
<pre class="code">using Rewired.Localization;</pre>
|
|
<p> </p>
|
|
<hr />
|
|
<h3><a name="important-classes" id="important-classes"></a>Important Classes</h3>
|
|
<ul>
|
|
<li>ReInput.LocalizationHelper - Provides access to all localization-related members. Access via ReInput.localization.</li>
|
|
</ul>
|
|
<p> </p>
|
|
<hr />
|
|
<h3><a name="localized-string-provider" id="localized-string-provider"></a>Localized String Provider</h3>
|
|
<p>The localized string provider is responsible for performing a string key lookup and returning a localized string. A localized string provider is required to use the localization system.</p>
|
|
<p>Any class that implements Rewired.Interfaces.ILocalizedStringProvider can be used as the localized string provider by assigning it to ReInput.localization.localizedStringProvider. The LocalizedStringProviderBase component implements this interface and sets itself as the localized string provider in OnEnable. (The localized string provider should always null the ReInput.localization.localizedStringProvider property when no longer needed, usually in OnDisable.)</p>
|
|
<p><strong>LocalizedStringProvider</strong></p>
|
|
<p>The LocalizedStringProvider component is the default implementation of a localized string provider.</p>
|
|
<p>Add the Localized STring Provider component to the Rewired Input Manager (or a child object) by selecting the Game Object and from the menu:</p>
|
|
<ul>
|
|
<li>Component -> Rewired -> Localization -> Localized String Provider</li>
|
|
</ul>
|
|
<p><strong><a name="localized-string-provider-inspector" id="localized-string-provider-inspector"></a>Inspector</strong></p>
|
|
<p><img src="files/images/localization-localized-string-provider-inspector.png" width="392" height="76" alt="Localized String Provider inspector" /></p>
|
|
<table width="100%" border="0" cellpadding="0" cellspacing="0">
|
|
<tr>
|
|
<td width="22%" valign="top">Prefetch</td>
|
|
<td width="78%" valign="top"><p>Determines if localized strings should be fetched immediately in bulk when available. If false, localized strings will be fetched when queried.</p>
|
|
<p>By default, localized strings are fetched on an as-needed basis. That is, no key lookup is done until the localized string is first displayed. If you want all keys for connected devices to be loaded in bulk, set prefetch to true in the inspector, or in code, ReInput.localizedStringProvider.prefetch = true. Controllers that are not presently connected cannot have their localized strings prefetched, but if prefetch is enabled, all localized strings for that controller will be fetched when it is connected.</p></td>
|
|
</tr>
|
|
<tr>
|
|
<td valign="top">Localized Strings File</td>
|
|
<td valign="top"><p>A JSON file containing localizied string key value pairs.<br />
|
|
</p></td>
|
|
</tr>
|
|
</table>
|
|
<p></p>
|
|
<p><strong><a name="caching" id="caching"></a>Caching</strong></p>
|
|
<p>Localized strings are cached when returned from the localized string provider. This prevents wasting CPU resources by constantly doing expensive string key lookups. The localized string cache can be cleared by calling ReInput.localization.Reload. The cache will also be cleared automatically after setting a new localized string provider.</p>
|
|
<p><strong><a></a><a></a><a name="localized-string-provider-changing-strings-at-runtime" id="localized-string-provider-changing-strings-at-runtime"></a>Changing Localized Strings at Runtime</strong></p>
|
|
<p>You might want to create a different set of localized strings for different languages.</p>
|
|
<p>You can set the LocalizedStringProvider.localizedStringsFile property to load a new set of localized strings.</p>
|
|
<p>You can also replace the Localized String Provider and all cached strings will be cleared automatically. Just set ReInput.localization.localizedStringProvider to your new provider.</p>
|
|
<p> </p>
|
|
<hr />
|
|
<h3><a name="key-format" id="key-format"></a>Key Format</h3>
|
|
<p>The Localization system and the Glyph system share the same keys, so all the information in the glyphs documentation on this topic applies to Localization as well. To avoid duplication of documentation, <a href="Glyphs.html#key-format">please read the the Key Format section of the Glyphs documentation first.</a></p>
|
|
<p>Beyond controllers and controller elements covered in the Glyphs documentation, a number of additional names can be localized.</p>
|
|
<p>All keys can be exported from the <a href="RewiredEditor.html#Tools">Rewired Editor -> Tools page</a>.</p>
|
|
<p>Note: The [brackets] below are not part of the key. Items in brackets represent a variable value.</p>
|
|
<p><strong>Additional Localization Keys:</strong></p>
|
|
<p>Each of these keys can be defined in the <a href="RewiredEditor.html">Rewired Editor</a>.</p>
|
|
<table width="100%" border="0" cellpadding="0" cellspacing="0">
|
|
<tr>
|
|
<td valign="top">player/[key]</td>
|
|
<td valign="top"><p>A Player name.</p></td>
|
|
</tr>
|
|
<tr>
|
|
<td width="78%" valign="top">action/[key]</td>
|
|
<td width="22%" valign="top"><p>An Action name, or the name of one pole of an Action (pos/neg).</p></td>
|
|
</tr>
|
|
<tr>
|
|
<td valign="top">action/category/[key]</td>
|
|
<td valign="top">An Action Category name.</td>
|
|
</tr>
|
|
<tr>
|
|
<td valign="top">controller_map/category/[key]</td>
|
|
<td valign="top">A Controller Map Category name.</td>
|
|
</tr>
|
|
<tr>
|
|
<td valign="top">controller_map/layout/[key]</td>
|
|
<td valign="top">A Controller Map Layout name.</td>
|
|
</tr>
|
|
</table>
|
|
<p><br />
|
|
</p>
|
|
<p> </p>
|
|
<div class="bottom-pager clearfix">
|
|
<a class="back-button" href="Documentation.html" title="Actions"><span class="button-img"></span>Documentation</a></div>
|
|
<!-- InstanceEndEditable -->
|
|
</div>
|
|
|
|
</div>
|
|
<div class="footer clearfix">
|
|
<p class="left">Copyright ©2014-2021 <a href="http://guavaman.com" title="Guavaman Enterprises">Guavaman Enterprises</a>. All rights reserved. No materials may be reproduced without permission.</p>
|
|
<p class="right"><a href="http://guavaman.com/projects/rewired" title="Return to Rewired Website">Return to Rewired Website</a></p>
|
|
</div>
|
|
<!-- end .content --></div>
|
|
<!-- end .container --></div>
|
|
|
|
|
|
</body>
|
|
<!-- InstanceEnd --></html>
|