From c30827eeb8c8c8a15b73a59ef49da5206a2ced05 Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Fri, 28 Aug 2020 12:12:46 +0200 Subject: [PATCH] Use no-op strings for month/weekday names --- gameconfig.lua | 28 +++++++++++----------------- gui.lua | 2 +- init.lua | 4 ++-- 3 files changed, 14 insertions(+), 20 deletions(-) diff --git a/gameconfig.lua b/gameconfig.lua index 6d6cbf5..c4ad7af 100644 --- a/gameconfig.lua +++ b/gameconfig.lua @@ -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 diff --git a/gui.lua b/gui.lua index 5a53705..29c04ab 100644 --- a/gui.lua +++ b/gui.lua @@ -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 diff --git a/init.lua b/init.lua index 5983a27..a0331b5 100644 --- a/init.lua +++ b/init.lua @@ -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", "%%" )