mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-08-22 21:11:17 +00:00
Finish translation system. #191
This commit is contained in:
@@ -47,12 +47,10 @@ Module.register("calendar",{
|
||||
|
||||
// Define required translations.
|
||||
getTranslations: function() {
|
||||
return {
|
||||
en: "translations/en.json",
|
||||
de: "translations/de.json",
|
||||
nl: "translations/nl.json",
|
||||
fr: "translations/fr.json"
|
||||
};
|
||||
// The translations for the defaut modules are defined in the core translation files.
|
||||
// Therefor we can just return false. Otherwise we should have returned a dictionairy.
|
||||
// If you're trying to build yiur own module including translations, check out the documentation.
|
||||
return false;
|
||||
},
|
||||
|
||||
// Override start method.
|
||||
@@ -120,20 +118,20 @@ Module.register("calendar",{
|
||||
|
||||
var titleWrapper = document.createElement("td"),
|
||||
repeatingCountTitle = '';
|
||||
|
||||
|
||||
if (this.config.displayRepeatingCountTitle) {
|
||||
|
||||
|
||||
|
||||
if (this.config.displayRepeatingCountTitle) {
|
||||
|
||||
repeatingCountTitle = this.countTitleForUrl(event.url);
|
||||
|
||||
|
||||
if(repeatingCountTitle !== '') {
|
||||
var thisYear = new Date().getFullYear(),
|
||||
yearDiff = thisYear - event.firstYear;
|
||||
|
||||
|
||||
repeatingCountTitle = ', '+ yearDiff + '. ' + repeatingCountTitle;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
titleWrapper.innerHTML = this.titleTransform(event.title) + repeatingCountTitle;
|
||||
titleWrapper.className = "title bright";
|
||||
eventWrapper.appendChild(titleWrapper);
|
||||
@@ -356,4 +354,3 @@ Module.register("calendar",{
|
||||
return title;
|
||||
}
|
||||
});
|
||||
|
||||
|
@@ -1,7 +0,0 @@
|
||||
{
|
||||
"TODAY": "Heute"
|
||||
, "TOMORROW": "Morgen"
|
||||
, "RUNNING": "noch"
|
||||
, "LOADING": "Lade Termine …"
|
||||
, "EMPTY": "Keine Termine."
|
||||
}
|
@@ -1,7 +0,0 @@
|
||||
{
|
||||
"TODAY": "Today"
|
||||
, "TOMORROW": "Tomorrow"
|
||||
, "RUNNING": "Ends in"
|
||||
, "LOADING": "Loading events …"
|
||||
, "EMPTY": "No upcoming events."
|
||||
}
|
@@ -1,7 +0,0 @@
|
||||
{
|
||||
"TODAY": "Aujourd'hui"
|
||||
, "TOMORROW": "Demain"
|
||||
, "RUNNING": "Se termine dans"
|
||||
, "LOADING": "Chargement des RDV …"
|
||||
, "EMPTY": "Aucun RDV."
|
||||
}
|
@@ -1,7 +0,0 @@
|
||||
{
|
||||
"TODAY": "Vandaag"
|
||||
, "TOMORROW": "Morgen"
|
||||
, "RUNNING": "Eindigd over"
|
||||
, "LOADING": "Bezig met laden …"
|
||||
, "EMPTY": "Geen geplande afspraken."
|
||||
}
|
@@ -62,6 +62,14 @@ Module.register("currentweather",{
|
||||
return ["weather-icons.css", "currentweather.css"];
|
||||
},
|
||||
|
||||
// Define required translations.
|
||||
getTranslations: function() {
|
||||
// The translations for the defaut modules are defined in the core translation files.
|
||||
// Therefor we can just return false. Otherwise we should have returned a dictionairy.
|
||||
// If you're trying to build yiur own module including translations, check out the documentation.
|
||||
return false;
|
||||
},
|
||||
|
||||
// Define start sequence.
|
||||
start: function() {
|
||||
Log.info("Starting module: " + this.name);
|
||||
@@ -100,7 +108,7 @@ Module.register("currentweather",{
|
||||
}
|
||||
|
||||
if (!this.loaded) {
|
||||
wrapper.innerHTML = "Loading weather ...";
|
||||
wrapper.innerHTML = this.translate('LOADING');
|
||||
wrapper.className = "dimmed light small";
|
||||
return wrapper;
|
||||
}
|
||||
@@ -111,14 +119,14 @@ Module.register("currentweather",{
|
||||
var windIcon = document.createElement("span");
|
||||
windIcon.className = "wi wi-strong-wind dimmed";
|
||||
small.appendChild(windIcon);
|
||||
|
||||
|
||||
var windSpeed = document.createElement("span");
|
||||
windSpeed.innerHTML = " " + this.windSpeed;
|
||||
small.appendChild(windSpeed);
|
||||
|
||||
|
||||
if (this.config.showWindDirection) {
|
||||
var windDirection = document.createElement("span");
|
||||
windDirection.innerHTML = " " + this.windDirection;
|
||||
windDirection.innerHTML = " " + this.translate(this.windDirection);
|
||||
small.appendChild(windDirection);
|
||||
}
|
||||
var spacer = document.createElement("span");
|
||||
@@ -205,13 +213,13 @@ Module.register("currentweather",{
|
||||
*/
|
||||
processWeather: function(data) {
|
||||
this.temperature = this.roundValue(data.main.temp);
|
||||
|
||||
|
||||
if (this.config.useBeaufort){
|
||||
this.windSpeed = this.ms2Beaufort(this.roundValue(data.wind.speed));
|
||||
}else {
|
||||
this.windSpeed = parseFloat(data.wind.speed).toFixed(0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
this.windDirection = this.deg2Cardinal(data.wind.deg);
|
||||
this.weatherType = this.config.iconTable[data.weather[0].icon];
|
||||
@@ -220,7 +228,7 @@ Module.register("currentweather",{
|
||||
var sunrise = new Date(data.sys.sunrise * 1000);
|
||||
var sunset = new Date(data.sys.sunset * 1000);
|
||||
|
||||
// The moment().format('h') method has a bug on the Raspberry Pi.
|
||||
// The moment().format('h') method has a bug on the Raspberry Pi.
|
||||
// So we need to generate the timestring manually.
|
||||
// See issue: https://github.com/MichMich/MagicMirror/issues/181
|
||||
var sunriseSunsetDateObject = (sunrise < now && sunset > now) ? sunset : sunrise;
|
||||
@@ -293,7 +301,7 @@ Module.register("currentweather",{
|
||||
*
|
||||
* return number - Rounded Temperature.
|
||||
*/
|
||||
|
||||
|
||||
deg2Cardinal: function(deg) {
|
||||
if (deg>11.25 && deg<=33.75){
|
||||
return "NNE";
|
||||
@@ -330,7 +338,7 @@ Module.register("currentweather",{
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
|
||||
roundValue: function(temperature) {
|
||||
return parseFloat(temperature).toFixed(1);
|
||||
}
|
||||
|
@@ -31,6 +31,14 @@ Module.register("newsfeed",{
|
||||
return ["moment.js"];
|
||||
},
|
||||
|
||||
// Define required translations.
|
||||
getTranslations: function() {
|
||||
// The translations for the defaut modules are defined in the core translation files.
|
||||
// Therefor we can just return false. Otherwise we should have returned a dictionairy.
|
||||
// If you're trying to build yiur own module including translations, check out the documentation.
|
||||
return false;
|
||||
},
|
||||
|
||||
// Define start sequence.
|
||||
start: function() {
|
||||
Log.info("Starting module: " + this.name);
|
||||
@@ -55,7 +63,7 @@ Module.register("newsfeed",{
|
||||
this.scheduleUpdateInterval();
|
||||
}
|
||||
|
||||
this.loaded = true;
|
||||
this.loaded = true;
|
||||
}
|
||||
},
|
||||
|
||||
@@ -100,7 +108,7 @@ Module.register("newsfeed",{
|
||||
}
|
||||
|
||||
} else {
|
||||
wrapper.innerHTML = "Loading news ...";
|
||||
wrapper.innerHTML = this.translate("LOADING");
|
||||
wrapper.className = "small dimmed";
|
||||
}
|
||||
|
||||
|
@@ -61,6 +61,14 @@ Module.register("weatherforecast",{
|
||||
return ["weather-icons.css", "weatherforecast.css"];
|
||||
},
|
||||
|
||||
// Define required translations.
|
||||
getTranslations: function() {
|
||||
// The translations for the defaut modules are defined in the core translation files.
|
||||
// Therefor we can just return false. Otherwise we should have returned a dictionairy.
|
||||
// If you're trying to build yiur own module including translations, check out the documentation.
|
||||
return false;
|
||||
},
|
||||
|
||||
// Define start sequence.
|
||||
start: function() {
|
||||
Log.info("Starting module: " + this.name);
|
||||
@@ -93,7 +101,7 @@ Module.register("weatherforecast",{
|
||||
}
|
||||
|
||||
if (!this.loaded) {
|
||||
wrapper.innerHTML = "Loading weather ...";
|
||||
wrapper.innerHTML = this.translate('LOADING');
|
||||
wrapper.className = "dimmed light small";
|
||||
return wrapper;
|
||||
}
|
||||
|
Reference in New Issue
Block a user