Use STRING macros (#6576)

This commit is contained in:
Wakbub 2019-12-07 22:40:44 +01:00 committed by jonpas
parent 30b4f3edf0
commit 79e3de623f
7 changed files with 22 additions and 20 deletions

View File

@ -459,14 +459,14 @@ GVAR(deviceKeyHandlingArray) = [];
GVAR(deviceKeyCurrentIndex) = -1; GVAR(deviceKeyCurrentIndex) = -1;
// Register localizations for the Keybinding categories // Register localizations for the Keybinding categories
["ACE3 Equipment", localize LSTRING(ACEKeybindCategoryEquipment)] call CBA_fnc_registerKeybindModPrettyName; ["ACE3 Equipment", LLSTRING(ACEKeybindCategoryEquipment)] call CBA_fnc_registerKeybindModPrettyName;
["ACE3 Common", localize LSTRING(ACEKeybindCategoryCommon)] call CBA_fnc_registerKeybindModPrettyName; ["ACE3 Common", LLSTRING(ACEKeybindCategoryCommon)] call CBA_fnc_registerKeybindModPrettyName;
["ACE3 Weapons", localize LSTRING(ACEKeybindCategoryWeapons)] call CBA_fnc_registerKeybindModPrettyName; ["ACE3 Weapons", LLSTRING(ACEKeybindCategoryWeapons)] call CBA_fnc_registerKeybindModPrettyName;
["ACE3 Movement", localize LSTRING(ACEKeybindCategoryMovement)] call CBA_fnc_registerKeybindModPrettyName; ["ACE3 Movement", LLSTRING(ACEKeybindCategoryMovement)] call CBA_fnc_registerKeybindModPrettyName;
["ACE3 Scope Adjustment", localize LSTRING(ACEKeybindCategoryScopeAdjustment)] call CBA_fnc_registerKeybindModPrettyName; ["ACE3 Scope Adjustment", LLSTRING(ACEKeybindCategoryScopeAdjustment)] call CBA_fnc_registerKeybindModPrettyName;
["ACE3 Vehicles", localize LSTRING(ACEKeybindCategoryVehicles)] call CBA_fnc_registerKeybindModPrettyName; ["ACE3 Vehicles", LLSTRING(ACEKeybindCategoryVehicles)] call CBA_fnc_registerKeybindModPrettyName;
["ACE3 Equipment", QGVAR(openDevice), (localize "STR_ACE_Common_toggleHandheldDevice"), { ["ACE3 Equipment", QGVAR(openDevice), LLSTRING(toggleHandheldDevice), {
[] call FUNC(deviceKeyFindValidIndex); [] call FUNC(deviceKeyFindValidIndex);
if (GVAR(deviceKeyCurrentIndex) == -1) exitWith {false}; if (GVAR(deviceKeyCurrentIndex) == -1) exitWith {false};
[] call ((GVAR(deviceKeyHandlingArray) select GVAR(deviceKeyCurrentIndex)) select 3); [] call ((GVAR(deviceKeyHandlingArray) select GVAR(deviceKeyCurrentIndex)) select 3);
@ -475,7 +475,7 @@ GVAR(deviceKeyCurrentIndex) = -1;
{false}, {false},
[0xC7, [false, false, false]], false] call CBA_fnc_addKeybind; //Home Key [0xC7, [false, false, false]], false] call CBA_fnc_addKeybind; //Home Key
["ACE3 Equipment", QGVAR(closeDevice), (localize "STR_ACE_Common_closeHandheldDevice"), { ["ACE3 Equipment", QGVAR(closeDevice), LLSTRING(closeHandheldDevice), {
[] call FUNC(deviceKeyFindValidIndex); [] call FUNC(deviceKeyFindValidIndex);
if (GVAR(deviceKeyCurrentIndex) == -1) exitWith {false}; if (GVAR(deviceKeyCurrentIndex) == -1) exitWith {false};
[] call ((GVAR(deviceKeyHandlingArray) select GVAR(deviceKeyCurrentIndex)) select 4); [] call ((GVAR(deviceKeyHandlingArray) select GVAR(deviceKeyCurrentIndex)) select 4);
@ -484,7 +484,7 @@ GVAR(deviceKeyCurrentIndex) = -1;
{false}, {false},
[0xC7, [false, true, false]], false] call CBA_fnc_addKeybind; //CTRL + Home Key [0xC7, [false, true, false]], false] call CBA_fnc_addKeybind; //CTRL + Home Key
["ACE3 Equipment", QGVAR(cycleDevice), (localize "STR_ACE_Common_cycleHandheldDevices"), { ["ACE3 Equipment", QGVAR(cycleDevice), LLSTRING(cycleHandheldDevices), {
[1] call FUNC(deviceKeyFindValidIndex); [1] call FUNC(deviceKeyFindValidIndex);
if (GVAR(deviceKeyCurrentIndex) == -1) exitWith {false}; if (GVAR(deviceKeyCurrentIndex) == -1) exitWith {false};
private _displayName = ((GVAR(deviceKeyHandlingArray) select GVAR(deviceKeyCurrentIndex)) select 0); private _displayName = ((GVAR(deviceKeyHandlingArray) select GVAR(deviceKeyCurrentIndex)) select 0);

View File

@ -77,7 +77,7 @@ GVAR(deployPFH) = [{
} count WIRE_FAST; } count WIRE_FAST;
}, 0, [_wireNoGeo, _wireNoGeoPos, _unit]] call CBA_fnc_addPerFrameHandler; }, 0, [_wireNoGeo, _wireNoGeoPos, _unit]] call CBA_fnc_addPerFrameHandler;
[localize LSTRING(RollWire), "", ""] call EFUNC(interaction,showMouseHint); [LLSTRING(RollWire), "", ""] call EFUNC(interaction,showMouseHint);
[_unit, "blockThrow", QUOTE(ADDON), true] call EFUNC(common,statusEffect_set); [_unit, "blockThrow", QUOTE(ADDON), true] call EFUNC(common,statusEffect_set);

View File

@ -34,7 +34,7 @@ private _delay = [45, 30] select ([_unit] call EFUNC(common,isEngineer) || {[_un
[_wire], [_wire],
{(_this select 0) call FUNC(dismountSuccess)}, {(_this select 0) call FUNC(dismountSuccess)},
{}, {},
localize LSTRING(UnrollWire), LLSTRING(UnrollWire),
{true}, {true},
["isnotinside"] ["isnotinside"]
] call EFUNC(common,progressBar); ] call EFUNC(common,progressBar);

View File

@ -1,11 +1,11 @@
["ACE3 Equipment", QGVAR(RangeCardDialogKey), localize "STR_ACE_RangeCard_RangeCardDialogKey", ["ACE3 Equipment", QGVAR(RangeCardDialogKey), LLSTRING(RangeCardDialogKey),
{ {
// Conditions: canInteract, canShow // Conditions: canInteract, canShow
if !([ACE_player, objNull, ["notOnMap", "isNotInside"]] call EFUNC(common,canInteractWith)) exitWith {false}; if !([ACE_player, objNull, ["notOnMap", "isNotInside"]] call EFUNC(common,canInteractWith)) exitWith {false};
if (GVAR(RangeCardOpened)) exitWith { if (GVAR(RangeCardOpened)) exitWith {
closeDialog 0; closeDialog 0;
false false
}; };
if !(call FUNC(canShow)) exitWith {false}; if !(call FUNC(canShow)) exitWith {false};
// Statement // Statement
false call FUNC(openRangeCard); false call FUNC(openRangeCard);
@ -14,7 +14,7 @@
{false}, {false},
[0, [false, false, false]], false, 0] call CBA_fnc_addKeybind; // (empty default key) [0, [false, false, false]], false, 0] call CBA_fnc_addKeybind; // (empty default key)
["ACE3 Equipment", QGVAR(RangeCardCopyDialogKey), localize "STR_ACE_RangeCard_RangeCardCopyDialogKey", ["ACE3 Equipment", QGVAR(RangeCardCopyDialogKey), LLSTRING(RangeCardCopyDialogKey),
{ {
// Conditions: canInteract, canShowCopy // Conditions: canInteract, canShowCopy
if !([ACE_player, objNull, ["notOnMap", "isNotInside"]] call EFUNC(common,canInteractWith)) exitWith {false}; if !([ACE_player, objNull, ["notOnMap", "isNotInside"]] call EFUNC(common,canInteractWith)) exitWith {false};
@ -28,4 +28,4 @@
true true
}, },
{false}, {false},
[0, [false, false, false]], false, 0] call CBA_fnc_addKeybind; // (empty default key) [0, [false, false, false]], false, 0] call CBA_fnc_addKeybind; // (empty default key)

View File

@ -40,7 +40,7 @@ GVAR(adjustPFH) = [{
[_unit, "blockThrow", QUOTE(ADDON), true] call EFUNC(common,statusEffect_set); [_unit, "blockThrow", QUOTE(ADDON), true] call EFUNC(common,statusEffect_set);
// add mouse button action and hint // add mouse button action and hint
[localize "STR_ACE_Tripod_Done", "", localize "STR_ACE_Tripod_ScrollAction"] call EFUNC(interaction,showMouseHint); [LLSTRING(Done), "", LLSTRING(ScrollAction)] call EFUNC(interaction,showMouseHint);
_unit setVariable [QGVAR(Adjust), [ _unit setVariable [QGVAR(Adjust), [
_unit, "DefaultAction", _unit, "DefaultAction",

View File

@ -1,5 +1,5 @@
["ACE3 Equipment", QGVAR(DistanceKey), localize "STR_ACE_Yardage450_PowerButtonKey", ["ACE3 Equipment", QGVAR(DistanceKey), LLSTRING(PowerButtonKey),
{ {
// Conditions: canInteract // Conditions: canInteract
if !([ACE_player, objNull, ["isNotInside"]] call EFUNC(common,canInteractWith)) exitWith {false}; if !([ACE_player, objNull, ["isNotInside"]] call EFUNC(common,canInteractWith)) exitWith {false};

View File

@ -135,14 +135,16 @@ These macros are allowed but are not enforced.
Note that you need the strings in module `stringtable.xml` in the correct format: Note that you need the strings in module `stringtable.xml` in the correct format:
`STR_ACE_<module>_<string>` `STR_ACE_<module>_<string>`
Example: `STR_Balls_Banana` Example: `STR_ACE_Balls_Banana`
Script strings (still require `localize` to localize the string): Script strings:
| Macro | Expands to | | Macro | Expands to |
| -------|---------| | -------|---------|
|`LSTRING(banana)` | `"STR_ACE_balls_banana"` | |`LSTRING(banana)` | `"STR_ACE_balls_banana"` |
|`LLSTRING(banana)` | `localize "STR_ACE_balls_banana"` |
|`ELSTRING(leg,banana)` | `"STR_ACE_leg_banana"` | |`ELSTRING(leg,banana)` | `"STR_ACE_leg_banana"` |
|`LELSTRING(leg,banana)` | `localize "STR_ACE_leg_banana"` |
Config Strings (require `$` as first character): Config Strings (require `$` as first character):
@ -299,7 +301,7 @@ call {
call { call {
if (/* condition */) then { if (/* condition */) then {
/* code */ /* code */
}; };
}; };
}; };
``` ```