translation for days and months. command for local time
This commit is contained in:
parent
9a67fd6d08
commit
a9ae12d39a
@ -7,7 +7,7 @@
|
|||||||
-- If you have a google api key for the geocoding/timezone api
|
-- If you have a google api key for the geocoding/timezone api
|
||||||
api_key = nil
|
api_key = nil
|
||||||
base_api = "https://maps.googleapis.com/maps/api"
|
base_api = "https://maps.googleapis.com/maps/api"
|
||||||
dateFormat = "%A, %d. %B - %H:%M:%S"
|
dateFormat = "%A, der %d. %B %Y und es ist %H:%M:%S Uhr [%p]"
|
||||||
|
|
||||||
-- Need the utc time for the google api
|
-- Need the utc time for the google api
|
||||||
function utctime()
|
function utctime()
|
||||||
@ -84,16 +84,46 @@ function getformattedLocalTime(area)
|
|||||||
end
|
end
|
||||||
local localTime, timeZoneId = get_time(lat,lng)
|
local localTime, timeZoneId = get_time(lat,lng)
|
||||||
|
|
||||||
return 'Die lokale Zeit in "'..timeZoneId..'" ist: '.. os.date(dateFormat,localTime)
|
text = 'Die lokale Zeit in "'..timeZoneId..'" ist: '.. os.date(dateFormat,localTime)
|
||||||
|
|
||||||
|
-- Days
|
||||||
|
text = string.gsub(text, "Monday", "Montag")
|
||||||
|
text = string.gsub(text, "Tuesday", "Dienstag")
|
||||||
|
text = string.gsub(text, "Wednesday", "Mittwoch")
|
||||||
|
text = string.gsub(text, "Thursday", "Donnerstag")
|
||||||
|
text = string.gsub(text, "Friday", "Freitag")
|
||||||
|
text = string.gsub(text, "Saturday", "Samsstag")
|
||||||
|
text = string.gsub(text, "Sunday", "Sonntag")
|
||||||
|
|
||||||
|
-- Months
|
||||||
|
text = string.gsub(text, "January", "Januar")
|
||||||
|
text = string.gsub(text, "February", "Februar")
|
||||||
|
text = string.gsub(text, "March", "März")
|
||||||
|
text = string.gsub(text, "April", "April")
|
||||||
|
text = string.gsub(text, "May", "Mai")
|
||||||
|
text = string.gsub(text, "June", "Juni")
|
||||||
|
text = string.gsub(text, "July", "Juli")
|
||||||
|
text = string.gsub(text, "August", "August")
|
||||||
|
text = string.gsub(text, "September", "September")
|
||||||
|
text = string.gsub(text, "October", "Oktober")
|
||||||
|
text = string.gsub(text, "November", "November")
|
||||||
|
text = string.gsub(text, "December", "Dezember")
|
||||||
|
|
||||||
|
return text
|
||||||
end
|
end
|
||||||
|
|
||||||
function run(msg, matches)
|
function run(msg, matches)
|
||||||
|
if string.match(msg.text, "^/[Z|z]eit$") or string.match(msg.text, "^/[T|t]ime$") then
|
||||||
|
text = os.date("Es ist %H:%M:%S Uhr [%p]")
|
||||||
|
return text
|
||||||
|
else
|
||||||
return getformattedLocalTime(matches[1])
|
return getformattedLocalTime(matches[1])
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
return {
|
return {
|
||||||
description = "Zeigt die lokale Zeit in einer Zeitzone an",
|
description = "Zeigt die lokale Zeit in einer Zeitzone an",
|
||||||
usage = {'/zeit [Land/Ort]'},
|
usage = {'/zeit [Land/Ort]'},
|
||||||
patterns = {'^/zeit (.*)$','^/Zeit (.*)$'},
|
patterns = {'^/[Z|z]eit (.*)$','^/[T|t]ime (.*)$','^/[Z|z]eit$','^/[T|t]ime$'},
|
||||||
run = run
|
run = run
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user