language option with default 'en'

This commit is contained in:
Jannis R 2018-07-09 12:40:38 +02:00
parent c80f355d47
commit 0199749a31
No known key found for this signature in database
GPG key ID: 0FE83946296A88A5
8 changed files with 17 additions and 7 deletions

View file

@ -28,7 +28,8 @@ With `opt`, you can override the default options, which look like this:
direction: null, // only show departures heading to this station
duration: 10, // show departures for the next n minutes
stationLines: false, // parse & expose lines of the station?
remarks: true // parse & expose hints & warnings?
remarks: true, // parse & expose hints & warnings?
language: 'en' // language to get results in
}
```

View file

@ -67,7 +67,8 @@ With `opt`, you can override the default options, which look like this:
polylines: false, // return a shape for each leg?
remarks: true, // parse & expose hints & warnings?
// Consider walking to nearby stations at the beginning of a journey?
startWithWalking: true
startWithWalking: true,
language: 'en' // language to get results in
}
```

View file

@ -12,6 +12,7 @@ With `opt`, you can override the default options, which look like this:
, addresses: true
, poi: true // points of interest
, stationLines: false // parse & expose lines of the station?
, language: 'en' // language to get results in
}
```

View file

@ -11,7 +11,8 @@ With `opt`, you can override the default options, which look like this:
distance: null, // maximum walking distance in meters
poi: false, // return points of interest?
stations: true, // return stations?
stationLines: false // parse & expose lines of the station?
stationLines: false, // parse & expose lines of the station?
language: 'en' // language to get results in
}
```

View file

@ -11,7 +11,8 @@ With `opt`, you can override the default options, which look like this:
results: 256, // maximum number of vehicles
duration: 30, // compute frames for the next n seconds
frames: 3, // nr of frames to compute
polylines: false // return a track shape for each vehicle?
polylines: false, // return a track shape for each vehicle?
language: 'en' // language to get results in
}
```

View file

@ -23,7 +23,8 @@ With `opt`, you can override the default options, which look like this:
```js
{
stationLines: false // parse & expose lines of the station?
stationLines: false, // parse & expose lines of the station?
language: 'en' // language to get results in
}
## Response

View file

@ -29,7 +29,8 @@ With `opt`, you can override the default options, which look like this:
when: new Date(),
stopovers: true, // return stations on the way?
polyline: false, // return a shape for the trip?
remarks: true // parse & expose hints & warnings?
remarks: true, // parse & expose hints & warnings?
language: 'en' // language to get results in
}
```

View file

@ -12,7 +12,10 @@ const {fetch} = require('fetch-ponyfill')({Promise})
const md5 = input => createHash('md5').update(input).digest()
const request = (profile, opt, data) => {
const body = profile.transformReqBody({lang: 'en', svcReqL: [data]})
const body = profile.transformReqBody({
lang: opt.language || 'en',
svcReqL: [data]
})
const req = profile.transformReq({
method: 'post',
// todo: CORS? referrer policy?