Use no-op strings for month/weekday names

master
Wuzzy 2020-08-28 12:12:46 +02:00
parent 531b19d4ee
commit c30827eeb8
3 changed files with 14 additions and 20 deletions

View File

@ -1,11 +1,5 @@
-- Get translator
local S
if minetest.get_translator then
S = minetest.get_translator("calendar")
else
S = function(s) return s end
end
-- For translation collector script
local N = function(s) return s end
----------------------------------
-- BEGINNING OF CALENDAR CONFIG --
@ -17,28 +11,28 @@ calendar.MONTH_DAYS = 30
-- List of long month names
-- (also determines the number of months in a year)
calendar.month_names = {
S('January'), S('February'), S('March'), S('April'),
S('May'), S('June'), S('July'), S('August'),
S('September'), S('October'), S('November'), S('December')
N('January'), N('February'), N('March'), N('April'),
N('May'), N('June'), N('July'), N('August'),
N('September'), N('October'), N('November'), N('December')
}
-- Short month names
-- (must have same length as `calendar.month.names`)
calendar.month_names_short = {
S('Jan'), S('Feb'), S('Mar'), S('Apr'),
S('May'), S('Jun'), S('Jul'), S('Aug'),
S('Sep'), S('Oct'), S('Nov'), S('Dec')
N('Jan'), N('Feb'), N('Mar'), N('Apr'),
N('May'), N('Jun'), N('Jul'), N('Aug'),
N('Sep'), N('Oct'), N('Nov'), N('Dec')
}
-- Long week day names
-- (also determines the number of days in a week)
calendar.weekday_names = {
S("Monday"), S("Tuesday"), S("Wednesday"),
S("Thursday"), S("Friday"), S("Saturday"), S("Sunday")
N("Monday"), N("Tuesday"), N("Wednesday"),
N("Thursday"), N("Friday"), N("Saturday"), N("Sunday")
}
-- Short week day names
-- (must have same length as `calendar.weekday_names`)
calendar.weekday_names_short = {
S("Mo"), S("Tu"), S("We"), S("Th"), S("Fr"), S("Sa"), S("Su")
N("Mo"), N("Tu"), N("We"), N("Th"), N("Fr"), N("Sa"), N("Su")
}
-- Cardinal number of the week day that marks the beginning of a week

View File

@ -67,7 +67,7 @@ function calendar.show_calendar(player_name, settings, wanted_months, wanted_yea
weekday = calendar.get_weekday(tdays)
x, y = 0.75, 1.2
for w=1, #calendar.weekday_names_short do
formspec = formspec .. "label["..x..","..y..";"..calendar.weekday_names_short[w].."]"
formspec = formspec .. "label["..x..","..y..";"..F(S(calendar.weekday_names_short[w])).."]"
x = x + 1.1
end
else

View File

@ -116,8 +116,8 @@ calendar.get_date_string = function(format, total_days)
format = string.gsub( format, "%%d", d + 1 ) -- current day of month
format = string.gsub( format, "%%j", j + 1 ) -- current day of year
format = string.gsub( format, "%%b", calendar.month_names[ m + 1 ] ) -- current month long name
format = string.gsub( format, "%%h", calendar.month_names_short[ m + 1 ] ) -- current month short name
format = string.gsub( format, "%%b", S(calendar.month_names[ m + 1 ]) ) -- current month long name
format = string.gsub( format, "%%h", S(calendar.month_names_short[ m + 1 ]) ) -- current month short name
format = string.gsub( format, "%%z", "%%" )