Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add language load support for NUI and other fix. #121

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 16 additions & 4 deletions client.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,25 @@ local zones = {}

-- Functions

local function getTranslation()
local translation = {}
for k in pairs(Lang.fallback and Lang.fallback.phrases or Lang.phrases) do
if k:sub(0, ('ui.'):len()) then
translation[k:sub(('ui.'):len() + 1)] = Lang:t(k)
end
end
return translation
end

local function OpenBank()
QBCore.Functions.TriggerCallback('qb-banking:server:openBank', function(accounts, statements, playerData)
SetNuiFocus(true, true)
SendNUIMessage({
action = 'openBank',
accounts = accounts,
statements = statements,
playerData = playerData
playerData = playerData,
translation = getTranslation()
})
end)
end
Expand All @@ -36,7 +47,8 @@ local function OpenATM()
action = 'openATM',
accounts = accounts,
pinNumbers = acceptablePins,
playerData = playerData
playerData = playerData,
translation = getTranslation()
})
end)
end)
Expand Down Expand Up @@ -153,7 +165,7 @@ if Config.useTarget then
options = {
{
icon = 'fas fa-university',
label = 'Open Bank',
label = Lang:t('ui.openBank'),
action = function()
OpenBank()
end,
Expand All @@ -171,7 +183,7 @@ if Config.useTarget then
options = {
{
icon = 'fas fa-university',
label = 'Open ATM',
label = Lang:t('ui.openAtm'),
item = 'bank_card',
action = function()
OpenATM()
Expand Down
100 changes: 50 additions & 50 deletions html/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,23 +15,23 @@
<div class="sidebar">
<div class="sidebar-header">
{{ playerName }}<br />
Cash: <span class="positive-balance">${{ formatCurrency(playerCash) }}</span>
{{t('cash')}}: <span class="positive-balance">${{ formatCurrency(playerCash) }}</span>
</div>
<div class="sidebar-accounts">
<ul>
<li v-for="account in accounts" :key="account.name" :class="{ 'sidebar-selected': account.name === selectedAccountStatement }" @click="selectAccount(account)">{{ account.name }}: <span class="positive-balance">${{ formatCurrency(account.balance) }}</span></li>
</ul>
</div>
<button class="action-button" @click="closeApplication()">Logout</button>
<div class="sidebar-footer">Account Number: {{ accountNumber }}</div>
<div class="sidebar-footer"> {{ t('accountNumber') }} {{ accountNumber }}</div>
</div>
<div class="main-content">
<div class="nav-bar">
<div class="nav-options">
<div class="nav-option" :class="{selected: activeView === 'home'}" @click="setActiveView('home')">Home</div>
<div class="nav-option" :class="{selected: activeView === 'money'}" @click="setActiveView('money')">Money</div>
<div class="nav-option" :class="{selected: activeView === 'transfer'}" @click="setActiveView('transfer')">Transfer</div>
<div class="nav-option" :class="{selected: activeView === 'accountOptions'}" @click="setActiveView('accountOptions')">Account Options</div>
<div class="nav-option" :class="{selected: activeView === 'home'}" @click="setActiveView('home')">{{t('home')}}</div>
<div class="nav-option" :class="{selected: activeView === 'money'}" @click="setActiveView('money')">{{t('money')}}</div>
<div class="nav-option" :class="{selected: activeView === 'transfer'}" @click="setActiveView('transfer')">{{ t('transfer') }}</div>
<div class="nav-option" :class="{selected: activeView === 'accountOptions'}" @click="setActiveView('accountOptions')">{{ t('accountOptions')}}</div>
</div>
<div class="notification-container" v-if="notification">
<div :class="['notification', notification.type]">{{ notification.message }}</div>
Expand All @@ -47,84 +47,84 @@
</div>
<div v-if="activeView === 'money'" class="money">
<div class="manage-money">
<div class="money-title">Money Management</div>
<label for="fromAccount">Account:</label>
<div class="money-title">{{t('moneyManagement')}}</div>
<label for="fromAccount">{{t('account')}}</label>
<select id="fromAccount" v-model="selectedMoneyAccount">
<option v-for="account in accounts" :key="account.name" :value="account">{{ account.name }}</option>
</select>
<label for="amount">Amount:</label>
<label for="amount">{{ t('amount') }}</label>
<input type="number" id="amount" v-model="selectedMoneyAmount" />
<label for="money-reason">Reason:</label>
<label for="money-reason">{{t('reason')}}</label>
<input type="text" id="money-reason" v-model="moneyReason" />
<div class="card-buttons">
<button class="action-button" @click="withdrawMoney">Withdraw</button>
<button class="action-button" @click="depositMoney">Deposit</button>
<button class="action-button" @click="withdrawMoney">{{t('withdraw')}}</button>
<button class="action-button" @click="depositMoney">{{ t('deposit') }}</button>
</div>
</div>
</div>
<div v-if="activeView === 'transfer'" class="transfer">
<div class="transfer-header">
<div class="nav-option" :class="{selected: transferType === 'internal'}" @click="setTransferType('internal')">Internal</div>
<span class="money-title">Transfer</span>
<div class="nav-option" :class="{selected: transferType === 'external'}" @click="setTransferType('external')">External</div>
<div class="nav-option" :class="{selected: transferType === 'internal'}" @click="setTransferType('internal')">{{t('internal')}}</div>
<span class="money-title">{{t('transfer')}}</span>
<div class="nav-option" :class="{selected: transferType === 'external'}" @click="setTransferType('external')">{{t('external')}}</div>
</div>
<div v-if="transferType === 'internal'" class="transfer-options">
<label for="internalFrom">Account:</label>
<label for="internalFrom">{{ t('account') }}</label>
<select id="internalFrom" v-model="internalFromAccount">
<option v-for="account in accounts" :key="account.name" :value="account">{{ account.name }}</option>
</select>
<label for="internalTo">Account:</label>
<label for="internalTo">{{ t('account') }}</label>
<select id="internalTo" v-model="internalToAccount">
<option v-for="account in accounts" :key="account.name" :value="account">{{ account.name }}</option>
</select>
<label for="internalAmount">Amount:</label>
<label for="internalAmount">{{ t('amount') }}</label>
<input type="number" id="internalAmount" v-model="internalTransferAmount" />
<label for="transfer-reason">Reason:</label>
<label for="transfer-reason">{{ t('reason') }}</label>
<input type="text" id="transfer-reason" v-model="transferReason" />
<button class="action-button" @click="internalTransfer">Transfer</button>
<button class="action-button" @click="internalTransfer"> {{ t('transfer') }} </button>
</div>
<div v-if="transferType === 'external'" class="transfer-options">
<label for="externalAccountNumber">Account Number:</label>
<label for="externalAccountNumber">{{ t('accountNumber') }}</label>
<input type="text" id="externalAccountNumber" v-model="externalAccountNumber" />
<label for="externalFrom">Account:</label>
<label for="externalFrom">{{ t('account') }}</label>
<select id="externalFrom" v-model="externalFromAccount">
<option v-for="account in accounts" :key="account.name" :value="account">{{ account.name }}</option>
</select>
<label for="externalAmount">Amount:</label>
<label for="externalAmount">{{ t('amount') }}</label>
<input type="number" id="externalAmount" v-model="externalTransferAmount" />
<label for="transfer-reason">Reason:</label>
<label for="transfer-reason">{{ t('reason') }}</label>
<input type="text" id="transfer-reason" v-model="transferReason" />
<button class="action-button" @click="externalTransfer">Transfer</button>
<button class="action-button" @click="externalTransfer"> {{ t('transfer') }} </button>
</div>
</div>
<div v-if="activeView === 'accountOptions'" class="account-options">
<div class="debit-card">
<div>Order Debit Card</div>
<label for="pin-number">Pin Number:</label>
<div>{{ t('orderDebitCard') }}</div>
<label for="pin-number">{{ t('pinNumber') }}</label>
<input type="number" id="pin-number" v-model="debitPin" />
<div class="card-buttons">
<button class="action-button" @click="orderDebitCard">Order</button>
</div>
</div>
<div class="create-account">
<div>Open Shared Account</div>
<div>{{ t('openSharedAccount') }} </div>
<div class="options-labels">
<label for="createAccountName">Name:</label>
<label for="createAccountAmount">Amount:</label>
<label for="createAccountName">{{ t('name') }}</label>
<label for="createAccountAmount">{{ t('amount') }}</label>
</div>
<div class="options-inputs">
<input type="text" id="createAccountName" v-model="createAccountName" />
<input type="number" id="createAccountAmount" v-model="createAccountAmount" />
</div>
<div class="card-buttons">
<button class="action-button" @click="openAccount">Open Account</button>
<button class="action-button" @click="openAccount"> {{ t('openAccount') }}</button>
</div>
</div>
<div class="edit-account">
<div>Manage Shared Account</div>
<div>{{ t('manageSharedAccount') }}</div>
<div class="options-labels">
<label for="editAccount">Account:</label>
<label for="editAccountName">Name:</label>
<label for="editAccount">{{ t('account') }}</label>
<label for="editAccountName">{{ t('name') }}</label>
</div>
<div class="options-inputs">
<select id="editAccount" v-model="editAccount">
Expand All @@ -133,14 +133,14 @@
<input type="text" id="editAccountName" v-model="editAccountName" />
</div>
<div class="card-buttons">
<button class="action-button" @click="deleteAccount">Delete</button>
<button class="action-button" @click="renameAccount">Rename</button>
<button class="action-button" @click="deleteAccount">{{ t('delete') }} </button>
<button class="action-button" @click="renameAccount">{{ t('rename') }}</button>
</div>
</div>
<div class="manage-account">
<div>Manage Account Users</div>
<div class="options-labels">
<label for="manageAccountName">Account:</label>
<label for="manageAccountName">{{ t('account') }}</label>
<label for="manageUserName">Citizen ID:</label>
</div>
<div class="options-inputs">
Expand All @@ -159,8 +159,8 @@
</div>
</div>
<div class="card-buttons">
<button class="action-button" @click="addUserToAccount">Add</button>
<button class="action-button" @click="removeUserFromAccount">Remove</button>
<button class="action-button" @click="addUserToAccount">{{t('add')}}</button>
<button class="action-button" @click="removeUserFromAccount">{{t('remove')}}</button>
</div>
</div>
</div>
Expand All @@ -170,49 +170,49 @@
<div class="sidebar">
<div class="sidebar-header">
{{ playerName }}<br />
Cash: <span class="positive-balance">${{ formatCurrency(playerCash) }}</span>
{{ t('cash') }} <span class="positive-balance">${{ formatCurrency(playerCash) }}</span>
</div>
<div class="sidebar-accounts">
<ul>
<li v-for="account in accounts" :key="account.name">{{ account.name }}: <span class="positive-balance">${{ formatCurrency(account.balance) }}</span></li>
</ul>
</div>
<button class="action-button" @click="closeApplication()">Logout</button>
<div class="sidebar-footer">Account Number: {{ accountNumber }}</div>
<div class="sidebar-footer">{{ t('accountNumber') }} {{ accountNumber }}</div>
</div>
<div class="main-content">
<div class="money">
<div class="manage-money">
<div class="money-title">Withdraw</div>
<label for="fromAccount">Account:</label>
<div class="money-title">{{ t('withdraw') }}</div>
<label for="fromAccount">{{ t('account') }}</label>
<select id="fromAccount" v-model="selectedMoneyAccount">
<option v-for="account in accounts" :key="account.name" :value="account">{{ account.name }}</option>
</select>
<label for="amount">Amount:</label>
<label for="amount">{{ t('amount') }}</label>
<input type="number" id="amount" v-model="selectedMoneyAmount" />
<label for="money-reason">Reason:</label>
<label for="money-reason">{{ t('reason') }}</label>
<input type="text" id="money-reason" v-model="moneyReason" />
<div class="card-buttons">
<button class="action-button" @click="withdrawMoney">Withdraw</button>
<button class="action-button" @click="withdrawMoney">{{ t('withdraw') }}</button>
</div>
</div>
</div>
</div>
</div>
<div v-if="showPinPrompt" class="pin-prompt">
<div class="pin-input">
<input type="password" v-model="enteredPin" placeholder="Enter PIN" readonly />
<input type="password" v-model="enteredPin" :placeholder="t('enterPin')" readonly />
</div>
<div class="number-pad">
<button v-for="number in 9" :key="number" @click="appendNumber(number)">{{ number }}</button>
<button @click="appendNumber(0)">0</button>
</div>
<div class="card-buttons">
<button class="action-button" @click="enteredPin = ''">Clear</button>
<button class="action-button" @click="pinPrompt(enteredPin)">Submit</button>
<button class="action-button" @click="enteredPin = ''">{{ t('clear') }}</button>
<button class="action-button" @click="pinPrompt(enteredPin)">{{ t('submit') }}</button>
</div>
</div>
</div>
</body>
<script src="script.js"></script>
<script src="script.js" defer></script>
</html>
Loading
Loading