Skip to content

Commit

Permalink
Add localization support
Browse files Browse the repository at this point in the history
  • Loading branch information
oiad committed Oct 27, 2017
1 parent 1068104 commit 28aa0e9
Show file tree
Hide file tree
Showing 9 changed files with 216 additions and 50 deletions.
22 changes: 11 additions & 11 deletions dayz_code/configs/zscdialogs.hpp
Expand Up @@ -29,7 +29,7 @@ class GivePlayerDialog
class CashTitle5 : ZSC_RscStructuredText
{
idc = 2710;
text = "You";
text = $STR_ZSC_YOU;
colorText[] = {0.8784,0.8471,0.651,1};
x = 0.39;
y = 0.26;
Expand Down Expand Up @@ -59,7 +59,7 @@ class GivePlayerDialog
class Title2 : ZSC_RscTitle {
colorBackground[] = {0, 0, 0, 0};
idc = -1;
text = "Transfer Coins";
text = $STR_ZSC_TRANSFER_COINS;
colorText[] = {1,1,1,1};
x = 0.35;
y = 0.2;
Expand All @@ -69,7 +69,7 @@ class GivePlayerDialog
class DepositButton2 : ZSC_RscButtonMenu
{
idc = -1;
text = "Give";
text = $STR_ZSC_GIVE;
colorBackground[] = {"(profilenamespace getvariable ['GUI_BCG_RGB_R',0.3843])", "(profilenamespace getvariable ['GUI_BCG_RGB_G',0.7019])", "(profilenamespace getvariable ['GUI_BCG_RGB_B',0.8862])", 0.5};
onButtonClick = "[(ctrlText 14000)] spawn GivePlayerAmount; ((ctrlParent (_this select 0)) closeDisplay 9000);";
colorText[] = {0.8784,0.8471,0.651,1};
Expand All @@ -90,7 +90,7 @@ class GivePlayerDialog
};
class CloseButtonKey2 : ZSC_RscButtonMenu {
idc = -1;
text = "Close";
text = $STR_UI_CLOSE;
onButtonClick = "((ctrlParent (_this select 0)) closeDisplay 9000);";
x = 0.35;
y = 0.8 - (1 / 25);
Expand Down Expand Up @@ -132,7 +132,7 @@ class BankDialog
class CashTitle : ZSC_RscText
{
idc = 2701;
text = "Storage";
text = $STR_ZSC_STORAGE;
colorText[] = {0.8784,0.8471,0.651,1};
x = 0.36;
y = 0.26;
Expand Down Expand Up @@ -165,7 +165,7 @@ class BankDialog
class Title : ZSC_RscTitle {
colorBackground[] = {0, 0, 0, 0};
idc = -1;
text = "Storage";
text = $STR_ZSC_STORAGE;
colorText[] = {1,1,1,1};
x = 0.35;
y = 0.2;
Expand All @@ -176,7 +176,7 @@ class BankDialog
class WithdrawButton : ZSC_RscButtonMenu
{
idc = -1;
text = "Withdraw";
text = $STR_ZSC_WITHDRAW;
colorBackground[] = {"(profilenamespace getvariable ['GUI_BCG_RGB_R',0.3843])", "(profilenamespace getvariable ['GUI_BCG_RGB_G',0.7019])", "(profilenamespace getvariable ['GUI_BCG_RGB_B',0.8862])", 0.5};
onButtonClick = "[(ctrlText 2702)] spawn BankDialogWithdrawAmount; ((ctrlParent (_this select 0)) closeDisplay 9000);";
colorText[] = {0.8784,0.8471,0.651,1};
Expand All @@ -189,7 +189,7 @@ class BankDialog
class DepositButton : ZSC_RscButtonMenu
{
idc = -1;
text = "Deposit";
text = $STR_ZSC_DEPOSIT;
colorBackground[] = {"(profilenamespace getvariable ['GUI_BCG_RGB_R',0.3843])", "(profilenamespace getvariable ['GUI_BCG_RGB_G',0.7019])", "(profilenamespace getvariable ['GUI_BCG_RGB_B',0.8862])", 0.5};
onButtonClick = "[(ctrlText 2702)] spawn BankDialogDepositAmount; ((ctrlParent (_this select 0)) closeDisplay 9000);";
colorText[] = {0.8784,0.8471,0.651,1};
Expand All @@ -202,7 +202,7 @@ class BankDialog
class CashTitle3 : ZSC_RscStructuredText
{
idc = 2703;
text = "You";
text = $STR_ZSC_YOU;
colorText[] = {0.8784,0.8471,0.651,1};
x = 0.36;
y = 0.58;
Expand All @@ -223,12 +223,12 @@ class BankDialog

class CloseButtonKey : ZSC_RscButtonMenu {
idc = -1;
text = "Close";
text = $STR_UI_CLOSE;
onButtonClick = "((ctrlParent (_this select 0)) closeDisplay 9000);";
x = 0.35;
y = 0.8 - (1 / 25);
w = (6.25 / 40);
h = (1 / 25);
};
};
};
};
12 changes: 6 additions & 6 deletions global_banking/dayz_code/configs/zscATMdialogs.hpp
Expand Up @@ -28,7 +28,7 @@ class ATMDialog {
class Controls {
class CashTitle : ZSC_RscStructuredText {
idc = 3701;
text = "Bank";
text = $STR_ZSC_GLOBAL_BANK;
colorText[] = {0.8784,0.8471,0.651,1};
x = 0.39;
y = 0.26;
Expand Down Expand Up @@ -59,7 +59,7 @@ class ATMDialog {
class Title : ZSC_RscTitle {
colorBackground[] = {0, 0, 0, 0};
idc = -1;
text = "Banking";
text = $STR_ZSC_GLOBAL_BANKING;
colorText[] = {1,1,1,1};
x = 0.35;
y = 0.2;
Expand All @@ -69,7 +69,7 @@ class ATMDialog {

class WithdrawButton : ZSC_RscButtonMenu {
idc = -1;
text = "Withdraw";
text = $STR_ZSC_WITHDRAW;
colorBackground[] = {"(profilenamespace getvariable ['GUI_BCG_RGB_R',0.3843])", "(profilenamespace getvariable ['GUI_BCG_RGB_G',0.7019])", "(profilenamespace getvariable ['GUI_BCG_RGB_B',0.8862])", 0.5};
onButtonClick = "[(ctrlText 3702)] spawn AtmDialogWithdrawAmount; ((ctrlParent (_this select 0)) closeDisplay 9000);";
colorText[] = {0.8784,0.8471,0.651,1};
Expand All @@ -81,7 +81,7 @@ class ATMDialog {

class DepositButton : ZSC_RscButtonMenu {
idc = -1;
text = "Deposit";
text = $STR_ZSC_DEPOSIT;
colorBackground[] = {"(profilenamespace getvariable ['GUI_BCG_RGB_R',0.3843])", "(profilenamespace getvariable ['GUI_BCG_RGB_G',0.7019])", "(profilenamespace getvariable ['GUI_BCG_RGB_B',0.8862])", 0.5};
onButtonClick = "[(ctrlText 3702)] spawn AtmDialogDepositAmount; ((ctrlParent (_this select 0)) closeDisplay 9000);";
colorText[] = {0.8784,0.8471,0.651,1};
Expand All @@ -93,7 +93,7 @@ class ATMDialog {

class CashTitle3 : ZSC_RscStructuredText {
idc = 3703;
text = "You";
text = $STR_ZSC_YOU;
colorText[] = {0.8784,0.8471,0.651,1};
x = 0.39;
y = 0.58;
Expand All @@ -113,7 +113,7 @@ class ATMDialog {

class CloseButtonKey : ZSC_RscButtonMenu {
idc = -1;
text = "Close";
text = $STR_UI_CLOSE;
onButtonClick = "((ctrlParent (_this select 0)) closeDisplay 9000);";
x = 0.35;
y = 0.8 - (1 / 25);
Expand Down
4 changes: 2 additions & 2 deletions global_banking/scripts/zsc/atmDialog.sqf
@@ -1,4 +1,4 @@
if (dayz_actionInProgress) exitWith {"You are already performing an action, wait for the current action to finish." call dayz_rollingMessages;};
if (dayz_actionInProgress) exitWith {localize "str_player_actionslimit" call dayz_rollingMessages;};
dayz_actionInProgress = true;

private ["_dialog","_isBusy","_typeOf"];
Expand All @@ -10,7 +10,7 @@ _typeOf = typeOf cursorTarget;
if !(_typeOf in ZSC_bankObjects || _typeOf in ZSC_bankTraders) exitWith {
dayz_actionInProgress = false;
player setVariable["isBusy",false,true];
format ["%1 is not available for banking",_typeOf] call dayz_rollingMessages;
format [localize "STR_ZSC_BANKING_NOT_AVAIL",_typeOf] call dayz_rollingMessages;
};

_dialog = createdialog "atmDialog";
Expand Down
10 changes: 5 additions & 5 deletions global_banking/scripts/zsc/zscATMInit.sqf
Expand Up @@ -11,13 +11,13 @@ ATMDialogWithdrawAmount = {
_wealth = player getVariable [Z_moneyVariable,0];

if (_amount > 999999) exitWith {"You can not withdraw more than 999,999 coins at once." call dayz_rollingMessages};
if (_amount < 1 or {_amount > _bank}) exitWith {"You can not withdraw more than is in your bank." call dayz_rollingMessages};
if ((_amount < 1) or {_amount > _bank}) exitWith {format [localize "STR_ZSC_WITHDRAW_FAIL",CurrencyName,_displayName] call dayz_rollingMessages;};

player setVariable [Z_moneyVariable,(_wealth + _amount),true];
player setVariable [Z_bankVariable,(_bank - _amount),true];
call player_forceSave;

format["You have withdrawn %1 %2.",[_amount] call BIS_fnc_numberText,CurrencyName] call dayz_rollingMessages;
format[localize "STR_ZSC_GLOBAL_WITHDRAW",[_amount] call BIS_fnc_numberText,CurrencyName] call dayz_rollingMessages;
};

ATMDialogDepositAmount = {
Expand All @@ -28,14 +28,14 @@ ATMDialogDepositAmount = {
_wealth = player getVariable [Z_MoneyVariable,0];

if (_amount > 999999) exitWith {"You can not deposit more than 999,999 coins at once." call dayz_rollingMessages};
if (_amount < 1 or {_amount > _wealth}) exitWith {"You can not deposit more than you have." call dayz_rollingMessages};
if ((_amount < 1) or {_amount > _wealth}) exitWith {format [localize "STR_ZSC_DEPOSIT_FAIL",CurrencyName] call dayz_rollingMessages;};

if (ZSC_limitOnBank && {(_bank + _amount) > ZSC_maxBankMoney}) then {
format["You can only have a max of %1 %2", [ZSC_maxBankMoney] call BIS_fnc_numberText,CurrencyName] call dayz_rollingMessages;
format[localize "STR_ZSC_GLOBAL_DEPOSIT_FAIL", [ZSC_maxBankMoney] call BIS_fnc_numberText,CurrencyName] call dayz_rollingMessages;
} else {
player setVariable [Z_MoneyVariable,(_wealth - _amount),true];
player setVariable [Z_bankVariable,(_bank + _amount),true];
format["You have deposited %1 %2",[_amount] call BIS_fnc_numberText,CurrencyName] call dayz_rollingMessages;
format[localize "STR_ZSC_GLOBAL_DEPOSIT_OK",[_amount] call BIS_fnc_numberText,CurrencyName] call dayz_rollingMessages;
call player_forceSave;
};
};
8 changes: 4 additions & 4 deletions scripts/zsc/bankDialog.sqf
@@ -1,4 +1,4 @@
if (dayz_actionInProgress) exitWith {"You are already performing an action, wait for the current action to finish." call dayz_rollingMessages;};
if (dayz_actionInProgress) exitWith {localize "str_player_actionslimit" call dayz_rollingMessages;};
dayz_actionInProgress = true;

private ["_dialog","_playerNear","_isBusy","_typeOf"];
Expand All @@ -11,7 +11,7 @@ _typeOf = typeOf ZSC_CurrentStorage;
if !(_typeOf in DZE_MoneyStorageClasses) exitWith {
dayz_actionInProgress = false;
player setVariable["isBusy",false,true];
format ["%1 is not available for banking",_typeOf] call dayz_rollingMessages;
format [localize "STR_ZSC_BANKING_NOT_AVAIL",_typeOf] call dayz_rollingMessages;
};

_playerNear = {isPlayer _x} count ((getPosATL cursortarget) nearEntities ["CAManBase", 10]) > 1;
Expand All @@ -25,11 +25,11 @@ _isBusy = ZSC_CurrentStorage getVariable["isBusy",false];
if (_isBusy) exitwith {
dayz_actionInProgress = false;
player setVariable["isBusy",false,true];
format ["%1 is currently being banked with",_typeOf] call dayz_rollingMessages;
format [localize "STR_ZSC_BANKING_IN_USE",_typeOf] call dayz_rollingMessages;
};

ZSC_CurrentStorage setVariable["isBusy",true,true];
_dialog = createDialog "BankDialog";
call BankDialogUpdateAmounts;

dayz_actionInProgress = false;
dayz_actionInProgress = false;
8 changes: 4 additions & 4 deletions scripts/zsc/checkWallet.sqf
@@ -1,6 +1,6 @@
private ["_body","_playerNear","_name","_hisMoney","_myMoney"];

if (dayz_actionInProgress) exitWith {"You are already performing an action, wait for the current action to finish." call dayz_rollingMessages;};
if (dayz_actionInProgress) exitWith {localize "str_player_actionslimit" call dayz_rollingMessages;};
dayz_actionInProgress = true;

_body = _this select 3;
Expand All @@ -14,17 +14,17 @@ _name = _body getVariable ["bodyName","unknown"];
_hisMoney = _body getVariable [Z_MoneyVariable,0];

if (isNil "_hisMoney") then { _hisMoney = 0;};
if (!(typeName _hisMoney == "SCALAR") || {_hisMoney < 1}) exitWith {dayz_actionInProgress = false; format ["%1 has no %2",_name,CurrencyName] call dayz_rollingMessages};
if (!(typeName _hisMoney == "SCALAR") || {_hisMoney < 1}) exitWith {dayz_actionInProgress = false; format [localize "STR_ZSC_NO_COINS",_name,CurrencyName] call dayz_rollingMessages};

_myMoney = player getVariable [Z_MoneyVariable,0];
_myMoney = _myMoney + _hisMoney;

_body setVariable [Z_MoneyVariable,0,true];
player setVariable [Z_MoneyVariable,_myMoney,true];

systemChat format ["You took %1 %2, ID says %3!",[_hisMoney] call BIS_fnc_numberText,CurrencyName,_name];
systemChat format [localize "STR_ZSC_TAKE_COINS",[_hisMoney] call BIS_fnc_numberText,CurrencyName,_name];

player playActionNow "PutDown";
uiSleep 2;

dayz_actionInProgress = false;
dayz_actionInProgress = false;
6 changes: 3 additions & 3 deletions scripts/zsc/givePlayer.sqf
Expand Up @@ -11,15 +11,15 @@ if (isPlayer cursorTarget) then {
_isBusy = ZSC_GiveMoneyTarget getVariable["isBusy",false];
if (_isBusy) exitWith {
player setVariable ["isBusy",false,true];
format ["%1 is already trading, please try again.",name ZSC_GiveMoneyTarget] call dayz_rollingMessages;
format [localize "STR_ZSC_ALREADY_TRADING",name ZSC_GiveMoneyTarget] call dayz_rollingMessages;
};
if (!_isBusy) then {
player setVariable["isBusy",true,true];
_dialog = createdialog "GivePlayerDialog";
call GivePlayerDialogAmounts;
};
} else {
"You are not looking at a player." call dayz_rollingMessages;
localize "STR_ZSC_NOT_PLAYER" call dayz_rollingMessages;
};

dayz_actionInProgress = false;
dayz_actionInProgress = false;
29 changes: 14 additions & 15 deletions scripts/zsc/zscInit.sqf
Expand Up @@ -11,14 +11,14 @@ BankDialogUpdateAmounts = {
ctrlSetText [13001,format ["%1 %2",[player getVariable [Z_MoneyVariable,0]] call BIS_fnc_numberText,CurrencyName]];
ctrlSetText [13002,format ["%1 / %3 %2",[ZSC_CurrentStorage getVariable [Z_MoneyVariable,0]] call BIS_fnc_numberText,CurrencyName,[_sizeOfMoney] call BIS_fnc_numberText]];
} else {
ctrlSetText [13001,format ["Can not get vehicle capacity!","test"]];
ctrlSetText [13002,format ["Can not get vehicle capacity!","test"]];
ctrlSetText [13001,localize "STR_ZSC_VEHICLE_CAPACITY"];
ctrlSetText [13002,localize "STR_ZSC_VEHICLE_CAPACITY"];
};
};

GivePlayerDialogAmounts = {
ctrlSetText [14001, format ["%1 %2",[player getVariable [Z_MoneyVariable,0]] call BIS_fnc_numberText,CurrencyName]];
ctrlSetText [14003,format ["%1",(name ZSC_GiveMoneyTarget)]];
ctrlSetText [14003,format ["%1",name ZSC_GiveMoneyTarget]];
};

BankDialogWithdrawAmount = {
Expand All @@ -31,7 +31,7 @@ BankDialogWithdrawAmount = {
_displayName = getText (configFile >> "CfgVehicles" >> _vehicleType >> "displayName");

if (!isNull ZSC_CurrentStorage) then {
if ((_amount < 1) or {_amount > _bank}) exitWith {format ["You can not withdraw more %1 than is in the %2.",CurrencyName,_displayName] call dayz_rollingMessages;};
if ((_amount < 1) or {_amount > _bank}) exitWith {format [localize "STR_ZSC_WITHDRAW_FAIL",CurrencyName,_displayName] call dayz_rollingMessages;};

player setVariable[Z_MoneyVariable,(_wealth + _amount),true];
ZSC_CurrentStorage setVariable[Z_MoneyVariable,(_bank - _amount),true];
Expand All @@ -40,9 +40,9 @@ BankDialogWithdrawAmount = {
PVDZ_veh_Save = [ZSC_CurrentStorage,"coins"];
publicVariableServer "PVDZ_veh_Save";

format ["You have withdrawn %1 %2 out of the %3",[_amount] call BIS_fnc_numberText,CurrencyName,_displayName] call dayz_rollingMessages;
format [localize "STR_ZSC_WITHDRAW_OK",[_amount] call BIS_fnc_numberText,CurrencyName,_displayName] call dayz_rollingMessages;
} else {
"Unable to access Money Storage. Please try again." call dayz_rollingMessages;
localize "STR_ZSC_UNABLE" call dayz_rollingMessages;
};
};

Expand All @@ -63,15 +63,15 @@ BankDialogDepositAmount = {
_amount = parseNumber (_this select 0);
_bank = ZSC_CurrentStorage getVariable [Z_MoneyVariable,0];
_wealth = player getVariable[Z_MoneyVariable,0];
if ((_amount < 1) or {_amount > _wealth}) exitWith {"You can not deposit more than what you have." call dayz_rollingMessages;};

if ((_amount < 1) or {_amount > _wealth}) exitWith {format [localize "STR_ZSC_DEPOSIT_FAIL",CurrencyName] call dayz_rollingMessages;};

if ((_bank + _amount) > _maxCap) then {
format ["You can only store a maximum of %1 %2 into the %3.",[_maxCap] call BIS_fnc_numberText,CurrencyName,_displayName] call dayz_rollingMessages;
format [localize "STR_ZSC_STORE_FAIL",[_maxCap] call BIS_fnc_numberText,CurrencyName,_displayName] call dayz_rollingMessages;
} else {
player setVariable[Z_MoneyVariable,(_wealth - _amount),true];
ZSC_CurrentStorage setVariable[Z_MoneyVariable,(_bank + _amount),true];
format ["You have deposited %1 %2 into the %3.",[_amount] call BIS_fnc_numberText,CurrencyName,_displayName] call dayz_rollingMessages;
format [localize "STR_ZSC_DEPOSIT_OK",[_amount] call BIS_fnc_numberText,CurrencyName,_displayName] call dayz_rollingMessages;
};

call player_forceSave;
Expand All @@ -88,17 +88,16 @@ GivePlayerAmount = {
_isBusy = ZSC_GiveMoneyTarget getVariable ["isBusy",false];
_vehicleType = typeOf ZSC_GiveMoneyTarget;

if ((_amount < 1) or {_amount > _wealth}) exitWith {"You can not give more than you currently have." call dayz_rollingMessages;};
if ((_amount < 1) or {_amount > _wealth}) exitWith {localize "STR_ZSC_GIVE_FAIL" call dayz_rollingMessages;};

if (!(isPlayer ZSC_GiveMoneyTarget)) exitWith {"You can only give money to a player" call dayz_rollingMessages;};
if (!(isPlayer ZSC_GiveMoneyTarget)) exitWith {format [localize "STR_ZSC_GIVE_PLAYER",CurrencyName] call dayz_rollingMessages;};

if (_isBusy) exitWith {format ["%1 is already trading, please try again.",name ZSC_GiveMoneyTarget] call dayz_rollingMessages;};
if (_isBusy) exitWith {format [localize "STR_ZSC_ALREADY_TRADING",name ZSC_GiveMoneyTarget] call dayz_rollingMessages;};

player setVariable[Z_MoneyVariable,_wealth - _amount,true];
ZSC_GiveMoneyTarget setVariable[Z_MoneyVariable,_twealth + _amount,true];

call player_forceSave;
ZSC_GiveMoneyTarget call player_forceSave;

format ["You gave %1 %2 %3.",name ZSC_GiveMoneyTarget,[_amount] call BIS_fnc_numberText,CurrencyName] call dayz_rollingMessages;
format [localize "STR_ZSC_GIVE_OK",name ZSC_GiveMoneyTarget,[_amount] call BIS_fnc_numberText,CurrencyName] call dayz_rollingMessages;
};

0 comments on commit 28aa0e9

Please sign in to comment.