Skip to content

Commit

Permalink
Merge pull request #591 from bitpredator/dev
Browse files Browse the repository at this point in the history
refactor: support for translations through local files
  • Loading branch information
bitpredator authored Dec 26, 2023
2 parents fb92383 + 8464742 commit dc0745c
Show file tree
Hide file tree
Showing 7 changed files with 41 additions and 25 deletions.
3 changes: 2 additions & 1 deletion .github/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,4 +81,5 @@ fix lint error: unused argument last; accessing undefined variable Invoke; unuse
54. [bpt_ballasjob]: Fixed the problem that prevented the creation of invoices @bitpredator
55. [bpt_crafting]: Refactor: created support for translations natively through local files @bitpredator
56. [bpt_deliveries]: feat + chore: updated readme file + creation of Italian translation @bitpredator
57. [bpt_dustman]: refactor: bpt_dustman inventory implementation @bitpredator
57. [bpt_dustman]: refactor: bpt_dustman inventory implementation @bitpredator
58. [bpt_farmer]: refactor: support for translations through local files @bitpredator
11 changes: 7 additions & 4 deletions server-data/resources/[bpt_addons]/bpt_farmer/README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
# bpt_farmer
<h1 align='center'>bpt_farmer</a></h1>
<p align='center'><a href='https://discord.gg/ksGfNvDEfq'>Discord</a>

Copyright (C) 2022-2023 bitpredator

This program is a project for the fivem community, you have legal permission to distribute and / or modify it only if you have forked this repository, if it is not a fork repository, the version will be removed from the DMCA request.
This program Is free software: you can redistribute it And/Or modify it under the terms Of the GNU General Public License As published by the Free Software Foundation, either version 3 Of the License, Or (at your option) any later version.

This program Is distributed In the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty Of MERCHANTABILITY Or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License For more details.

ATTENTION:
You are not authorized to change the name of the resource.
You are not authorized to change the name of the resource and the resources within it.

If you want to contribute you can open a pull request.

You are not authorized to sell this software (this is free project).

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.
You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.
27 changes: 13 additions & 14 deletions server-data/resources/[bpt_addons]/bpt_farmer/client/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ local Keys = {
["NENTER"] = 201, ["N4"] = 108, ["N5"] = 60, ["N6"] = 107, ["N+"] = 96, ["N-"] = 97, ["N7"] = 117, ["N8"] = 61, ["N9"] = 118
}

local incollect = false
local incollect = false

ESX = exports["es_extended"]:getSharedObject()
RegisterNetEvent('esx:playerLoaded')
Expand Down Expand Up @@ -42,7 +42,7 @@ CreateThread(function()
Wait(0)
local coords = GetEntityCoords(PlayerPedId())
if (GetDistanceBetweenCoords(coords, 2233.21, 5081.3, 48.08, true) < 10.0) then
DrawText3D(2233.21, 5081.3, 48.08, 'Premi ~b~[E] per raccogliere delle patate', 0.4)
DrawText3D(2233.21, 5081.3, 48.08, _U('press_collect'), 0.4)
if ESX.GetPlayerData().job.name then
if (GetDistanceBetweenCoords(coords, 2233.21, 5081.3, 48.08, true) < 5.0) then
if IsControlJustReleased(0, Keys['E']) then
Expand All @@ -62,7 +62,7 @@ CreateThread(function()
Wait(0)
local coords = GetEntityCoords(PlayerPedId())
if (GetDistanceBetweenCoords(coords, 1582.035156, 2167.279053, 79.307007, true) < 10.0) then
DrawText3D(1582.035156, 2167.279053, 79.307007, 'Premi ~b~[E] per raccogliere del cotone', 0.4)
DrawText3D(1582.035156, 2167.279053, 79.307007, _U('press_collect'), 0.4)
if ESX.GetPlayerData().job.name then
if (GetDistanceBetweenCoords(coords, 1582.035156, 2167.279053, 79.307007, true) < 5.0) then
if IsControlJustReleased(0, Keys['E']) then
Expand All @@ -82,7 +82,7 @@ CreateThread(function()
Wait(0)
local coords = GetEntityCoords(PlayerPedId())
if (GetDistanceBetweenCoords(coords, 2343.850586, 4756.087891, 34.806641, true) < 10.0) then
DrawText3D(2343.850586, 4756.087891, 34.806641, 'Premi ~b~[E] per raccogliere delle mele', 0.4)
DrawText3D(2343.850586, 4756.087891, 34.806641, _U('press_collect'), 0.4)
if ESX.GetPlayerData().job.name then
if (GetDistanceBetweenCoords(coords, 2343.850586, 4756.087891, 34.806641, true) < 5.0) then
if IsControlJustReleased(0, Keys['E']) then
Expand All @@ -102,7 +102,7 @@ CreateThread(function()
Wait(0)
local coords = GetEntityCoords(PlayerPedId())
if (GetDistanceBetweenCoords(coords, 2607.942871, 4399.490234, 40.973633, true) < 10.0) then
DrawText3D(2607.942871, 4399.490234, 40.973633, 'Premi ~b~[E] per raccogliere il grano', 0.4)
DrawText3D(2607.942871, 4399.490234, 40.973633, _U('press_collect'), 0.4)
if ESX.GetPlayerData().job.name then
if (GetDistanceBetweenCoords(coords, 2607.942871, 4399.490234, 40.973633, true) < 5.0) then
if IsControlJustReleased(0, Keys['E']) then
Expand All @@ -118,10 +118,10 @@ end)


local blips = {
{title="Raccolta patate", colour=0, id=398, x = 2233.21, y = 5081.3, z = 48.08},
{title="Raccolta cotone", colour=0, id=398, x = 1582.035156, y = 2167.279053, z = 79.307007},
{title="Raccolta mele", colour=0, id=398, x = 2343.850586, y = 4756.087891, z = 34.806641},
{title="Raccolta grano", colour=0, id=398, x = 2607.942871, y = 4399.490234, z = 40.973633}
{title="Potato harvest", colour=0, id=398, x = 2233.21, y = 5081.3, z = 48.08},
{title="Cotton harvesting", colour=0, id=398, x = 1582.035156, y = 2167.279053, z = 79.307007},
{title="Apple picking", colour=0, id=398, x = 2343.850586, y = 4756.087891, z = 34.806641},
{title="Wheat harvest", colour=0, id=398, x = 2607.942871, y = 4399.490234, z = 40.973633}
}

CreateThread(function()
Expand All @@ -136,13 +136,12 @@ CreateThread(function()
AddTextComponentString(info.title)
EndTextCommandSetBlipName(info.blip)
end

end)

--potato
function collectionpotato()
TriggerServerEvent('farmer:collectionpotato')
exports["esx_notify"]:Notify("info", 3000, "Raccolta patate in corso")
exports["esx_notify"]:Notify("info", 3000, _U('collection_progress'))
incollect = true
Wait(6000)
incollect = false
Expand All @@ -151,7 +150,7 @@ end
-- cotton
function collectioncotton()
TriggerServerEvent('farmer:collectioncotton')
exports["esx_notify"]:Notify("info", 3000, "Raccolta cotone in corso")
exports["esx_notify"]:Notify("info", 3000, _U('collection_progress'))
incollect = true
Wait(6000)
incollect = false
Expand All @@ -160,7 +159,7 @@ end
-- apple
function collectionapple()
TriggerServerEvent('farmer:collectionapple')
exports["esx_notify"]:Notify("info", 3000, "Raccolta mele in corso")
exports["esx_notify"]:Notify("info", 3000, _U('collection_progress'))
incollect = true
Wait(6000)
incollect = false
Expand All @@ -169,7 +168,7 @@ end
-- grain
function collectiongrain()
TriggerServerEvent('farmer:collectiongrain')
exports["esx_notify"]:Notify("info", 3000, "Raccolta grano in corso")
exports["esx_notify"]:Notify("info", 3000, _U('collection_progress'))
incollect = true
Wait(6000)
incollect = false
Expand Down
2 changes: 2 additions & 0 deletions server-data/resources/[bpt_addons]/bpt_farmer/config.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Config = {}
Config.Locale = 'en'
15 changes: 9 additions & 6 deletions server-data/resources/[bpt_addons]/bpt_farmer/fxmanifest.lua
Original file line number Diff line number Diff line change
@@ -1,19 +1,22 @@
fx_version 'adamant'
game 'gta5'
description 'bpt_farmer, introduces various collection points for the crafting system (not a job)'
author'bitpredator'
version'1.0.0'
author 'bitpredator'
version '1.0.0'

shared_script '@es_extended/imports.lua'

client_script {
'@es_extended/locale.lua',
'client/main.lua',
'client/animated.lua'
'client/*.lua',
'locales/*.lua',
'config.lua',
}

server_scripts {
'@es_extended/locale.lua',
'server/main.lua',
'@oxmysql/lib/MySQL.lua'
'server/*.lua',
'@oxmysql/lib/MySQL.lua',
'locales/*.lua',
'config.lua',
}
4 changes: 4 additions & 0 deletions server-data/resources/[bpt_addons]/bpt_farmer/locales/en.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Locales['en'] = {
['press_collect'] = 'Press ~b~[E] to collect',
['collection_progress'] = 'Collection in progress'
}
4 changes: 4 additions & 0 deletions server-data/resources/[bpt_addons]/bpt_farmer/locales/it.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Locales['en'] = {
['press_collect'] = 'Premi ~b~[E] per raccogliere',
['collection_progress'] = 'Raccolta in corso'
}

0 comments on commit dc0745c

Please sign in to comment.