ACE3/addons/common/functions/fnc_loadSettingsLocalizedText.sqf

54 lines
1.5 KiB
Plaintext
Raw Normal View History

2015-04-18 18:06:01 +00:00
/*
* Author: Glowbal
* Parse all settings and load the localized displayName and description for all text
*
* Arguments:
* None
*
* Return Value:
* None
*
* Public: No
*/
#include "script_component.hpp"
2015-09-18 19:15:06 +00:00
private "_fnc_parseConfigForDisplayNames";
2015-09-18 19:12:40 +00:00
_fnc_parseConfigForDisplayNames = {
params ["_optionEntry"];
2015-04-18 18:06:01 +00:00
if !(isClass _optionEntry) exitwith {false};
2015-09-18 19:12:40 +00:00
private "_values";
_values = getArray (_optionEntry >> "values");
2015-09-18 19:12:40 +00:00
2015-04-18 18:06:01 +00:00
_x set [3, getText (_optionEntry >> "displayName")];
_x set [4, getText (_optionEntry >> "description")];
_x set [5, _values];
_x set [8, getText (_optionEntry >> "category")];
2015-04-18 18:06:01 +00:00
{
2015-09-18 19:12:40 +00:00
private "_text";
2015-04-18 18:06:01 +00:00
_text = _x;
2015-09-18 19:12:40 +00:00
if (typeName _text == "STRING" && {count _text > 1} && {_text select [0, 1] == "$"}) then {
_text = localize (_text select [1]); //chop off the leading $
2015-04-18 18:06:01 +00:00
_values set [_forEachIndex, _text];
};
} forEach _values;
2015-09-18 19:12:40 +00:00
true
2015-04-18 18:06:01 +00:00
};
// Iterate through settings
{
2015-09-18 19:12:40 +00:00
_x params ["_name"];
2015-04-18 18:06:01 +00:00
2015-09-18 19:12:40 +00:00
if !([configFile >> "ACE_Settings" >> _name] call _fnc_parseConfigForDisplayNames) then {
if !([configFile >> "ACE_ServerSettings" >> _name] call _fnc_parseConfigForDisplayNames) then {
if !([missionConfigFile >> "ACE_Settings" >> _name] call _fnc_parseConfigForDisplayNames) then {
2015-08-26 15:39:44 +00:00
ACE_LOGWARNING_1("Setting found, but couldn't localize [%1] (server has but we don't?)",_name);
};
2015-04-18 18:06:01 +00:00
};
};
2015-09-18 19:12:40 +00:00
false
} count GVAR(settings);