mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 10:02:05 +00:00
⚡ Adding a language selection to the OpenWeatherMap API (#1023)
This commit is contained in:
committed by
GitHub
parent
1125cf892b
commit
52c1cfbbde
@@ -188,6 +188,16 @@ export class OpenWeatherMap implements INodeType {
|
||||
description: 'The id of city to return the weather of. List can be downloaded here: http://bulk.openweathermap.org/sample/',
|
||||
},
|
||||
|
||||
{
|
||||
displayName: 'Language',
|
||||
name: 'language',
|
||||
type: 'string',
|
||||
default: '',
|
||||
placeholder: 'en',
|
||||
required: false,
|
||||
description: 'The two letter language code to get your output in (eg. en, de, ...).',
|
||||
},
|
||||
|
||||
],
|
||||
};
|
||||
|
||||
@@ -206,6 +216,7 @@ export class OpenWeatherMap implements INodeType {
|
||||
|
||||
let endpoint = '';
|
||||
let locationSelection;
|
||||
let language;
|
||||
|
||||
let qs: IDataObject;
|
||||
|
||||
@@ -231,6 +242,11 @@ export class OpenWeatherMap implements INodeType {
|
||||
throw new Error(`The locationSelection "${locationSelection}" is not known!`);
|
||||
}
|
||||
|
||||
// Get the language
|
||||
language = this.getNodeParameter('language', i) as string;
|
||||
if (language) {
|
||||
qs.lang = language;
|
||||
}
|
||||
|
||||
if (operation === 'currentWeather') {
|
||||
// ----------------------------------
|
||||
|
||||
Reference in New Issue
Block a user