diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..2db2c82 --- /dev/null +++ b/.gitignore @@ -0,0 +1,12 @@ +# Backup Files +*.~ +*.old +*.bkp +*.backup + +# Files of POedit +*.mo + +# Arquivo de versionamento: +*.diff +*.patch diff --git a/init.lua b/init.lua index 4672ca8..5199094 100644 --- a/init.lua +++ b/init.lua @@ -3,7 +3,7 @@ modComputing = { modpath = core.get_modpath(core.get_current_modname()), } ---dofile(modComputing.modpath.."/translate.lua") +dofile(modComputing.modpath.."/translate.lua") dofile(modComputing.modpath.."/api.lua") dofile(modComputing.modpath.."/item_smartphone.lua") diff --git a/item_smartphone.lua b/item_smartphone.lua index 31566f7..8f2b193 100644 --- a/item_smartphone.lua +++ b/item_smartphone.lua @@ -1,13 +1,13 @@ modComputing.getTextNowWeekDay3S = function() local txtWeekDays3S = { - "Sun", --Sunday - "Mon", --Monday - "Tue", --Tuesday - "Wed", --Wednesday - "Thu", --Thursday - "Fri", --Friday - "Sat", --Saturday + modComputing.translate("Sun"), --Sunday + modComputing.translate("Mon"), --Monday + modComputing.translate("Tue"), --Tuesday + modComputing.translate("Wed"), --Wednesday + modComputing.translate("Thu"), --Thursday + modComputing.translate("Fri"), --Friday + modComputing.translate("Sat"), --Saturday } local totalDays = core.get_day_count() local nowRow = math.floor((totalDays-1)/7)+1 @@ -27,7 +27,12 @@ modComputing.getTextNowDate = function() local totalDays = core.get_day_count() local nowYear = totalDays/(28*4) local nowMount = (math.floor(totalDays/28)%4)+1 - local txtMounts3S = {"SPR", "SUM", "AUT", "WIN"} --SPRING, SUMMER, AUTUMN, WINTER + local txtMounts3S = { + modComputing.translate("SPR"), + modComputing.translate("SUM"), + modComputing.translate("AUT"), + modComputing.translate("WIN"), + } --SPRING, SUMMER, AUTUMN, WINTER local nowDay = math.floor(totalDays%28)+1 local nowDate = ("%04d-%3s-%02d"):format((nowYear+1), txtMounts3S[nowMount], nowDay) return nowDate @@ -47,8 +52,7 @@ modComputing.getFormSmartphone = function(player) .."image[0,0;"..(10*271/484)..",10.0;text_smartphone_271x484.png;true]" .."style_type[label;font=mono;font_size=11;textcolor=#FFFFFF]" .."label[0.75,1.975;"..core.formspec_escape(modComputing.getTextClockBar()).."]" - .."button_exit[0.75,2.50;1.5,1.5;btnClose;"..core.formspec_escape("Banana\nPhone").."]" - + .."button_exit[0.75,2.50;1.5,1.5;btnClose;"..core.formspec_escape(modComputing.translate("Banana\nStore")).."]" return formspec end @@ -59,13 +63,14 @@ end core.register_craftitem("computing:smartphone", { - description = "SMARTPHONE", + description = modComputing.translate("SMARTPHONE"), inventory_image = "icon_smartphone_128x128.png", on_use = function(itemstack, player, pointed_thing) modComputing.show_smartphone(player) end, }) +--[[ core.register_craft({ output = 'computing:smartphone', recipe = { @@ -74,6 +79,7 @@ core.register_craft({ {"" ,"" ,""}, } }) +--]] core.register_alias("smartphone", "computing:smartphone") diff --git a/mod.conf b/mod.conf index dd21f9c..534e3b7 100644 --- a/mod.conf +++ b/mod.conf @@ -1,2 +1,18 @@ name = computing -title = Computing \ No newline at end of file +title = Computing +description = Add multiple computing devices such as: Smartphones and Desktops. +version = 0.1.0 +dev_state = ALPHA +license = GNU AGPL-3.0 +media_license = CC BY-SA 4.0 +supported_games = minetest_game +depends = default,dye +optional_depends = +min_minetest_version = 5.7 +max_minetest_version = +author = Lunovox Heavenfinder: [email](mailto:lunovox@disroot.org), [social web](http:qoto.org/@lunovox), [webchat](https://cloud.disroot.org/call/9aa2t7ib), [xmpp](xmpp:lunovox@disroot.org?join), [Mumble](mumble:mumble.disroot.org), [more contacts](https:libreplanet.org/wiki/User:Lunovox) +created = 2024-11-10 10:42:01 +update = 2024-11-04 16:27 +donate_url = https://liberapay.com/Lunovox/donate +translation_url = https://gitlab.com/lunovox/computing/-/blob/master/locale/README.md +repository = https://gitlab.com/lunovox/computing diff --git a/screenshot.png b/screenshot.png new file mode 100644 index 0000000..10a350c Binary files /dev/null and b/screenshot.png differ diff --git a/translate.lua b/translate.lua new file mode 100644 index 0000000..5619f55 --- /dev/null +++ b/translate.lua @@ -0,0 +1,23 @@ +local ngettext + +--[[ +local S = core.get_translator('testmod') +core.register_craftitem('testmod:test', { + description = S('I am a test object'), + inventory_image = 'default_stick.png^[brighten' +}) +--]] + +if core.get_modpath("intllib") then + if intllib.make_gettext_pair then + -- New method using gettext. + modComputing.translate, ngettext = intllib.make_gettext_pair() + else + -- Old method using text files. + modComputing.translate = intllib.Getter() + end +elseif core.get_translator ~= nil and core.get_current_modname ~= nil and core.get_modpath(core.get_current_modname()) then + modComputing.translate = core.get_translator(core.get_current_modname()) +else + modComputing.translate = function(s) return s end +end