Add localization support

master
Jordan Irwin 2021-08-03 15:29:43 -07:00
parent 44d3e24683
commit 83fb1227de
6 changed files with 18 additions and 4 deletions

View File

@ -1,4 +1,3 @@
TODO:
- add localization support
- add Spanish translation

View File

@ -29,6 +29,8 @@
-- @module api.lua
local S = core.get_translator(asm.modname)
local registered_eggs = {}
--- Retrieves egg that spawns specified entity.
@ -75,7 +77,7 @@ local function formatTitle(s)
table.insert(t, v)
end
return table.concat(t, " ") .. " Spawn Egg"
return S("@1 Spawn Egg", table.concat(t, " "))
end
--- Registers new egg in game.

View File

@ -3,17 +3,21 @@ v1.2
----
- added method to retrieve registered egg by entity name
- added optional field "title" for EggDef
- added localization support
v1.1
----
- egg names are titleized & underscores are replaced with space
v1.0
----
- made independent of any other mods or games
- renamed to "asm_spawneggs" (Another Spawneggs Mod)
- added API reference
v0.1
----
- created mod for Antum game

View File

@ -25,7 +25,9 @@
--]]
local S = core.get_translator(asm.modname)
core.register_craftitem(":spawneggs:egg", {
description = "Spawn Egg",
description = S("Spawn Egg"),
inventory_image = "spawneggs_egg.png",
})

7
locale/template.txt Normal file
View File

@ -0,0 +1,7 @@
# textdomain:asm_spawneggs
# Translators:
Spawn Egg=
@1 Spawn Egg=

View File

@ -4,4 +4,4 @@ author = AntumDeluge
description = Spawneggs for adding entities to game.
license = MIT
version = 1.1
min_minetest_version = 0.4
min_minetest_version = 5.0