Merge pull request #353 from MichMich/develop

Update to 2.0.2
This commit is contained in:
Michael Teeuw 2016-06-05 12:06:27 +02:00
commit 544a1381fc
25 changed files with 284 additions and 114 deletions

View File

@ -2,6 +2,20 @@
All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/).
## [2.0.2] - 2016-06-05
### Added
- Norwegian Translations (nb and nn)
- Portuguese Translation
- Swedish Translation
### Fixed
- Added reference to Italian Translation.
- Added the missing NE translation to all languages. [#334](https://github.com/MichMich/MagicMirror/issues/344)
- Added proper User-Agent string to calendar call.
### Changed
- Add option to use locationID in weather modules.
## [2.0.1] - 2016-05-18
### Added
- Changelog

View File

@ -41,6 +41,7 @@ var config = {
position: 'top_right',
config: {
location: 'New York',
locationID: '', //ID from bulk.openweather.org/sample/
appid: 'YOUR_OPENWEATHER_API_KEY'
}
},
@ -50,6 +51,7 @@ var config = {
header: 'Weather Forecast',
config: {
location: 'New York',
locationID: '5128581', //ID from bulk.openweather.org/sample/
appid: 'YOUR_OPENWEATHER_API_KEY'
}
},

View File

@ -152,7 +152,7 @@ var Module = Class.extend({
},
/* socket()
* Returns a socket object. If it doesn"t exsist, it"s created.
* Returns a socket object. If it doesn"t exist, it"s created.
* It also registers the notification callback.
*/
socket: function() {

View File

@ -298,7 +298,7 @@ If no translation is found, a fallback will be used. The fallback sequence is as
- 4. Translation as defined in core translation file of the fallback language (the first defined core translation file).
- 5. The key (identifier) of the translation.
When adding translations to your module, it's a good idea to see if an apropriate translation is already available in the [core translation files](https://github.com/MichMich/MagicMirror/tree/master/translations). This way, your module can benefit from the exsisting translations.
When adding translations to your module, it's a good idea to see if an apropriate translation is already available in the [core translation files](https://github.com/MichMich/MagicMirror/tree/master/translations). This way, your module can benefit from the existing translations.
**Example:**
````javascript

View File

@ -49,7 +49,7 @@ Module.register("calendar",{
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.
// If you're trying to build your own module including translations, check out the documentation.
return false;
},

View File

@ -25,7 +25,12 @@ var CalendarFetcher = function(url, reloadInterval, maximumEntries, maximumNumbe
clearTimeout(reloadTimer);
reloadTimer = null;
ical.fromURL(url, {}, function(err, data) {
var opts = {
headers: {
'User-Agent': 'Mozilla/5.0 (Node.js 6.0.0) MagicMirror/v2 (https://github.com/MichMich/MagicMirror/)'
}
}
ical.fromURL(url, opts, function(err, data) {
if (err) {
fetchFailedCallback(self, err);
scheduleTimer();
@ -188,7 +193,7 @@ var CalendarFetcher = function(url, reloadInterval, maximumEntries, maximumNumbe
};
/* broadcastItems()
* Broadcast the exsisting events.
* Broadcast the existing events.
*/
this.broadcastEvents = function() {
//console.log('Broadcasting ' + events.length + ' events.');

View File

@ -30,8 +30,8 @@ module.exports = NodeHelper.create({
},
/* createFetcher(url, reloadInterval)
* Creates a fetcher for a new url if it doesn't exsist yet.
* Otherwise it reuses the exsisting one.
* Creates a fetcher for a new url if it doesn't exist yet.
* Otherwise it reuses the existing one.
*
* attribute url string - URL of the news feed.
* attribute reloadInterval number - Reload interval in milliseconds.
@ -69,7 +69,7 @@ module.exports = NodeHelper.create({
self.fetchers[url] = fetcher;
} else {
//console.log('Use exsisting news fetcher for url: ' + url);
//console.log('Use existing news fetcher for url: ' + url);
fetcher = self.fetchers[url];
fetcher.broadcastEvents();
}

View File

@ -14,6 +14,7 @@ modules: [
config: {
// See 'Configuration options' for more information.
location: 'Amsterdam,Netherlands',
locationID: '', //Location ID from http://bulk.openweather.org/sample/
appid: 'abcde12345abcde12345abcde12345ab' //openweathermap.org API key.
}
}
@ -42,6 +43,13 @@ The following properties can be configured:
<br><b>Default value:</b> <code>New York</code>
</td>
</tr>
<tr>
<td><code>locationID</code></td>
<td>Location ID from <a href="http://bulk.openweather.org/sample/">OpenWeather</a> <b>This will override anything you put in location.</b><br>Leave blank if you want to use location.
<br><b>Example:</b> <code>1234567</code>
<br><b>Default value:</b> <code></code>
</td>
</tr>
<tr>
<td><code>appid</code></td>
<td>The <a href="https://home.openweathermap.org" target="_blank">OpenWeatherMap</a> API key, which can be obtained by creating an OpenWeatherMap account.<br>

View File

@ -12,6 +12,7 @@ Module.register("currentweather",{
// Default module config.
defaults: {
location: "",
locationID: "",
appid: "",
units: config.units,
updateInterval: 10 * 60 * 1000, // every 10 minutes
@ -198,7 +199,11 @@ Module.register("currentweather",{
*/
getParams: function() {
var params = "?";
if(this.config.locationID !== "") {
params += "id=" + this.config.locationID;
} else {
params += "q=" + this.config.location;
}
params += "&units=" + this.config.units;
params += "&lang=" + this.config.lang;
params += "&APPID=" + this.config.appid;

View File

@ -117,7 +117,7 @@ var Fetcher = function(url, reloadInterval, encoding) {
};
/* broadcastItems()
* Broadcast the exsisting items.
* Broadcast the existing items.
*/
this.broadcastItems = function() {
if (items.length <= 0) {

View File

@ -25,8 +25,8 @@ module.exports = NodeHelper.create({
},
/* createFetcher(url, reloadInterval)
* Creates a fetcher for a new url if it doesn't exsist yet.
* Otherwise it reoses the exsisting one.
* Creates a fetcher for a new url if it doesn't exist yet.
* Otherwise it reoses the existing one.
*
* attribute url string - URL of the news feed.
* attribute reloadInterval number - Reload interval in milliseconds.
@ -62,7 +62,7 @@ module.exports = NodeHelper.create({
self.fetchers[url] = fetcher;
} else {
console.log("Use exsisting news fetcher for url: " + url);
console.log("Use existing news fetcher for url: " + url);
fetcher = self.fetchers[url];
fetcher.setReloadInterval(reloadInterval);
fetcher.broadcastItems();

View File

@ -14,6 +14,7 @@ modules: [
config: {
// See 'Configuration options' for more information.
location: 'Amsterdam,Netherlands',
locationID: '', //Location ID from http://bulk.openweather.org/sample/
appid: 'abcde12345abcde12345abcde12345ab' //openweathermap.org API key.
}
}
@ -42,6 +43,13 @@ The following properties can be configured:
<br><b>Default value:</b> <code>New York</code>
</td>
</tr>
<tr>
<td><code>locationID</code></td>
<td>Location ID from <a href="http://bulk.openweather.org/sample/">OpenWeather</a> <b>This will override anything you put in location.</b><br>Leave blank if you want to use location.
<br><b>Example:</b> <code>1234567</code>
<br><b>Default value:</b> <code></code>
</td>
</tr>
<tr>
<td><code>appid</code></td>
<td>The <a href="https://home.openweathermap.org" target="_blank">OpenWeatherMap</a> API key, which can be obtained by creating an OpenWeatherMap account.<br>

View File

@ -12,6 +12,7 @@ Module.register("weatherforecast",{
// Default module config.
defaults: {
location: "",
locationID: "",
appid: "",
units: config.units,
maxNumberOfDays: 7,
@ -195,7 +196,11 @@ Module.register("weatherforecast",{
*/
getParams: function() {
var params = "?";
if(this.config.locationID !== "") {
params += "id=" + this.config.locationID;
} else {
params += "q=" + this.config.location;
}
params += "&units=" + this.config.units;
params += "&lang=" + this.config.lang;
/*

View File

@ -11,6 +11,7 @@
/* WEATHER */
"N": "N",
"NNE": "NNO",
"NE": "NO",
"ENE": "ONO",
"E": "O",
"ESE": "OSO",

View File

@ -11,6 +11,7 @@
/* WEATHER */
"N": "N",
"NNE": "NNE",
"NE": "NE",
"ENE": "ENE",
"E": "E",
"ESE": "ESE",

View File

@ -11,6 +11,7 @@
/* WEATHER */
"N": "N",
"NNE": "NNE",
"NE": "NE",
"ENE": "ENE",
"E": "E",
"ESE": "ESE",

View File

@ -11,6 +11,7 @@
/* WEATHER */
"N": "N",
"NNE": "NNE",
"NE": "NE",
"ENE": "ENE",
"E": "E",
"ESE": "ESE",

View File

@ -11,6 +11,7 @@
/* WEATHER */
"N": "N",
"NNE": "NNE",
"NE": "NE",
"ENE": "ENE",
"E": "E",
"ESE": "ESE",

View File

@ -11,6 +11,7 @@
/* WEATHER */
"N": "N",
"NNE": "NNE",
"NE": "NE",
"ENE": "ENE",
"E": "E",
"ESE": "ESE",

28
translations/nb.json Normal file
View File

@ -0,0 +1,28 @@
{
/* GENERAL */
"LOADING": "Laster &hellip;",
/* CALENDAR */
"TODAY": "I dag",
"TOMORROW": "I morgen",
"RUNNING": "Slutter om",
"EMPTY": "Ingen kommende arrangementer.",
/* WEATHER */
"N": "N",
"NNE": "NNØ",
"NE": "NØ",
"ENE": "ØNØ",
"E": "Ø",
"ESE": "ØSØ",
"SE": "SØ",
"SSE": "SSØ",
"S": "S",
"SSW": "SSV",
"SW": "SV",
"WSW": "VSV",
"W": "V",
"WNW": "VNV",
"NW": "NV",
"NNW": "NNV"
}

View File

@ -11,6 +11,7 @@
/* WEATHER */
"N": "N",
"NNE": "NNO",
"NE": "NO",
"ENE": "ONO",
"E": "O",
"ESE": "OZO",

28
translations/nn.json Normal file
View File

@ -0,0 +1,28 @@
{
/* GENERAL */
"LOADING": "Lastar &hellip;",
/* CALENDAR */
"TODAY": "I dag",
"TOMORROW": "I morgon",
"RUNNING": "Sluttar om",
"EMPTY": "Ingen komande hendingar.",
/* WEATHER */
"N": "N",
"NNE": "NNA",
"NE": "NA",
"ENE": "ANA",
"E": "A",
"ESE": "ASA",
"SE": "SA",
"SSE": "SSA",
"S": "S",
"SSW": "SSV",
"SW": "SV",
"WSW": "VSV",
"W": "V",
"WNW": "VNV",
"NW": "NV",
"NNW": "NNV"
}

28
translations/pt.json Normal file
View File

@ -0,0 +1,28 @@
{
/* GENERAL */
"LOADING": "A carregar &hellip;",
/* CALENDAR */
"TODAY": "Hoje",
"TOMORROW": "Amanhã",
"RUNNING": "Termina em",
"EMPTY": "Sem eventos a chegar.",
/* WEATHER */
"N": "N",
"NNE": "NNE",
"NE": "NE",
"ENE": "ENE",
"E": "E",
"ESE": "ESE",
"SE": "SE",
"SSE": "SSE",
"S": "S",
"SSW": "SSO",
"SW": "SO",
"WSW": "OSO",
"W": "O",
"WNW": "ONO",
"NW": "NO",
"NNW": "NNO"
}

28
translations/sv.json Normal file
View File

@ -0,0 +1,28 @@
{
/* GENERAL */
"LOADING": "Laddar &hellip;",
/* CALENDAR */
"TODAY": "Idag",
"TOMORROW": "Imorgon",
"RUNNING": "Slutar",
"EMPTY": "Inga kommande händelser.",
/* WEATHER */
"N": "N",
"NNE": "NNO",
"NE": "NO",
"ENE": "ONO",
"E": "Ö",
"ESE": "OSO",
"SE": "SO",
"SSE": "SSO",
"S": "S",
"SSW": "SSV",
"SW": "SV",
"WSW": "VSV",
"W": "V",
"WNW": "VNV",
"NW": "NV",
"NNW": "NNV"
}

View File

@ -6,11 +6,15 @@
*/
var translations = {
"en" : "translations/en.json",
"nl" : "translations/nl.json",
"de" : "translations/de.json",
"fr" : "translations/fr.json",
"fy" : "translations/fy.json",
"es" : "translations/es.json",
"it" : "translations/it.json",
"en" : "translations/en.json", // English
"nl" : "translations/nl.json", // Dutch
"de" : "translations/de.json", // German
"fr" : "translations/fr.json", // French
"fy" : "translations/fy.json", // Frysk
"es" : "translations/es.json", // Spanish
"nb" : "translations/nb.json", // Norsk bokmål
"nn" : "translations/nn.json", // Norsk nynorsk
"pt" : "translations/pt.json", // Português
"sv" : "translations/sv.json", // Svenska
"it" : "translations/it.json", // Italian
};