From 0fd694222557d14017a44f12ab65271cd4571447 Mon Sep 17 00:00:00 2001 From: Till Affeldt Date: Fri, 29 May 2020 22:02:12 +0200 Subject: [PATCH] Implement i18n support --- abms/ice.lua | 3 +++ abms/puddle.lua | 3 +++ abms/snow_cover.lua | 3 +++ init.lua | 4 +++- locale/regional_weather.de.tr | 5 +++++ locale/template.txt | 5 +++++ 6 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 locale/regional_weather.de.tr create mode 100644 locale/template.txt diff --git a/abms/ice.lua b/abms/ice.lua index 6b92caa..9f314d5 100644 --- a/abms/ice.lua +++ b/abms/ice.lua @@ -5,7 +5,10 @@ then return end local BLOCK_NAME = "regional_weather:ice" +local S = regional_weather.i18n + minetest.register_node(BLOCK_NAME, { + description = S("Thin Ice"), tiles = {"(default_ice.png^[colorize:#ffffff:50)^[opacity:200"}, paramtype = "light", groups = { diff --git a/abms/puddle.lua b/abms/puddle.lua index f5298b1..30d8eb4 100644 --- a/abms/puddle.lua +++ b/abms/puddle.lua @@ -13,6 +13,8 @@ local GROUND_COVERS = { "default:permafrost_with_stones" } +local S = regional_weather.i18n + -- clean up puddles if disabled if not regional_weather.settings.puddles then -- set all puddle nodes to air @@ -57,6 +59,7 @@ for i = 1, VARIANT_COUNT do texture = texture .. "^[transformFX" end minetest.register_node(name, { + description = S("Puddle"), tiles = { texture }, drawtype = "nodebox", pointable = false, diff --git a/abms/snow_cover.lua b/abms/snow_cover.lua index 458d8a1..eb48fe8 100644 --- a/abms/snow_cover.lua +++ b/abms/snow_cover.lua @@ -2,6 +2,8 @@ local BLOCK_PREFIX = "regional_weather:snow_cover_" local CHECK_DISTANCE = 3 local MAX_AMOUNT = 20 +local S = regional_weather.i18n + if not minetest.get_modpath("default") or default.node_sound_snow_defaults == nil or not regional_weather.settings.snow then @@ -25,6 +27,7 @@ for i = 1,5 do } minetest.register_node(BLOCK_PREFIX .. i, { + description = S("Snow Cover"), tiles = { "default_snow.png" }, drawtype = "nodebox", buildable_to = i < 3, diff --git a/init.lua b/init.lua index f096e98..e4e33cf 100644 --- a/init.lua +++ b/init.lua @@ -33,11 +33,13 @@ regional_weather.settings.min_height = get_setting_number("min_height", -50) regional_weather.settings.cloud_height = get_setting_number("cloud_height", 120) regional_weather.settings.cloud_scale = get_setting_number("cloud_scale", 40) +regional_weather.i18n = minetest.get_translator("regional_weather") + -- warn about clouds being overriden by MTG weather if climate_mod.settings.skybox and minetest.get_modpath("weather") and get_setting_bool("enable_weather", true, true) then - minetest.log("warning", "[Regional Weather] Disable MTG weather for the best experience") + minetest.log("warning", "[Regional Weather] " .. S("Disable MTG weather for the best experience")) end -- import individual weather types diff --git a/locale/regional_weather.de.tr b/locale/regional_weather.de.tr new file mode 100644 index 0000000..98d59d7 --- /dev/null +++ b/locale/regional_weather.de.tr @@ -0,0 +1,5 @@ +# textdomain:regional_weather +Disable MTG weather for the best experience=Deaktiviere MTG weather für die beste Spielerfahrung +Thin Ice=Dünnes Eis +Puddle=Pfütze +Snow Cover=Schnee \ No newline at end of file diff --git a/locale/template.txt b/locale/template.txt new file mode 100644 index 0000000..d806d2a --- /dev/null +++ b/locale/template.txt @@ -0,0 +1,5 @@ +# textdomain:regional_weather +Disable MTG weather for the best experience= +Thin Ice= +Puddle= +Snow Cover= \ No newline at end of file