adjusted changes for locale
This commit is contained in:
commit
be6eb62332
46
init.lua
46
init.lua
@ -81,6 +81,10 @@
|
|||||||
- target list is now centered if there are less than 9 targets
|
- target list is now centered if there are less than 9 targets
|
||||||
--]]
|
--]]
|
||||||
|
|
||||||
|
-- Required to save the travelnet data properly in all cases
|
||||||
|
if not minetest.safe_file_write then
|
||||||
|
error("[Mod travelnet] Your Minetest version is no longer supported. (version < 0.4.17)")
|
||||||
|
end
|
||||||
|
|
||||||
travelnet = {};
|
travelnet = {};
|
||||||
|
|
||||||
@ -99,37 +103,43 @@ minetest.register_privilege("travelnet_remove", { description = S("allows to dig
|
|||||||
-- read the configuration
|
-- read the configuration
|
||||||
dofile(travelnet.path.."/config.lua"); -- the normal, default travelnet
|
dofile(travelnet.path.."/config.lua"); -- the normal, default travelnet
|
||||||
|
|
||||||
|
travelnet.mod_data_path = minetest.get_worldpath().."/mod_travelnet.data"
|
||||||
|
|
||||||
-- TODO: save and restore ought to be library functions and not implemented in each individual mod!
|
-- TODO: save and restore ought to be library functions and not implemented in each individual mod!
|
||||||
-- called whenever a station is added or removed
|
-- called whenever a station is added or removed
|
||||||
travelnet.save_data = function()
|
travelnet.save_data = function()
|
||||||
|
|
||||||
local data = minetest.serialize( travelnet.targets );
|
local data = minetest.serialize( travelnet.targets );
|
||||||
local path = minetest.get_worldpath().."/mod_travelnet.data";
|
|
||||||
|
|
||||||
local file = io.open( path, "w" );
|
local success = minetest.safe_file_write( travelnet.mod_data_path, data );
|
||||||
if( file ) then
|
if( not success ) then
|
||||||
file:write( data );
|
print(S("[Mod travelnet] Error: Savefile '%s' could not be written.")
|
||||||
file:close();
|
:format(travelnet.mod_data_path));
|
||||||
else
|
|
||||||
print(S("[Mod travelnet] Error: Savefile '%s' could not be written."):format(tostring(path)));
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
travelnet.restore_data = function()
|
travelnet.restore_data = function()
|
||||||
|
|
||||||
local path = minetest.get_worldpath().."/mod_travelnet.data";
|
local file = io.open( travelnet.mod_data_path, "r" );
|
||||||
|
if( not file ) then
|
||||||
local file = io.open( path, "r" );
|
print(S("[Mod travelnet] Error: Savefile '%s' not found.")
|
||||||
if( file ) then
|
:format(travelnet.mod_data_path));
|
||||||
local data = file:read("*all");
|
return;
|
||||||
travelnet.targets = minetest.deserialize( data );
|
|
||||||
file:close();
|
|
||||||
else
|
|
||||||
print(S("[Mod travelnet] Error: Savefile '%s' not found."):format(tostring(path)));
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local data = file:read("*all");
|
||||||
|
travelnet.targets = minetest.deserialize( data );
|
||||||
|
|
||||||
|
if( not travelnet.targets ) then
|
||||||
|
local backup_file = travelnet.mod_data_path..".bak"
|
||||||
|
print(S("[Mod travelnet] Error: Savefile '%s' is damaged. Saved the backup as '%s'.")
|
||||||
|
:format(travelnet.mod_data_path, backup_file));
|
||||||
|
|
||||||
|
minetest.safe_file_write( backup_file, data );
|
||||||
|
travelnet.targets = {};
|
||||||
|
end
|
||||||
|
file:close();
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
@ -319,3 +319,8 @@ msgstr "Station entfernen"
|
|||||||
#, lua-format
|
#, lua-format
|
||||||
msgid "You do not have enough room in your inventory."
|
msgid "You do not have enough room in your inventory."
|
||||||
msgstr "Du hast nicht genug Platz in deinem Inventar."
|
msgstr "Du hast nicht genug Platz in deinem Inventar."
|
||||||
|
|
||||||
|
#: init.lua
|
||||||
|
#, lua-format
|
||||||
|
msgid "[Mod travelnet] Error: Savefile '%s' is damaged. Saved the backup as '%s'."
|
||||||
|
msgstr "[Mod travelnet] Fehler: Sicherungsdatei '%s' ist beschädigt. Backup wurde unter '%s' gespeichert."
|
||||||
|
@ -365,3 +365,8 @@ msgstr ""
|
|||||||
#, lua-format
|
#, lua-format
|
||||||
msgid "You do not have enough room in your inventory."
|
msgid "You do not have enough room in your inventory."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
#: init.lua
|
||||||
|
#, lua-format
|
||||||
|
msgid "[Mod travelnet] Error: Savefile '%s' is damaged. Saved the backup as '%s'."
|
||||||
|
msgstr ""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user