You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by ro...@apache.org on 2015/11/20 14:56:05 UTC
[3/3] fauxton commit: updated refs/heads/master to f4ff1c5
cors: use i18n system for changeable strings
PR: #578
PR-URL: https://github.com/apache/couchdb-fauxton/pull/578
Reviewed-By: Michelle Phung <mi...@apache.org>
Project: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/commit/270183b3
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/tree/270183b3
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/diff/270183b3
Branch: refs/heads/master
Commit: 270183b3e5e828eadcce512b2a265e6ae9ff547c
Parents: 915ca94
Author: Robert Kowalski <ro...@apache.org>
Authored: Tue Nov 17 15:14:00 2015 +0100
Committer: Robert Kowalski <ro...@apache.org>
Committed: Fri Nov 20 14:55:46 2015 +0100
----------------------------------------------------------------------
app/addons/cors/components.react.jsx | 23 ++++-------------------
i18n.json.default | 4 +++-
2 files changed, 7 insertions(+), 20 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/270183b3/app/addons/cors/components.react.jsx
----------------------------------------------------------------------
diff --git a/app/addons/cors/components.react.jsx b/app/addons/cors/components.react.jsx
index 13d20af..71f9382 100644
--- a/app/addons/cors/components.react.jsx
+++ b/app/addons/cors/components.react.jsx
@@ -11,12 +11,13 @@
// the License.
define([
+ "app",
"api",
"react",
"addons/cors/stores",
"addons/cors/resources",
"addons/cors/actions"
-], function (FauxtonAPI, React, Stores, Resources, Actions) {
+], function (app, FauxtonAPI, React, Stores, Resources, Actions) {
var corsStore = Stores.corsStore;
var validateOrigin = function (origin) {
@@ -259,14 +260,7 @@ define([
enableCorsChange: function (event) {
if (this.state.corsEnabled && !_.isEmpty(this.state.origins) ) {
- var msg = FauxtonAPI.getExtensions('cors:disableCorsPrompt');
- if (_.isUndefined(msg[0])) {
- msg = 'Are you sure? Disabling CORS will overwrite your specific origin domains.';
- } else {
- msg = msg[0];
- }
-
- var result = window.confirm(msg);
+ var result = window.confirm(app.i18n.en_US['cors-disable-cors-prompt']);
if (!result) { return; }
}
@@ -306,15 +300,6 @@ define([
Actions.methodChange(httpMethod);
},
- getCorsNotice: function () {
- var msg = FauxtonAPI.getExtensions('cors:notice');
- if (_.isUndefined(msg[0])) {
- return 'Cross-Origin Resource Sharing (CORS) lets you connect to remote servers directly from the browser, so you can host browser-based apps on static pages and talk directly with CouchDB to load your data.';
- }
-
- return msg[0];
- },
-
render: function () {
var isVisible = _.all([this.state.corsEnabled, !this.state.isAllOrigins]);
var className = this.state.corsEnabled ? 'collapsing-container' : '';
@@ -322,7 +307,7 @@ define([
return (
<div className="cors-page">
<header id="cors-header">
- <p>{this.getCorsNotice()}</p>
+ <p>{app.i18n.en_US['cors-notice']}</p>
</header>
<form id="corsForm" onSubmit={this.save}>
http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/270183b3/i18n.json.default
----------------------------------------------------------------------
diff --git a/i18n.json.default b/i18n.json.default
index 13f08c9..2773f3f 100644
--- a/i18n.json.default
+++ b/i18n.json.default
@@ -8,6 +8,8 @@
"mango-descripton-index-editor": "Mango is an easy way to find documents on predefined indexes. <br/><br/>Create an Index to query it afterwards. The example in the editor shows how to create an index for the field '_id'. <br/><br/>The Indexes that you already created are listed on the right.",
"mango-additional-indexes-heading": "Your additional Indexes:",
"mango-indexeditor-title": "Mango",
- "couchdb-productname": "Apache CouchDB"
+ "couchdb-productname": "Apache CouchDB",
+ "cors-disable-cors-prompt": "Are you sure? Disabling CORS will overwrite your specific origin domains.",
+ "cors-notice": "Cross-Origin Resource Sharing (CORS) lets you connect to remote servers directly from the browser, so you can host browser-based apps on static pages and talk directly with CouchDB to load your data."
}
}