Added russian and arabic (thanks dondish and sheldon)

This commit is contained in:
David Ralph 2019-01-22 21:28:28 +00:00
parent c7e93afd24
commit 8f44c2d139
5 changed files with 34 additions and 3 deletions

View File

@ -101,6 +101,10 @@ German - Messages (by [untocodes](https://github.com/untocodes))
Hebrew - Messages (by [dondish](https://github.com/dondish))
Russian - Messages (by [dondish](https://github.com/dondish))
Arabic - Messages (by [MrSheldon](https://github.com/MrSheldon))
*Feel free to pull request with other translations!*
## Credits

File diff suppressed because one or more lines are too long

View File

@ -27,5 +27,10 @@ module.exports = {
],
ficodes: ['fi'],
decodes: ['de', 'de-AT', 'de-DE', 'de-LI', 'de-LU', 'de-CH'],
hecodes: ['he']
hecodes: ['he'],
rucodes: ['ru', 'ru-MO'],
arcodes: ['ar', 'ar-DZ', 'ar-BH', 'ar-EG', 'ar-IQ', 'ar-JO', 'ar-KW',
'ar-LB', 'ar-LY', 'ar-QA', 'ar-SA', 'ar-SY', 'ar-TN', 'ar-AE',
'ar-YE'
]
}

View File

@ -34,6 +34,8 @@ module.exports = class Functions {
else if (util.contains.call(codes.ficodes, nal)) message.spMessageSet(); //Finnish
else if (util.contains.call(codes.decodes, nal)) message.spMessageSet(); //German
else if (util.contains.call(codes.hecodes, nal)) message.heMessageSet(); //Hebrew
else if (util.contains.call(codes.rucodes, nal)) message.ruMessageSet(); //Russian
else if (util.contains.call(codes.arcodes, nal)) message.arMessageSet(); //Arabic
else message.engMessageSet(); //English
};

View File

@ -16,7 +16,9 @@
*/
const { setHTMLContent } = require('./utility.js');
const {
setHTMLContent
} = require('./utility.js');
module.exports = class Message {
// English
@ -89,4 +91,22 @@ module.exports = class Message {
else if (hour > 20) time = 'אחר הצהריים טובים'; // If it's after 6pm, set the time string to "Good afternoon"
setHTMLContent('.greeting', time); // Write the string contents to the HTML
}
// Russian
static ruMessageSet() {
let hour = new Date().getHours(); // Get the current hour
let time = 'Добрый Вечер'; // Set the default time string to "Good evening"
if (hour < 12) time = 'добрый утро'; // If it's before 12am, set the time string to "Good morning"
else if (hour > 20) time = 'добрый день'; // If it's after 6pm, set the time string to "Good afternoon"
setHTMLContent('.greeting', time); // Write the string contents to the HTML
}
// Arabic
static arMessageSet() {
let hour = new Date().getHours(); // Get the current hour
let time = 'مساء الخير'; // Set the default time string to "Good evening"
if (hour < 12) time = 'صباح الخير'; // If it's before 12am, set the time string to "Good morning"
else if (hour > 20) time = 'مساء الخير'; // If it's after 6pm, set the time string to "Good afternoon"
setHTMLContent('.greeting', time); // Write the string contents to the HTML
}
}