[gnome-maps/wip/mlundblad/otp-router-url-param] openTripPlanner: Use current locale
- From: Marcus Lundblad <mlundblad src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-maps/wip/mlundblad/otp-router-url-param] openTripPlanner: Use current locale
- Date: Wed, 2 Oct 2019 20:10:51 +0000 (UTC)
commit a1fa222a9504585ff92c22590aebdc00ec0405c7
Author: Marcus Lundblad <ml update uu se>
Date: Tue Oct 1 22:29:06 2019 +0200
openTripPlanner: Use current locale
Set current language in the request
as the "locale" parameter.
src/transitplugins/openTripPlanner.js | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
---
diff --git a/src/transitplugins/openTripPlanner.js b/src/transitplugins/openTripPlanner.js
index c8c0ad6..d11b67f 100644
--- a/src/transitplugins/openTripPlanner.js
+++ b/src/transitplugins/openTripPlanner.js
@@ -117,9 +117,17 @@ var OpenTripPlanner = class OpenTripPlanner {
this._query = Application.routeQuery;
this._baseUrl = params.baseUrl;
this._router = params.router || 'default';
+ this._routerUrl = params.routerUrl || null;
this._onlyTransitData = params.onlyTransitData || false;
this._walkingRoutes = [];
this._extendPrevious = false;
+ this._language = Utils.getLanguage();
+
+ if (!this._baseUrl && !this._routerUrl)
+ throw new Error('must specify either baseUrl or routerUrl as an argument');
+
+ if (this._baseUrl && this._routerUrl)
+ throw new Error('can not specify both baseUrl and routerUrl as arguments');
}
get plan() {
@@ -141,7 +149,8 @@ var OpenTripPlanner = class OpenTripPlanner {
}
_getRouterUrl() {
- return this._baseUrl + '/routers/' + this._router;
+ return this._routerUrl ? this._routerUrl :
+ this._baseUrl + '/routers/' + this._router;
}
_getMode(routeType) {
@@ -388,6 +397,7 @@ var OpenTripPlanner = class OpenTripPlanner {
_addCommonParams(params) {
params.numItineraries = 5;
params.showIntermediateStops = true;
+ params.locale = this._language;
let time = this._query.time;
let date = this._query.date;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]