From 06d3c4b8b23968e487fb1692e0ebbc4da54ef565 Mon Sep 17 00:00:00 2001 From: Simone Tisa Date: Sat, 1 Jul 2017 13:48:34 +0200 Subject: [PATCH 1/2] introdotta localizzazione --- lib/wundergroundnode.js | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/wundergroundnode.js b/lib/wundergroundnode.js index 5b939e1..d84b94b 100644 --- a/lib/wundergroundnode.js +++ b/lib/wundergroundnode.js @@ -2,7 +2,7 @@ var request = require('request'); var _ = require('underscore'); var moment = require('moment'); -var Wunderground = function(apikey) { +var Wunderground = function(apikey, language) { "use strict"; var that = this; @@ -130,7 +130,7 @@ var Wunderground = function(apikey) { } // Construct the url - var url = 'http://api.wunderground.com/api/' + apikey + '/' + that.chainedRequests.join('') + 'q/'+query + format; + var url = 'http://api.wunderground.com/api/' + apikey + '/lang:' + language + '/' + that.chainedRequests.join('') + 'q/'+query + format; that.chainedRequests = []; // Request the url diff --git a/package.json b/package.json index e33a26b..b871343 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "wundergroundnode", - "version": "0.11.0", + "version": "0.12.0", "main": "./lib/wundergroundnode.js", "description": "Weather Underground chainable API for nodeJS", "homepage": "http://www.github.com/cendrizzi/wundergroundnode", From 56cf6562061b7a539ce5d6886fccd5804755950d Mon Sep 17 00:00:00 2001 From: simont77 Date: Tue, 26 Sep 2017 09:54:55 +0200 Subject: [PATCH 2/2] made language_code parameter optional --- README.md | 4 +++- lib/wundergroundnode.js | 5 ++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 4a3687d..30a88b2 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,9 @@ This is a chainable weather underground client for node.js npm install wundergroundnode var Wunderground = require('wundergroundnode'); var myKey = '12312314'; - var wunderground = new Wunderground(myKey); + var wunderground = new Wunderground(myKey, language_code); + +Parameter "language_code" is optional, if missing English will be used. For accepted values refers to https://www.wunderground.com/weather/api/d/docs?d=language-support # How To Use The syntax follows a simple pattern: diff --git a/lib/wundergroundnode.js b/lib/wundergroundnode.js index d84b94b..2f8269f 100644 --- a/lib/wundergroundnode.js +++ b/lib/wundergroundnode.js @@ -130,7 +130,10 @@ var Wunderground = function(apikey, language) { } // Construct the url - var url = 'http://api.wunderground.com/api/' + apikey + '/lang:' + language + '/' + that.chainedRequests.join('') + 'q/'+query + format; + if (language===undefined) + var url = 'http://api.wunderground.com/api/' + apikey + '/' + that.chainedRequests.join('') + 'q/'+query + format; + else + var url = 'http://api.wunderground.com/api/' + apikey + '/lang:' + language + '/' + that.chainedRequests.join('') + 'q/'+query + format; that.chainedRequests = []; // Request the url