# HG changeset patch # User jbe # Date 1503282497 -7200 # Node ID bb1f3e7c65d11fe93300cbe76985251ef5e94629 # Parent 696d7e5f2bcb29f8f3fd01e0081a7ff31cb9d626 Added section on Internationalization/Localization to WebMCP's documentation diff -r 696d7e5f2bcb -r bb1f3e7c65d1 doc/autodoc-header.htmlpart --- a/doc/autodoc-header.htmlpart Mon Aug 21 03:58:33 2017 +0200 +++ b/doc/autodoc-header.htmlpart Mon Aug 21 04:28:17 2017 +0200 @@ -292,6 +292,18 @@
  • <!-- WEBMCP SLOT slot_name --> gets, if the slot is not empty, replaced with a <div> element (with the id attribute set to "slot_slotname") that contains the slot's content.
  • <!-- WEBMCP SLOTNODIV slot_name --> gets replaced with the slot's content (without wrapping it in an additional <div> element).
  • +

    Internationalization/Localization

    +

    + To translate certain strings in your application, simply use the underscore function. A language can be selected with locale.set{lang = "code"} where code is a language code. The translations for strings are expected to be contained in files "locale/translations.language_code.lua". These files should return a table that maps strings to their corresponding translation: +

    +
    +return{
    +["Are you sure?"] = "Bist Du sicher?";
    +["User '#{name}' created"] = "Benutzer '#{name}' created";
    +}
    +

    + Such translation files can be automatically created with the langtool.lua program, found in the framework's bin/ directory. +

    Directory structure of a WebMCP application

    Summarizing information from the previous section, we get the following directory structure for a WebMCP application: