webmcp
changeset 511:bb1f3e7c65d1
Added section on Internationalization/Localization to WebMCP's documentation
author | jbe |
---|---|
date | Mon Aug 21 04:28:17 2017 +0200 (2017-08-21) |
parents | 696d7e5f2bcb |
children | 8579adac1cc6 |
files | doc/autodoc-header.htmlpart |
line diff
1.1 --- a/doc/autodoc-header.htmlpart Mon Aug 21 03:58:33 2017 +0200 1.2 +++ b/doc/autodoc-header.htmlpart Mon Aug 21 04:28:17 2017 +0200 1.3 @@ -292,6 +292,18 @@ 1.4 <li><tt><!-- WEBMCP SLOT </tt><i>slot_name</i><tt> --></tt> gets, if the slot is not empty, replaced with a <tt><div></tt> element (with the <tt>id</tt> attribute set to "<tt>slot_</tt><i>slotname</i>") that contains the slot's content.</li> 1.5 <li><tt><!-- WEBMCP SLOTNODIV </tt><i>slot_name</i><tt> --></tt> gets replaced with the slot's content (without wrapping it in an additional <tt><div></tt> element).</li> 1.6 </ul> 1.7 + <h2>Internationalization/Localization</h2> 1.8 + <p> 1.9 + To translate certain strings in your application, simply use the <a href="#_">underscore function</a>. A language can be selected with <tt><a href="#locale.set">locale.set</a>{lang = "code"}</tt> where <tt>code</tt> is a language code. The translations for strings are expected to be contained in files "<tt>locale/translations.</tt><i>language_code</i><tt>.lua</tt>". These files should return a table that maps strings to their corresponding translation: 1.10 + </p> 1.11 + <pre> 1.12 +return{ 1.13 +["Are you sure?"] = "Bist Du sicher?"; 1.14 +["User '#{name}' created"] = "Benutzer '#{name}' created"; 1.15 +}</pre> 1.16 + <p> 1.17 + Such translation files can be automatically created with the <tt>langtool.lua</tt> program, found in the framework's <tt>bin/</tt> directory. 1.18 + </p> 1.19 <h2>Directory structure of a WebMCP application</h2> 1.20 Summarizing information from the previous section, we get the following directory structure for a WebMCP application: 1.21 <ul>