From 79e3de623f93bbf8784856f23ab0d815cfd89b76 Mon Sep 17 00:00:00 2001 From: Wakbub Date: Sat, 7 Dec 2019 22:40:44 +0100 Subject: [PATCH] Use STRING macros (#6576) --- addons/common/XEH_postInit.sqf | 18 +++++++++--------- .../concertina_wire/functions/fnc_deploy.sqf | 2 +- .../concertina_wire/functions/fnc_dismount.sqf | 2 +- addons/rangecard/initKeybinds.sqf | 8 ++++---- addons/tripod/functions/fnc_adjust.sqf | 2 +- addons/yardage450/initKeybinds.sqf | 2 +- docs/wiki/development/coding-guidelines.md | 8 +++++--- 7 files changed, 22 insertions(+), 20 deletions(-) diff --git a/addons/common/XEH_postInit.sqf b/addons/common/XEH_postInit.sqf index 39dcfb8264..d174208be0 100644 --- a/addons/common/XEH_postInit.sqf +++ b/addons/common/XEH_postInit.sqf @@ -459,14 +459,14 @@ GVAR(deviceKeyHandlingArray) = []; GVAR(deviceKeyCurrentIndex) = -1; // Register localizations for the Keybinding categories -["ACE3 Equipment", localize LSTRING(ACEKeybindCategoryEquipment)] call CBA_fnc_registerKeybindModPrettyName; -["ACE3 Common", localize LSTRING(ACEKeybindCategoryCommon)] call CBA_fnc_registerKeybindModPrettyName; -["ACE3 Weapons", localize LSTRING(ACEKeybindCategoryWeapons)] call CBA_fnc_registerKeybindModPrettyName; -["ACE3 Movement", localize LSTRING(ACEKeybindCategoryMovement)] call CBA_fnc_registerKeybindModPrettyName; -["ACE3 Scope Adjustment", localize LSTRING(ACEKeybindCategoryScopeAdjustment)] call CBA_fnc_registerKeybindModPrettyName; -["ACE3 Vehicles", localize LSTRING(ACEKeybindCategoryVehicles)] call CBA_fnc_registerKeybindModPrettyName; +["ACE3 Equipment", LLSTRING(ACEKeybindCategoryEquipment)] call CBA_fnc_registerKeybindModPrettyName; +["ACE3 Common", LLSTRING(ACEKeybindCategoryCommon)] call CBA_fnc_registerKeybindModPrettyName; +["ACE3 Weapons", LLSTRING(ACEKeybindCategoryWeapons)] call CBA_fnc_registerKeybindModPrettyName; +["ACE3 Movement", LLSTRING(ACEKeybindCategoryMovement)] call CBA_fnc_registerKeybindModPrettyName; +["ACE3 Scope Adjustment", LLSTRING(ACEKeybindCategoryScopeAdjustment)] 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); if (GVAR(deviceKeyCurrentIndex) == -1) exitWith {false}; [] call ((GVAR(deviceKeyHandlingArray) select GVAR(deviceKeyCurrentIndex)) select 3); @@ -475,7 +475,7 @@ GVAR(deviceKeyCurrentIndex) = -1; {false}, [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); if (GVAR(deviceKeyCurrentIndex) == -1) exitWith {false}; [] call ((GVAR(deviceKeyHandlingArray) select GVAR(deviceKeyCurrentIndex)) select 4); @@ -484,7 +484,7 @@ GVAR(deviceKeyCurrentIndex) = -1; {false}, [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); if (GVAR(deviceKeyCurrentIndex) == -1) exitWith {false}; private _displayName = ((GVAR(deviceKeyHandlingArray) select GVAR(deviceKeyCurrentIndex)) select 0); diff --git a/addons/concertina_wire/functions/fnc_deploy.sqf b/addons/concertina_wire/functions/fnc_deploy.sqf index 9a242cc452..85f78c65f9 100644 --- a/addons/concertina_wire/functions/fnc_deploy.sqf +++ b/addons/concertina_wire/functions/fnc_deploy.sqf @@ -77,7 +77,7 @@ GVAR(deployPFH) = [{ } count WIRE_FAST; }, 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); diff --git a/addons/concertina_wire/functions/fnc_dismount.sqf b/addons/concertina_wire/functions/fnc_dismount.sqf index dd7293e0d6..b8beeb6a9e 100644 --- a/addons/concertina_wire/functions/fnc_dismount.sqf +++ b/addons/concertina_wire/functions/fnc_dismount.sqf @@ -34,7 +34,7 @@ private _delay = [45, 30] select ([_unit] call EFUNC(common,isEngineer) || {[_un [_wire], {(_this select 0) call FUNC(dismountSuccess)}, {}, - localize LSTRING(UnrollWire), + LLSTRING(UnrollWire), {true}, ["isnotinside"] ] call EFUNC(common,progressBar); diff --git a/addons/rangecard/initKeybinds.sqf b/addons/rangecard/initKeybinds.sqf index cb6ff49206..2e0828127d 100644 --- a/addons/rangecard/initKeybinds.sqf +++ b/addons/rangecard/initKeybinds.sqf @@ -1,11 +1,11 @@ -["ACE3 Equipment", QGVAR(RangeCardDialogKey), localize "STR_ACE_RangeCard_RangeCardDialogKey", +["ACE3 Equipment", QGVAR(RangeCardDialogKey), LLSTRING(RangeCardDialogKey), { // Conditions: canInteract, canShow if !([ACE_player, objNull, ["notOnMap", "isNotInside"]] call EFUNC(common,canInteractWith)) exitWith {false}; if (GVAR(RangeCardOpened)) exitWith { closeDialog 0; false - }; + }; if !(call FUNC(canShow)) exitWith {false}; // Statement false call FUNC(openRangeCard); @@ -14,7 +14,7 @@ {false}, [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 if !([ACE_player, objNull, ["notOnMap", "isNotInside"]] call EFUNC(common,canInteractWith)) exitWith {false}; @@ -28,4 +28,4 @@ true }, {false}, -[0, [false, false, false]], false, 0] call CBA_fnc_addKeybind; // (empty default key) \ No newline at end of file +[0, [false, false, false]], false, 0] call CBA_fnc_addKeybind; // (empty default key) diff --git a/addons/tripod/functions/fnc_adjust.sqf b/addons/tripod/functions/fnc_adjust.sqf index 42af65be74..d2a837c89e 100644 --- a/addons/tripod/functions/fnc_adjust.sqf +++ b/addons/tripod/functions/fnc_adjust.sqf @@ -40,7 +40,7 @@ GVAR(adjustPFH) = [{ [_unit, "blockThrow", QUOTE(ADDON), true] call EFUNC(common,statusEffect_set); // 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, "DefaultAction", diff --git a/addons/yardage450/initKeybinds.sqf b/addons/yardage450/initKeybinds.sqf index 9ad3005d28..fa4f52b6c5 100644 --- a/addons/yardage450/initKeybinds.sqf +++ b/addons/yardage450/initKeybinds.sqf @@ -1,5 +1,5 @@ -["ACE3 Equipment", QGVAR(DistanceKey), localize "STR_ACE_Yardage450_PowerButtonKey", +["ACE3 Equipment", QGVAR(DistanceKey), LLSTRING(PowerButtonKey), { // Conditions: canInteract if !([ACE_player, objNull, ["isNotInside"]] call EFUNC(common,canInteractWith)) exitWith {false}; diff --git a/docs/wiki/development/coding-guidelines.md b/docs/wiki/development/coding-guidelines.md index 370a10275c..c80137dab3 100644 --- a/docs/wiki/development/coding-guidelines.md +++ b/docs/wiki/development/coding-guidelines.md @@ -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: `STR_ACE__` -Example: `STR_Balls_Banana` +Example: `STR_ACE_Balls_Banana` -Script strings (still require `localize` to localize the string): +Script strings: | Macro | Expands to | | -------|---------| |`LSTRING(banana)` | `"STR_ACE_balls_banana"` | +|`LLSTRING(banana)` | `localize "STR_ACE_balls_banana"` | |`ELSTRING(leg,banana)` | `"STR_ACE_leg_banana"` | +|`LELSTRING(leg,banana)` | `localize "STR_ACE_leg_banana"` | Config Strings (require `$` as first character): @@ -299,7 +301,7 @@ call { call { if (/* condition */) then { /* code */ - }; + }; }; }; ```