mirror of https://github.com/mue/mue.git
commit
f0ad327ca5
|
@ -30,7 +30,8 @@
|
|||
// https://eloquentjavascript.net/05_higher_order.html
|
||||
|
||||
function setDaytimeMessage () {
|
||||
if (window.navigator.language === 'it' || window.navigator.language === 'it-ch') itaMessageSet();
|
||||
if (window.browser.language === 'it' || window.browser.language === 'it-ch') itaMessageSet();
|
||||
if (window.browser.language === 'de') nlMessageSet();
|
||||
else engMessageSet();
|
||||
};
|
||||
|
||||
|
@ -261,3 +262,14 @@ function itaMessageSet() {
|
|||
setHTMLContent(".greeting", `Buon${getDaytime()}`);
|
||||
}
|
||||
|
||||
// Dutch
|
||||
function nlMessageSet() {
|
||||
let hour = new Date().getHours(); // Get the current hour
|
||||
let time = 'Goedemiddag'; // Set the default time string to "Good evening"
|
||||
|
||||
if (hour < 12) time = 'Goedemorgen'; // If it's before 12am, set the time string to "Good morning"
|
||||
else if (hour > 18) time = 'Goedenavond'; // If it's after 6pm, set the time string to "Good afternoon"
|
||||
else time = 'Goedemiddag'; // If It's unknown, set the time stirng to "Good evening"
|
||||
|
||||
setHTMLContent('.greeting', time); // Write the string contents to the HTML
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue