CMF3 Engine: stringtable

From cluster wiki
Revision as of 23:19, 17 December 2022 by Eric (talk | contribs) (Created page with "The '''stringtable.sqf''' file is used as a Look-up-Table for localizing strings. It consists of an array with sub arrays containing strings localized to the [https://communit...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

The stringtable.sqf file is used as a Look-up-Table for localizing strings. It consists of an array with sub arrays containing strings localized to the languages supported by arma 3. This file is not a necessity and can be omitted from a CMF3 framework component.

It uses the following format (inspired by Arma 3's stringtable.xml format):

#include "script_component.hpp"

[
    [DSTRING(/* String identifier */), [
        ["English", /* English translation */],
        ["Spanish", /* Spanish translation */],
        ...
    ]],
]

A stringtable file can look like the following (taken from the CMF3 player component):

#include "script_component.hpp"
/*
 * Author: Eric
 * player_stringtable
 */
[
    [DSTRING(drink_from), [
        ["English", "Drink from %1"],
        ["Spanish", "Beber de %1"]
    ]],
    [DSTRING(hydration), [
        ["English", "Hydration"],
        ["Spanish", "Hidratación"]
    ]],

    [DSTRING(insert_earplugs), [
        ["English", "Insert earplugs"],
        ["Spanish", "Insertar tapones"]
    ]],
    [DSTRING(takeOut_earplugs), [
        ["English", "Take out earplugs"],
        ["Spanish", "Quitar tapones"]
    ]],

    [DSTRING(restrictLauncher_message), [
        ["English", "You do not know how to operate this weapon."],
        ["Spanish", "No sabes como operar esta arma."]
    ]]
]

It should be noted that you are not required to use the DSTRING MACRO to craft your identifier and it can be any string, but using the DSTRING MACRO will make it a lot easier in the fetching process as you can use LSTRING to fetch instead of the cmf_main_fnc_localize function.