Skip to content

Commit

Permalink
Merge pull request #62 from ripe-tech/acaldas/translation
Browse files Browse the repository at this point in the history
added locale api
  • Loading branch information
joamag authored Jul 30, 2018
2 parents e2d660a + 9e25a7b commit 46347b0
Show file tree
Hide file tree
Showing 6 changed files with 88 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/js/api/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
const locale = require("./locale");
const oauth = require("./oauth");
const order = require("./order");
const size = require("./size");

Object.assign(module.exports, locale);
Object.assign(module.exports, oauth);
Object.assign(module.exports, order);
Object.assign(module.exports, size);
27 changes: 27 additions & 0 deletions src/js/api/locale.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
if (typeof require !== "undefined") {
// eslint-disable-next-line no-redeclare
var base = require("../base");
// eslint-disable-next-line no-redeclare
var ripe = base.ripe;
}

ripe.Ripe.prototype.locale = function(value, locale, options, callback) {
return this.localeMultiple(value, locale, options, callback);
};

ripe.Ripe.prototype.localeMultiple = function(values, locale, options, callback) {
values = typeof values === "string" ? [values] : values;
callback = typeof options === "function" ? options : callback;
options = typeof options === "function" ? {} : options;
var url = this.url + "locale";
options = Object.assign(options, {
url: url,
method: "GET",
params: {
values: values,
locale: locale
}
});
options = this._build(options);
return this._cacheURL(options.url, options, callback);
};
2 changes: 2 additions & 0 deletions src/js/main.join.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"base/utils.js",
"base/api.js",
"base/auth.js",
"api/locale.js",
"api/oauth.js",
"api/order.js",
"api/size.js",
Expand All @@ -32,6 +33,7 @@
"base/utils.js",
"base/api.js",
"base/auth.js",
"api/locale.js",
"api/oauth.js",
"api/order.js",
"api/size.js",
Expand Down
1 change: 1 addition & 0 deletions src/js/ripe-min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 28 additions & 0 deletions src/js/ripe.js
Original file line number Diff line number Diff line change
Expand Up @@ -1397,6 +1397,34 @@ if (typeof require !== "undefined") {
var ripe = base.ripe;
}

ripe.Ripe.prototype.locale = function(value, locale, options, callback) {
return this.localeMultiple(value, locale, options, callback);
};

ripe.Ripe.prototype.localeMultiple = function(values, locale, options, callback) {
values = typeof values === "string" ? [values] : values;
callback = typeof options === "function" ? options : callback;
options = typeof options === "function" ? {} : options;
var url = this.url + "locale";
options = Object.assign(options, {
url: url,
method: "GET",
params: {
values: values,
locale: locale
}
});
options = this._build(options);
return this._cacheURL(options.url, options, callback);
};

if (typeof require !== "undefined") {
// eslint-disable-next-line no-redeclare
var base = require("../base");
// eslint-disable-next-line no-redeclare
var ripe = base.ripe;
}

ripe.Ripe.prototype.oauthAccessToken = function(code, options, callback) {
callback = typeof options === "function" ? options : callback;
options = typeof options === "function" ? {} : options;
Expand Down
28 changes: 28 additions & 0 deletions src/python/ripe_demo/static/js/ripe.js
Original file line number Diff line number Diff line change
Expand Up @@ -1397,6 +1397,34 @@ if (typeof require !== "undefined") {
var ripe = base.ripe;
}

ripe.Ripe.prototype.locale = function(value, locale, options, callback) {
return this.localeMultiple(value, locale, options, callback);
};

ripe.Ripe.prototype.localeMultiple = function(values, locale, options, callback) {
values = typeof values === "string" ? [values] : values;
callback = typeof options === "function" ? options : callback;
options = typeof options === "function" ? {} : options;
var url = this.url + "locale";
options = Object.assign(options, {
url: url,
method: "GET",
params: {
values: values,
locale: locale
}
});
options = this._build(options);
return this._cacheURL(options.url, options, callback);
};

if (typeof require !== "undefined") {
// eslint-disable-next-line no-redeclare
var base = require("../base");
// eslint-disable-next-line no-redeclare
var ripe = base.ripe;
}

ripe.Ripe.prototype.oauthAccessToken = function(code, options, callback) {
callback = typeof options === "function" ? options : callback;
options = typeof options === "function" ? {} : options;
Expand Down

0 comments on commit 46347b0

Please sign in to comment.