13 Commits

Author SHA1 Message Date
7f60263eaa WIP idée : traduire les messages avec le translator pour raccourcir les messages affichés et dans une seule langue.
Branche pour test/demonstration.
Casserait la compatibilité du mod le cas écheant car spécialement pour le serveur nalc.
2022-07-07 23:52:21 +02:00
1bd68f932f Merge remote-tracking branch 'upstream/master' 2022-06-26 11:47:32 +02:00
5682172106 Merge pull request #8 from sys4-fr/master
Mod refresh and remove intllib support to Minetest translator
2022-06-26 13:08:26 +08:00
fc37a4b303 Merge branch 'github' 2022-06-25 21:49:35 +02:00
0895cf7ce4 Mod refresh and remove intllib support to Minetest translator
- Remove depends.txt
- Update mod.conf
- Add settingtypes.txt for interval between two subsequent messages
2022-06-25 21:22:38 +02:00
9ef432bd8b Merge branch 'master' into nalc-1.2 2019-05-10 01:46:18 +02:00
bb61f68038 Merge pull request #7 from zeuner/bugfix1
api compatibility
2019-01-10 19:59:32 -05:00
48c2553798 Merge pull request #6 from zeuner/bugfix2
Bugfixes related to messages file
2019-01-09 09:26:05 -05:00
e4c5ba1c85 Merge pull request #5 from zeuner/integration
add mod.conf
2019-01-08 21:34:46 -05:00
7db0c9c50b avoid crash on missing messages file 2017-10-06 03:14:45 +02:00
17d2fd9f75 avoid error on closing null file handle 2017-10-06 02:56:20 +02:00
24974e109b api compatibility 2017-10-06 02:36:51 +02:00
e9e5bb7bef add mod.conf 2017-09-29 21:53:57 +02:00
10 changed files with 184 additions and 160 deletions

View File

@ -1 +0,0 @@
intllib?

View File

@ -13,9 +13,18 @@ math.randomseed(os.time())
random_messages = {} random_messages = {}
random_messages.messages = {} --This table contains all messages. random_messages.messages = {} --This table contains all messages.
-- Load support for intllib. local S
local MP = minetest.get_modpath(minetest.get_current_modname()) if minetest.get_translator ~= nil then
local S, NS = dofile(MP.."/intllib.lua") S = minetest.get_translator("random_messages")
else
S = function(str, ...)
local args={...}
return str:gsub(
"@%d+",
function(match) return args[tonumber(match:sub(2))] end
)
end
end
function table.count( t ) function table.count( t )
local i = 0 local i = 0
@ -32,14 +41,8 @@ function table.random( t )
end end
end end
function random_messages.initialize() --Set the interval in minetest.conf.
minetest.settings:set("random_messages_interval",120)
minetest.settings:save()
return 120
end
function random_messages.set_interval() --Read the interval from minetest.conf(set it if it doesn'st exist) function random_messages.set_interval() --Read the interval from minetest.conf(set it if it doesn'st exist)
MESSAGE_INTERVAL = tonumber(minetest.settings:get("random_messages_interval")) or random_messages.initialize() MESSAGE_INTERVAL = tonumber(minetest.settings:get("random_messages_interval") or 120)
end end
function random_messages.check_params(name,func,params) function random_messages.check_params(name,func,params)
@ -62,8 +65,9 @@ function random_messages.read_messages()
local output = io.open(minetest.get_worldpath().."/random_messages","w") local output = io.open(minetest.get_worldpath().."/random_messages","w")
if not default_input then if not default_input then
-- blame the admin if not found -- blame the admin if not found
output:write(S("Blame the server admin! He/She has probably not edited the random messages yet.\n")) output:write(S("Blame the server admin! He/She has probably not edited the random messages yet.").."\n")
output:write(S("Tell your dumb admin that this line is in (worldpath)/random_messages\n")) output:write(S("Tell your dumb admin that this line is in (worldpath)/random_messages").."\n")
return
else else
-- or write default_input content in worldpath message file -- or write default_input content in worldpath message file
local content = default_input:read("*all") local content = default_input:read("*all")
@ -84,7 +88,7 @@ end
function random_messages.display_message(message_number) function random_messages.display_message(message_number)
local msg = random_messages.messages[message_number] or message_number local msg = random_messages.messages[message_number] or message_number
if msg then if msg then
minetest.chat_send_all(msg) minetest.chat_send_all(S(msg))
end end
end end
@ -123,13 +127,15 @@ random_messages.set_interval()
random_messages.read_messages() random_messages.read_messages()
local TIMER = 0 local TIMER = 0
minetest.register_globalstep(function(dtime) if random_messages.messages[1] then
TIMER = TIMER + dtime; minetest.register_globalstep(function(dtime)
if TIMER > MESSAGE_INTERVAL then TIMER = TIMER + dtime;
random_messages.show_message() if TIMER > MESSAGE_INTERVAL then
TIMER = 0 random_messages.show_message()
end TIMER = 0
end) end
end)
end
local register_chatcommand_table = { local register_chatcommand_table = {
params = "viewmessages | removemessage <number> | addmessage <number>", params = "viewmessages | removemessage <number> | addmessage <number>",

View File

@ -1,45 +0,0 @@
-- Fallback functions for when `intllib` is not installed.
-- Code released under Unlicense <http://unlicense.org>.
-- Get the latest version of this file at:
-- https://raw.githubusercontent.com/minetest-mods/intllib/master/lib/intllib.lua
local function format(str, ...)
local args = { ... }
local function repl(escape, open, num, close)
if escape == "" then
local replacement = tostring(args[tonumber(num)])
if open == "" then
replacement = replacement..close
end
return replacement
else
return "@"..open..num..close
end
end
return (str:gsub("(@?)@(%(?)(%d+)(%)?)", repl))
end
local gettext, ngettext
if minetest.get_modpath("intllib") then
if intllib.make_gettext_pair then
-- New method using gettext.
gettext, ngettext = intllib.make_gettext_pair()
else
-- Old method using text files.
gettext = intllib.Getter()
end
end
-- Fill in missing functions.
gettext = gettext or function(msgid, ...)
return format(msgid, ...)
end
ngettext = ngettext or function(msgid, msgid_plural, n, ...)
return format(n==1 and msgid or msgid_plural, ...)
end
return gettext, ngettext

View File

@ -1,50 +0,0 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-08-04 15:04+0200\n"
"PO-Revision-Date: 2017-08-04 15:05+0200\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: Poedit 1.8.12\n"
"Last-Translator: fat115 <fat115@framasoft.org>\n"
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
"Language: fr\n"
#: init.lua
msgid ""
"Blame the server admin! He/She has probably not edited the random messages "
"yet.\n"
msgstr ""
"Tirez les oreilles à l'administrateur du serveur. Il/elle n'a pas encore "
"modifié les messages aléatoires.\n"
#: init.lua
msgid ""
"Tell your dumb admin that this line is in (worldpath)/random_messages\n"
msgstr ""
"Dites à votre administrateur à la noix que cette ligne se trouve dans "
"(worldpath)/random_messages\n"
#: init.lua
msgid "View and/or alter the server's random messages"
msgstr "Afficher et/ou modifier les messages aléatoires du serveur"
#: init.lua
msgid "ERROR: No such message."
msgstr "ERREUR : ce message est inexistant."
#: init.lua
msgid "ERROR: No message."
msgstr "ERREUR : pas de message."
#: init.lua
msgid "ERROR: Invalid command."
msgstr "ERREUR : Commande invalide."

View File

@ -0,0 +1,63 @@
# textdomain: random_messages
Blame the server admin! He/She has probably not edited the random messages yet.=Tirez les oreilles à l'administrateur du serveur. Il/elle n'a pas encore modifié les messages aléatoires.
Tell your dumb admin that this line is in (worldpath)/random_messages=Dites à votre administrateur à la noix que cette ligne se trouve dans (worldpath)/random_messages
View and/or alter the server's random messages=Afficher et/ou modifier les messages aléatoires du serveur
ERROR: No such message.=ERREUR : ce message est inexistant.
ERROR: No message.=ERREUR : pas de message.
ERROR: Invalid command.=ERREUR : Commande invalide.
Tip: To be able to crafter quarry that are limited on the server, you will need to have experience in mining. Take a look at the awards list.=Astuce : Pour pouvoir crafter des quarry qui sont limités sur le serveur, vous devrez faire preuve d'expérience dans le minage. Jetez un œuil dans la liste des awards..
Tip: You can sprint while holding down the "E" key, be careful this will increase your hunger considerably.=Astuce : Vous pouvez sprinter en restant appuyé sur la touche "E", attention cela augmentera votre faim considérablement..
Advice: If you don't want to see your house stolen or grieffed then think of the areas.=Conseil : Si vous ne voulez pas voir votre maison volée ou griefée, pensez aux areas !.
Tip: You can speak with other players from a secure IRC channel #NALC of this server. URL: irc.sys4.fr:669.=Astuce : Vous pouvez parler avec les autres joueurs depuis le canal IRC sécurisé #NALC de ce serveur. URL : irc.sys4.fr:6697.
Tip: On the #NALC IRC channel you can with "nalc" bot interact with the server from your favorite client program. URL: irc.sys4.fr:669.=Astuce : Sur le canal IRC #NALC vous pouvez, grâce au bot "nalc", interagir avec le serveur depuis votre client IRC favoris. URL : irc.sys4.fr:6697.
Info: Mana is a resource for using magic or magical objects, no food regenerates it.=Info : La mana est une ressource permettant d'utiliser la magie ou des objets magiques, aucune nourriture ne la régénère..
Tip: You can increase your mana by wearing amulets.=Astuce : Vous pouvez accroître votre mana en portant des amulettes..
Advice: Craft a "returnmirror" might be a good idea to bypass the limitations on teleportation as "/home" and "/spawn".=Conseil : Fabriquer un "returnmirror" peut être une bonne idée pour contourner les limitations sur les téléportations comme "/home" et "/spawn"..
Tip: Fishing is a good way to eat fish food, but can also bring you surprises like pieces of equipment/weapons/shields etc...=Astuce : La pêche est un bon moyen de se nourrir, mais peut aussi vous apporter des surprises comme des pièces d'équipements/armes/boucliers/etc....
Advice: The wooden fishing pole isn't the best tool to catch fish, try the perfect fishing pole (made with mithril).=Conseil : La canne à pêche en bois n'est pas le meilleur outil pour attraper des poissons, essayez la canne à pêche parfaite (faite en mithril) !.
Tip: You can use worms, but also fish as bait, with them you will have more chances to get wonderful and rare items.=Astuce : Vous pouvez utiliser des vers de terre, mais aussi des poissons en appâts, avec ces derniers vous aurez plus de chance d'obtenir de magnifiques et rares objets !.
Tip: The news mod allows you read news with the command "/ news" wich keep you informed of news of the server.=Astuce : Le mod news vous permet grâce à la commande "/news" de vous tenir informé des nouveautés du serveur..
Tip: The u_skins mod allow you to change the appearance of your avatar through the icon at the bottom right of your inventory.=Astuce : Le mod u_skins permet de changer l'apparence de votre avatar depuis l'icone en bas à droite de votre inventaire..
Tip: The email mod allow you to transmit messages to offline players, use the command "/mail <name> <msg>".=Astuce : Le mod email permet de transmettre des messages à des joueurs hors ligne, utilisez la commande "/mail <name> <msg>"..
Advice: Don't build a Nether portal without being seriously prepared.=Conseil : Ne construisez pas un portail menant au Nether sans en être vraiment prêt !.
Advice: You can use the /report command to explain the discover of a bug or to report a problem with another player.=Conseil : Vous pouvez utiliser la commande /report pour expliquer la découverte d'un bug ou rapporter un problème avec un autre joueur..
Tip: The deeper you will mine, the more you will find ores, and the more precious they will be.=Astuce : Le plus profond vous creuserez, plus vous trouverez de minerais, et plus précieux ils seront !.
Tip: Use "/guide" to see the server's guide's menu.=Astuce: Utilisez "/guide" pour voir le menu "guide du serveur"..
Advice: Equip yourself with appropriate armour according to what you want to focus on, such as speed, impact resistance or radio-activity.=Conseil : Équippez-vous avec des armures adéquates en fonction de ce que vous voulez privilégier comme la vitesse, la résistance au coups ou encore la radio-activité..
Info: The contents of the pyramid chests regenerate every 30 minutes.=Info : Le contenue des coffres des pyramides se régénère toutes les 30 minutes..
Info: You will find a multitude of treasures scattered in the pyramids, abandoned temples, shipwrecks and underground mines.=Info : Vous trouverez une multitude trésors disséminés dans les pyramides, les temples abandonnés, les épaves de bateaux et les mines souterraines..
Tip: You can use the hazmat suit against radioactivity but also to go under water.=Astuce : Vous pouvez utiliser la combinaison de protection contre la radio-activité mais aussi pour aller sous l'eau..
WARNING: The server will be public soon, protect your builds. Ask help to the Administrator or a moderator if necessary.=ATTENTION : Le serveur sera prochainement public, protégez vos installations. Demandez de l'aide à l'Administrateur ou a un modérateur si nécessaire..
Tip: You can throw snowballs. However, be careful not to abuse it. This can be perceived as a provocation by the person being targeted.=Astuce : Vous pouvez lancer des boules de neiges. Attention toutefois à ne pas en abuser. Cela peut être perçue comme une provocation par celui qui est visé..
Tip: You can use /hotbar command to change the size of your items hotbar dynamically in game.=Astuce : Vous pouvez utiliser la commande /hotbar pour changer la taille de votre barre d'items dynamiquement en jeux..
Tip: Use /help <command> for a detailled help of <command>.=Astuce : Utilisez /help <commande> pour une aide détaillé de <commande>..
Tip: Use /volume command to adjust the sound levels of sound effects and music.=Astuce : Utilisez la commande /volume pour régler les niveaux sonores des bruitages et de la musique..

View File

@ -1,44 +0,0 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-08-04 15:04+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=CHARSET\n"
"Content-Transfer-Encoding: 8bit\n"
#: init.lua
msgid ""
"Blame the server admin! He/She has probably not edited the random messages "
"yet.\n"
msgstr ""
#: init.lua
msgid "Tell your dumb admin that this line is in (worldpath)/random_messages\n"
msgstr ""
#: init.lua
msgid "View and/or alter the server's random messages"
msgstr ""
#: init.lua
msgid "ERROR: No such message."
msgstr ""
#: init.lua
msgid "ERROR: No message."
msgstr ""
#: init.lua
msgid "ERROR: Invalid command."
msgstr ""

63
locale/template.txt Normal file
View File

@ -0,0 +1,63 @@
# textdomain: random_messages
Blame the server admin! He/She has probably not edited the random messages yet.=
Tell your dumb admin that this line is in (worldpath)/random_messages=
View and/or alter the server's random messages=
ERROR: No such message.=
ERROR: No message.=
ERROR: Invalid command.=
Tip: To be able to crafter quarry that are limited on the server, you will need to have experience in mining. Take a look at the awards list.=
Tip: You can sprint while holding down the "E" key, be careful this will increase your hunger considerably.=
Advice: If you don't want to see your house stolen or grieffed then think of the areas.=
Tip: You can speak with other players from a secure IRC channel #NALC of this server. URL: irc.sys4.fr:669.=
Tip: On the #NALC IRC channel you can with "nalc" bot interact with the server from your favorite client program. URL: irc.sys4.fr:669.=
Info: Mana is a resource for using magic or magical objects, no food regenerates it.=
Tip: You can increase your mana by wearing amulets.=
Advice: Craft a "returnmirror" might be a good idea to bypass the limitations on teleportation as "/home" and "/spawn".=
Tip: Fishing is a good way to eat fish food, but can also bring you surprises like pieces of equipment/weapons/shields etc...=
Advice: The wooden fishing pole isn't the best tool to catch fish, try the perfect fishing pole (made with mithril).=
Tip: You can use worms, but also fish as bait, with them you will have more chances to get wonderful and rare items.=
Tip: The news mod allows you read news with the command "/ news" wich keep you informed of news of the server.=
Tip: The u_skins mod allow you to change the appearance of your avatar through the icon at the bottom right of your inventory.=
Tip: The email mod allow you to transmit messages to offline players, use the command "/mail <name> <msg>".=
Advice: Don't build a Nether portal without being seriously prepared.=
Advice: You can use the /report command to explain the discover of a bug or to report a problem with another player.=
Tip: The deeper you will mine, the more you will find ores, and the more precious they will be.=
Tip: Use "/guide" to see the server's guide's menu.=
Advice: Equip yourself with appropriate armour according to what you want to focus on, such as speed, impact resistance or radio-activity.=
Info: The contents of the pyramid chests regenerate every 30 minutes.=Info : Le contenue des coffres des pyramides se régénère toutes les 30 minutes..
Info: You will find a multitude of treasures scattered in the pyramids, abandoned temples, shipwrecks and underground mines.=
Tip: You can use the hazmat suit against radioactivity but also to go under water.=
WARNING: The server will be public soon, protect your builds. Ask help to the Administrator or a moderator if necessary.=
Tip: You can throw snowballs. However, be careful not to abuse it. This can be perceived as a provocation by the person being targeted.=
Tip: You can use /hotbar command to change the size of your items hotbar dynamically in game.=
Tip: Use /help <command> for a detailled help of <command>.=
Tip: Use /volume command to adjust the sound levels of sound effects and music.=

3
mod.conf Normal file
View File

@ -0,0 +1,3 @@
name = random_messages
description = Configure your random messages.
author = arsdragonfly

27
random_messages Normal file
View File

@ -0,0 +1,27 @@
Tip: To be able to crafter quarry that are limited on the server, you will need to have experience in mining. Take a look at the awards list.
Tip: You can sprint while holding down the "E" key, be careful this will increase your hunger considerably.
Advice: If you don't want to see your house stolen or grieffed then think of the areas.
Tip: You can speak with other players from a secure IRC channel #NALC of this server. URL: irc.sys4.fr:669.
Tip: On the #NALC IRC channel you can with "nalc" bot interact with the server from your favorite client program. URL: irc.sys4.fr:669.
Info: Mana is a resource for using magic or magical objects, no food regenerates it.
Tip: You can increase your mana by wearing amulets.
Advice: Craft a "returnmirror" might be a good idea to bypass the limitations on teleportation as "/home" and "/spawn".
Tip: Fishing is a good way to eat fish food, but can also bring you surprises like pieces of equipment/weapons/shields etc...
Advice: The wooden fishing pole isn't the best tool to catch fish, try the perfect fishing pole (made with mithril).
Tip: You can use worms, but also fish as bait, with them you will have more chances to get wonderful and rare items.
Tip: The news mod allows you read news with the command "/ news" wich keep you informed of news of the server.
Tip: The u_skins mod allow you to change the appearance of your avatar through the icon at the bottom right of your inventory.
Tip: The email mod allow you to transmit messages to offline players, use the command "/mail <name> <msg>".
Advice: Don't build a Nether portal without being seriously prepared.
Advice: You can use the /report command to explain the discover of a bug or to report a problem with another player.
Tip: The deeper you will mine, the more you will find ores, and the more precious they will be.
Tip: Use "/guide" to see the server's guide's menu.
Advice: Equip yourself with appropriate armour according to what you want to focus on, such as speed, impact resistance or radio-activity.
Info: The contents of the pyramid chests regenerate every 30 minutes.
Info: You will find a multitude of treasures scattered in the pyramids, abandoned temples, shipwrecks and underground mines.
Tip: You can use the hazmat suit against radioactivity but also to go under water.
WARNING: The server will be public soon, protect your builds. Ask help to the Administrator or a moderator if necessary.
Tip: You can throw snowballs. However, be careful not to abuse it. This can be perceived as a provocation by the person being targeted.
Tip: You can use /hotbar command to change the size of your items hotbar dynamically in game.
Tip: Use /help <command> for a detailled help of <command>.
Tip: Use /volume command to adjust the sound levels of sound effects and music.

2
settingtypes.txt Normal file
View File

@ -0,0 +1,2 @@
# Default is 120 seconds.
random_messages_interval (Time between two subsequent messages) int 120