Multilingual questions - mkraska/meclib GitHub Wiki

AI-Prompts for translations

Using multilang2 mechanism:

Translate the following to english using the syntax {mlang de}Deutscher text{mlang}{mlang en}English text{mlang}.
Show the result as code.

Using the [[lang]] block in STACK (we are using ' instead of " for use in castext("...."))

Translate the following to english using the syntax [[lang code='de']]Deutscher text[[/lang]]
[[lang code="en,other"]]English text[[/lang]]

Once you did translations and want to switch syntax, it is sufficient to say:

Use [[lang]] syntax
Use {mlang} syntax

Multilingual text blocks

[[lang code="de"]]
<details><summary><strong>Bedienungshinweise</strong></summary>
<ul>
  <li>Objekte (de-)aktivieren: Doppelklick</li>
  <li>Kraft/Moment</li> 
  <ul>
    <li>erzeugen: Name (oder Ausdruck für Wert) eintragen und grauen Pfeil auf die Skizze ziehen</li> 
    <li>löschen: Doppelklicken</li>
    <li>Name ändern: Löschen und neu erzeugen. Sorry, etwas unbequem :(</li>
    <li>Position und Richtung ändern: Rote Kontrollpunkte ziehen</li>
  </ul>
  <li>Resultierende von Streckenlasten: Mindestens ein Kontrollpunkt muss auf der Streckenlast liegen</li>
  <li>Reaktionskräfte: Anfangs- oder Endpunkt müssen auf dem Lagerpunkt liegen</li>
  <li>Reaktionsmomente: Mittelpunkt muss auf dem Lager liegen</li>
</ul>
</details>
[[/lang]]
[[lang code="en,other"]]
<details><summary><strong>Hints for interactive input</strong></summary>
<ul>
  <li>Activate/de-activate objects: double click </li>
  <li>Force/moment</li> 
  <ul>
    <li>Create: Enter name (or expression indicating the value) in the text field and then drag the gray arrow onto the sketch.</li> 
    <li>Delete: Double click on the arrow</li>
    <li>Change name: Delete and create new with correct name. Sorry, somewhat inconvenient :(</li>
    <li>Change position and direction: Drag red control points</li>
  </ul>
  <li>Resultants of line loads: At least one control point is on the line load area</li>
  <li>Force reactions: Either of the two control points must be on the support point</li>
  <li>Moment reactions: Center point must coincide with the support point.</li>
</ul>
</details>
[[/lang]]

Localization of decimal separator

STACK questions have an option "Decimal separator", which can be "." or ",". This value is reflected in the variable stackfltsep and in attributes of input fields.

JSXGraph can be localized accordingly, starting with Meclib 2005 02 17.

Interactive sketches using the objects and names input fields take the setting from the input field attributes. If you want to use a non-default separator setting then you just need to recompile the question for use of the most recent Meclib version.

Non-interactive sketches need an injection of the stackfltsep value. This is part of the text templates given in Meclib question setup. If you want to enable the sync in a legacy question, then just add the following line to the STACK header in the [[JSXGraph]] block.

var decsep = {#stackfltsep#};

Multilingual syntax hints

Question variables

Meclib provides definitions for multilingual syntax hints:

meclib_h_number: castext("[[lang code='de']]Zahl[[/lang]][[lang code='en,other']]number[[/lang]]");
meclib_h_unit: castext("[[lang code='de']]Zahl mit Einheit[[/lang]][[lang code='en,other']]number with unit[[/lang]]");
meclib_h_alg: castext("[[lang code='de']]Ausdruck[[/lang]][[lang code='en,other']]expression[[/lang]]");

They are defined in fb_value.mac

stack_include("https://raw.githubusercontent.com/mkraska/meclib/main/Maxima/fb_value.mac");

Input

In the syntax hint field, inject the hint:

{@meclib_h_number@}
{@meclib_h_unit@}
{@meclib_h_alg@}

Multilingual Feedback

Note that the standard feedback texts as defined in the question options are not language sensitive (they seem to be set upon system installation).

If your PRTs use the standard format (as opposed to compact), then replace the standard texts in the question options by symbols as explained in Style Guide for Questions in Engineering Mechanics

⚠️ **GitHub.com Fallback** ⚠️