mirror of
https://repo.or.cz/minetest_orienteering.git
synced 2024-08-20 12:44:09 +02:00
Use new intllib format syntax
This commit is contained in:
parent
2f40a2d2e8
commit
6b4549641f
26
init.lua
26
init.lua
@ -2,7 +2,7 @@ local S
|
|||||||
if (minetest.get_modpath("intllib")) then
|
if (minetest.get_modpath("intllib")) then
|
||||||
S = intllib.Getter()
|
S = intllib.Getter()
|
||||||
else
|
else
|
||||||
S = function ( s ) return s end
|
S = function(s,a,...)a={a,...}return s:gsub("@(%d+)",function(n)return a[tonumber(n)]end)end
|
||||||
end
|
end
|
||||||
|
|
||||||
local orienteering = {}
|
local orienteering = {}
|
||||||
@ -285,11 +285,11 @@ function orienteering.update_hud_displays(player)
|
|||||||
local str_pos, str_angles, str_time, str_speed
|
local str_pos, str_angles, str_time, str_speed
|
||||||
local pos = vector.round(player:getpos())
|
local pos = vector.round(player:getpos())
|
||||||
if (altimeter and triangulator) or gps or quadcorder then
|
if (altimeter and triangulator) or gps or quadcorder then
|
||||||
str_pos = string.format(S("Coordinates: X=%d, Y=%d, Z=%d"), pos.x, pos.y, pos.z)
|
str_pos = S("Coordinates: X=@1, Y=@2, Z=@3", pos.x, pos.y, pos.z)
|
||||||
elseif altimeter then
|
elseif altimeter then
|
||||||
str_pos = string.format(S("Height: Y=%d"), pos.y)
|
str_pos = S("Height: Y=@1", pos.y)
|
||||||
elseif triangulator then
|
elseif triangulator then
|
||||||
str_pos = string.format(S("Coordinates: X=%d, Z=%d"), pos.x, pos.z)
|
str_pos = S("Coordinates: X=@1, Z=@2", pos.x, pos.z)
|
||||||
else
|
else
|
||||||
str_pos = ""
|
str_pos = ""
|
||||||
end
|
end
|
||||||
@ -297,11 +297,11 @@ function orienteering.update_hud_displays(player)
|
|||||||
local yaw = (player:get_look_yaw()-math.pi/2)*toDegrees
|
local yaw = (player:get_look_yaw()-math.pi/2)*toDegrees
|
||||||
local pitch = player:get_look_pitch()*toDegrees
|
local pitch = player:get_look_pitch()*toDegrees
|
||||||
if ((compass or gps) and sextant) or quadcorder then
|
if ((compass or gps) and sextant) or quadcorder then
|
||||||
str_angles = string.format(S("Yaw: %.1f°, pitch: %.1f°"), yaw, pitch)
|
str_angles = S("Yaw: @1°, pitch: @2°", string.format("%.1f", yaw), string.format("%.1f", pitch))
|
||||||
elseif compass or gps then
|
elseif compass or gps then
|
||||||
str_angles = string.format(S("Yaw: %.1f°"), yaw)
|
str_angles = S("Yaw: @1°", string.format("%.1f", yaw))
|
||||||
elseif sextant then
|
elseif sextant then
|
||||||
str_angles = string.format(S("Pitch: %.1f°"), pitch)
|
str_angles = S("Pitch: @1°", string.format("%.1f", pitch))
|
||||||
else
|
else
|
||||||
str_angles = ""
|
str_angles = ""
|
||||||
end
|
end
|
||||||
@ -313,19 +313,21 @@ function orienteering.update_hud_displays(player)
|
|||||||
local hours = math.floor((totalminutes - minutes) / 60)
|
local hours = math.floor((totalminutes - minutes) / 60)
|
||||||
local twelve = orienteering.playerhuds[name].twelve
|
local twelve = orienteering.playerhuds[name].twelve
|
||||||
if twelve then
|
if twelve then
|
||||||
local ampm
|
|
||||||
if hours == 12 and minutes == 0 then
|
if hours == 12 and minutes == 0 then
|
||||||
str_time = S("Time: noon")
|
str_time = S("Time: noon")
|
||||||
elseif hours == 0 and minutes == 0 then
|
elseif hours == 0 and minutes == 0 then
|
||||||
str_time = S("Time: midnight")
|
str_time = S("Time: midnight")
|
||||||
else
|
else
|
||||||
if hours >= 12 then ampm = S("p.m.") else ampm = S("a.m.") end
|
|
||||||
hours = math.fmod(hours, 12)
|
hours = math.fmod(hours, 12)
|
||||||
if hours == 0 then hours = 12 end
|
if hours == 0 then hours = 12 end
|
||||||
str_time = string.format(S("Time: %i:%02i %s"), hours, minutes, ampm)
|
if hours >= 12 then
|
||||||
|
str_time = S("Time: @1:@2 p.m.", string.format("%i", hours), string.format("%02i", minutes))
|
||||||
|
else
|
||||||
|
str_time = S("Time: @1:@2 a.m.", string.format("%i", hours), string.format("%02i", minutes))
|
||||||
|
end
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
str_time = string.format(S("Time: %02i:%02i"), hours, minutes)
|
str_time = S("Time: @1:@2", string.format("%02i", hours), string.format("%02i", minutes))
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
str_time = ""
|
str_time = ""
|
||||||
@ -345,7 +347,7 @@ function orienteering.update_hud_displays(player)
|
|||||||
|
|
||||||
if speedometer or quadcorder then
|
if speedometer or quadcorder then
|
||||||
local u = orienteering.settings.speed_unit
|
local u = orienteering.settings.speed_unit
|
||||||
str_speed = string.format(S("Speed: hor.: %.1f %s, vert.: %.1f %s"), speed_hor, u, speed_ver, u)
|
str_speed = S("Speed: hor.: @1 @2, vert.: @3 @4", string.format("%.1f", speed_hor), u, string.format("%.1f", speed_ver), u)
|
||||||
else
|
else
|
||||||
str_speed = ""
|
str_speed = ""
|
||||||
end
|
end
|
||||||
|
@ -9,25 +9,24 @@ Automapper = Autokartierer
|
|||||||
GPS device = GPS-Gerät
|
GPS device = GPS-Gerät
|
||||||
Binoculars = Fernglas
|
Binoculars = Fernglas
|
||||||
|
|
||||||
Yaw: %.1f°, pitch: %.1f° = Gier: %.1f°, Nick: %.1f°
|
Yaw: @1°, pitch: @2° = Gier: @1°, Nick: @2°
|
||||||
Yaw: %.1f° = Gier: %.1f°
|
Yaw: @1° = Gier: @1°
|
||||||
Pitch: %.1f° = Nick: %.1f°
|
Pitch: @1° = Nick: @1°
|
||||||
|
|
||||||
Time: noon = Uhrzeit: Mittag
|
Time: noon = Uhrzeit: Mittag
|
||||||
Time: midnight = Uhrzeit: Mitternacht
|
Time: midnight = Uhrzeit: Mitternacht
|
||||||
p.m. = PM
|
Time: @1:@2 a.m. = Uhrzeit: @1:@2 AM
|
||||||
a.m. = AM
|
Time: @1:@2 p.m. = Uhrzeit: @1:@2 PM
|
||||||
Time: %i:%02i %s = Uhrzeit: %i:%02i %s
|
Time: @1:@2 = Uhrzeit: @1:@2
|
||||||
Time: %02i:%02i = Uhrzeit: %02i:%02i
|
|
||||||
|
|
||||||
Speed: hor.: %.1f %s, vert.: %.1f %s = Tempo: hor.: %.1f %s, vert.: %.1f %s
|
Speed: hor.: @1 @2, vert.: @3 @4 = Tempo: hor.: @1 @2, vert.: @3 @4
|
||||||
|
|
||||||
m = m
|
m = m
|
||||||
m/s = m/s
|
m/s = m/s
|
||||||
|
|
||||||
Coordinates: X\=%d, Y\=%d, Z\=%d = Koordinaten: X\=%d, Y\=%d, Z\=%d
|
Coordinates: X\=@1, Y\=@2, Z\=@3 = Koordinaten: X\=@1, Y\=@2, Z\=@3
|
||||||
Height: Y\=%d = Höhe: Y\=%d
|
Height: Y\=@1 = Höhe: Y\=@1
|
||||||
Coordinates: X\=%d, Z\=%d = Koordinaten: X\=%d, Z\=%d
|
Coordinates: X\=@1, Z\=@2 = Koordinaten: X\=@1, Z\=@2
|
||||||
|
|
||||||
Master of Orienteering = Meister der Orientierung
|
Master of Orienteering = Meister der Orientierung
|
||||||
Craft a quadcorder. = Fertigen Sie einen Vierkorder.
|
Craft a quadcorder. = Fertigen Sie einen Vierkorder.
|
||||||
|
@ -11,34 +11,33 @@ GPS device
|
|||||||
Binoculars
|
Binoculars
|
||||||
|
|
||||||
# Coordinates
|
# Coordinates
|
||||||
Coordinates: X\=%d, Y\=%d, Z\=%d
|
Coordinates: X\=@1, Y\=@2, Z\=@3
|
||||||
Height: Y\=%d
|
Height: Y\=@1
|
||||||
Coordinates: X\=%d, Z\=%d
|
Coordinates: X\=@1, Z\=@2
|
||||||
|
|
||||||
# Angles
|
# Angles
|
||||||
Yaw: %.1f°, pitch: %.1f°
|
Yaw: @1°, pitch: @1°
|
||||||
Yaw: %.1f°
|
Yaw: @1°
|
||||||
Pitch: %.1f°
|
Pitch: @1°
|
||||||
|
|
||||||
# Time
|
# Time
|
||||||
## For the 12h mode
|
## For the 12h mode
|
||||||
Time: noon
|
Time: noon
|
||||||
Time: midnight
|
Time: midnight
|
||||||
p.m.
|
# 12h format
|
||||||
a.m.
|
Time: @1:@2 a.m
|
||||||
# 12h format Format: hours:minutes a.m/p.m
|
Time: @1:@2 p.m
|
||||||
Time: %i:%02i %s
|
|
||||||
# 24h Format: hours:minutes
|
# 24h Format: hours:minutes
|
||||||
Time: %02i:%02i
|
Time: @1:@2
|
||||||
|
|
||||||
# meters
|
# meters
|
||||||
m
|
m
|
||||||
# meters per second
|
# meters per second
|
||||||
m/s
|
m/s
|
||||||
|
|
||||||
# %.1f will be replaced by number, %s will be replaced by speed unit
|
# @1 and @3 will be replaced by number, @2 and @4 will be replaced by speed units
|
||||||
# "hor." = "horizontal"; "vert." = "vertical"
|
# "hor." = "horizontal"; "vert." = "vertical"
|
||||||
Speed: hor.: %.1f %s, vert.: %.1f %s
|
Speed: hor.: @1 @2, vert.: @3 @4
|
||||||
|
|
||||||
# awards
|
# awards
|
||||||
Master of Orienteering
|
Master of Orienteering
|
||||||
|
Loading…
Reference in New Issue
Block a user