Added new function: count the amount of characters in a time to display (implemented for german)

This commit is contained in:
ollo 2017-02-28 18:44:26 +01:00
parent 467530bec1
commit 0085f9ae22

View File

@ -132,3 +132,78 @@ function display_timestat(hours, minutes, longmode)
return ret
end
-- @fn display_countwords
-- Count the amount of characters, used to describe the current time in words
-- @param words the same structure, as generated with the function @see display_timestat
-- @return the amount of words, used to describe the time or <code>0</code> on errors
function display_countwords_de(words)
local amount=0
if (words.itis == 1) then
amount = amount + 5
end
if (words.fiveMin == 1) then
amount = amount + 4
end
if (words.twenty == 1) then
amount = amount + 7
end
if (words.ten == 1) then
amount = amount + 4
end
if (words.threequater == 1) then
amount = amount + 11
end
if (words.quater == 1) then
amount = amount + 7
end
if (words.before == 1) then
amount = amount + 3
end
if (words.after == 1) then
amount = amount + 4
end
if (words.half == 1) then
amount = amount + 4
end
if (words.twelve == 1) then
amount = amount + 5
end
if (words.seven == 1) then
amount = amount + 6
end
if (words.one == 1) then
amount = amount + 4
end
if (words.two == 1) then
amount = amount + 4
end
if (words.three == 1) then
amount = amount + 4
end
if (words.five == 1) then
amount = amount + 4
end
if (words.four == 1) then
amount = amount + 4
end
if (words.nine == 1) then
amount = amount + 4
end
if (words.eleven == 1) then
amount = amount + 3
end
if (words.eight == 1) then
amount = amount + 4
end
if (words.ten == 1) then
amount = amount + 4
end
if (words.clock == 1) then
amount = amount + 3
end
if (words.six == 1) then
amount = amount + 5
end
return amount
end