From 7fcbe99b4e571f95061d44c9a67c66b606a1f571 Mon Sep 17 00:00:00 2001 From: Alejandro Date: Fri, 20 Sep 2019 11:49:26 +0200 Subject: [PATCH] Translate errors --- controllers/web/applications.js | 2 +- controllers/web/organizations.js | 2 +- controllers/web/users.js | 2 +- etc/translations/en.json | 34 +++++++++++++++++++++++++++++--- etc/translations/es.json | 31 +++++++++++++++++++++++++++++ etc/translations/ja.json | 31 +++++++++++++++++++++++++++++ etc/translations/ko.json | 31 +++++++++++++++++++++++++++++ routes/oauth2/oauth2.js | 2 +- routes/saml2/saml2.js | 2 +- routes/web/homes.js | 2 +- routes/web/index.js | 2 +- routes/web/not_authenticate.js | 2 +- views/errors/generic.ejs | 2 +- views/errors/notFound.ejs | 8 -------- views/errors/not_found.ejs | 8 ++++++++ views/errors/oauth.ejs | 22 ++++++++++----------- views/errors/saml.ejs | 16 +++++++-------- 17 files changed, 160 insertions(+), 39 deletions(-) delete mode 100644 views/errors/notFound.ejs create mode 100644 views/errors/not_found.ejs diff --git a/controllers/web/applications.js b/controllers/web/applications.js index ce12c7bd..db2f1192 100755 --- a/controllers/web/applications.js +++ b/controllers/web/applications.js @@ -41,7 +41,7 @@ exports.load_application = function(req, res, next, application_id) { const err = new Error('Not Found'); err.status = 404; res.locals.error = err; - res.render('errors/notFound'); + res.render('errors/not_found'); } }) .catch(next); diff --git a/controllers/web/organizations.js b/controllers/web/organizations.js index ac30fdae..9f68b625 100755 --- a/controllers/web/organizations.js +++ b/controllers/web/organizations.js @@ -31,7 +31,7 @@ exports.load_organization = function(req, res, next, organization_id) { const err = new Error('Not Found'); err.status = 404; res.locals.error = err; - res.render('errors/notFound'); + res.render('errors/not_found'); } }) .catch(function(error) { diff --git a/controllers/web/users.js b/controllers/web/users.js index 057f848b..1c329c99 100755 --- a/controllers/web/users.js +++ b/controllers/web/users.js @@ -67,7 +67,7 @@ exports.load_user = function(req, res, next, user_id) { const err = new Error('Not Found'); err.status = 404; res.locals.error = err; - res.render('errors/notFound'); + res.render('errors/not_found'); } }) .catch(function(error) { diff --git a/etc/translations/en.json b/etc/translations/en.json index e3722c18..01abc22e 100755 --- a/etc/translations/en.json +++ b/etc/translations/en.json @@ -838,13 +838,11 @@ "authorize_btn": "Authorize" } }, - "modal": { "select": "Select your country", "next": "Next step", "close": "Close" }, - "countries": { "spain": "Spain", "slovenia": "Slovenia", @@ -852,7 +850,6 @@ "austria": "Austria", "portugal": "Portugal" }, - "saml2": { "label01": "Support Contact Person", "label02": "Name", @@ -923,5 +920,36 @@ "title": "eIDAS Authentication Details", "next_btn": "Next" } + }, + "errors": { + "saml": { + "title01": "ops! something went wrong!", + "content01": "contact with the administrators of", + "content02": "your web service provider", + "content03": "and send your", + "content04": "error details", + "title02": "Saml2 request has failed!", + "content05": "error", + "content06": "internal error" + }, + "oauth": { + "title01": "ops! something went wrong!", + "content01": "contact with the administrators of", + "content02": "your web service provider", + "content03": "and send your", + "content04": "error details", + "title02": "OAuth2 request has failed!", + "content05": "error", + "content06": "internal error", + "content07": "(required)" + }, + "not_found": { + "title01": "the page you have requested not exist", + "content01": "Go back to the", + "content02": "Homepage" + }, + "generic": { + "content01": "Code" + } } } diff --git a/etc/translations/es.json b/etc/translations/es.json index 845e97d4..4745c9b7 100755 --- a/etc/translations/es.json +++ b/etc/translations/es.json @@ -923,5 +923,36 @@ "title": "Detalles de autenticación para eIDAS", "next_btn": "Siguiente" } + }, + "errors": { + "saml": { + "title01": "¡ups, algo fue mal!", + "content01": "Contacta con el administrador de", + "content02": "tu proveedor de servicios web", + "content03": "y envia los", + "content04": "detalles de tu error", + "title02": "¡La petición Saml ha fallado!", + "content05": "error", + "content06": "error interno" + }, + "oauth": { + "title01": "¡ups, algo fue mal!", + "content01": "Contacta con el administrador de", + "content02": "tu proveedor de servicios web", + "content03": "y envia los", + "content04": "detalles de tu error", + "title02": "¡La petición OAuth ha fallado!", + "content05": "error", + "content06": "error interno", + "content07": "(obligatorio)" + }, + "not_found": { + "title01": "la página que has solicitado no existe", + "content01": "vuelve de nuevo a", + "content02": "la página de inicio" + }, + "generic": { + "content01": "Código" + } } } \ No newline at end of file diff --git a/etc/translations/ja.json b/etc/translations/ja.json index 870b472e..b2c00815 100755 --- a/etc/translations/ja.json +++ b/etc/translations/ja.json @@ -923,5 +923,36 @@ "title": "eIDAS 認証の詳細", "next_btn": "次へ" } + }, + "errors": { + "saml": { + "title01": "ops! something went wrong!", + "content01": "contact with the administrators of", + "content02": "your web service provider", + "content03": "and send your", + "content04": "error details", + "title02": "Saml2 request has failed!", + "content05": "error", + "content06": "internal error" + }, + "oauth": { + "title01": "ops! something went wrong!", + "content01": "contact with the administrators of", + "content02": "your web service provider", + "content03": "and send your", + "content04": "error details", + "title02": "OAuth2 request has failed!", + "content05": "error", + "content06": "internal error", + "content07": "(required)" + }, + "not_found": { + "title01": "the page you have requested not exist", + "content01": "Go back to the", + "content02": "Homepage" + }, + "generic": { + "content01": "Code" + } } } diff --git a/etc/translations/ko.json b/etc/translations/ko.json index a04bf89e..188d3b88 100644 --- a/etc/translations/ko.json +++ b/etc/translations/ko.json @@ -922,5 +922,36 @@ "title": "eIDAS Authentication Details", "next_btn": "Next" } + }, + "errors": { + "saml": { + "title01": "ops! something went wrong!", + "content01": "contact with the administrators of", + "content02": "your web service provider", + "content03": "and send your", + "content04": "error details", + "title02": "Saml2 request has failed!", + "content05": "error", + "content06": "internal error" + }, + "oauth": { + "title01": "ops! something went wrong!", + "content01": "contact with the administrators of", + "content02": "your web service provider", + "content03": "and send your", + "content04": "error details", + "title02": "OAuth2 request has failed!", + "content05": "error", + "content06": "internal error", + "content07": "(required)" + }, + "not_found": { + "title01": "the page you have requested not exist", + "content01": "Go back to the", + "content02": "Homepage" + }, + "generic": { + "content01": "Code" + } } } \ No newline at end of file diff --git a/routes/oauth2/oauth2.js b/routes/oauth2/oauth2.js index e08c00db..59dd44ce 100755 --- a/routes/oauth2/oauth2.js +++ b/routes/oauth2/oauth2.js @@ -56,7 +56,7 @@ router.use(function(req, res) { err.status = 404; if (req.useragent.isDesktop) { res.locals.error = err; - res.render('errors/notFound'); + res.render('errors/not_found'); } else { res.status(404).json(err.message); } diff --git a/routes/saml2/saml2.js b/routes/saml2/saml2.js index bebc8a89..0b6e9db4 100755 --- a/routes/saml2/saml2.js +++ b/routes/saml2/saml2.js @@ -22,7 +22,7 @@ router.use(function(req, res) { err.status = 404; if (req.useragent.isDesktop) { res.locals.error = err; - res.render('errors/notFound'); + res.render('errors/not_found'); } else { res.status(404).json(err.message); } diff --git a/routes/web/homes.js b/routes/web/homes.js index 9c96786f..ca1d6016 100755 --- a/routes/web/homes.js +++ b/routes/web/homes.js @@ -13,7 +13,7 @@ router.use(function(req, res) { const err = new Error('Not Found'); err.status = 404; res.locals.error = err; - res.render('errors/notFound'); + res.render('errors/not_found'); }); module.exports = router; diff --git a/routes/web/index.js b/routes/web/index.js index fbb05296..07e320c6 100755 --- a/routes/web/index.js +++ b/routes/web/index.js @@ -96,7 +96,7 @@ router.use(function(req, res) { const err = new Error('Not Found'); err.status = 404; res.locals.error = err; - res.render('errors/notFound'); + res.render('errors/not_found'); }); // Error handler diff --git a/routes/web/not_authenticate.js b/routes/web/not_authenticate.js index 2acdd35f..2824e92b 100755 --- a/routes/web/not_authenticate.js +++ b/routes/web/not_authenticate.js @@ -42,7 +42,7 @@ router.use(function(req, res) { const err = new Error('Not Found'); err.status = 404; res.locals.error = err; - res.render('errors/notFound'); + res.render('errors/not_found'); }); module.exports = router; diff --git a/views/errors/generic.ejs b/views/errors/generic.ejs index 6891f278..69869b20 100644 --- a/views/errors/generic.ejs +++ b/views/errors/generic.ejs @@ -1,6 +1,6 @@

<%= error.message %>

-

Code: <%= error.status %>

+

<%=translation.errors.generic.content01%>: <%= error.status %>

<% if (error.stack) { -%>
<%= error.stack %>
<% } -%> diff --git a/views/errors/notFound.ejs b/views/errors/notFound.ejs deleted file mode 100644 index 1593a817..00000000 --- a/views/errors/notFound.ejs +++ /dev/null @@ -1,8 +0,0 @@ -
-
-
-

the page you have requested not exist

-

Go back to the Homepage

-
-
- diff --git a/views/errors/not_found.ejs b/views/errors/not_found.ejs new file mode 100644 index 00000000..2bcd6c0e --- /dev/null +++ b/views/errors/not_found.ejs @@ -0,0 +1,8 @@ +
+
+
+

<%=translation.errors.not_found.title01%>

+

<%=translation.errors.not_found.content01%> <%=translation.errors.not_found.content02%>

+
+
+ diff --git a/views/errors/oauth.ejs b/views/errors/oauth.ejs index 99b4edf0..f4073047 100644 --- a/views/errors/oauth.ejs +++ b/views/errors/oauth.ejs @@ -1,30 +1,30 @@
-

ops! something went wrong!

-

contact with the administrators of +

<%=translation.errors.oauth.title01%>

+

<%=translation.errors.oauth.content01%> <% if (application) { -%> <%= application.name %> <% } else { -%> - your web service provider + <%=translation.errors.oauth.content02%> <% } -%> - and send your + <%=translation.errors.oauth.content03%>

-

OAuth2 request has failed!

-

error - +

<%=translation.errors.oauth.title02%>

+

<%=translation.errors.oauth.content05%> - <% if (error.message) { -%> <%= error.message %> <% } else { -%> - internal error + <%=translation.errors.oauth.content06%> <% } -%>

-
client_id (required)
+
client_id <%=translation.errors.oauth.content07%>
<% if (query.client_id) { -%> <%= query.client_id %> <% } else { -%> @@ -32,7 +32,7 @@ <% } -%>
-
response_type (required)
+
response_type <%=translation.errors.oauth.content07%>
<% if (query.response_type) { -%> <%= query.response_type %> <% } else { -%> @@ -40,7 +40,7 @@ <% } -%>
-
state (required)
+
state <%=translation.errors.oauth.content07%>
<% if (query.state) { -%> <%= query.state %> <% } else { -%> diff --git a/views/errors/saml.ejs b/views/errors/saml.ejs index 30b6b4b3..cab90ad8 100644 --- a/views/errors/saml.ejs +++ b/views/errors/saml.ejs @@ -1,24 +1,24 @@
-

ops! something went wrong!

-

contact with the administrators of +

<%=translation.errors.oauth.title01%>

+

<%=translation.errors.oauth.content01%> <% if (application) { -%> <%= application.name %> <% } else { -%> - your web service provider + <%=translation.errors.oauth.content02%> <% } -%> - and send your + <%=translation.errors.oauth.content03%>

-

Saml2 request has failed!

-

error - +

<%=translation.errors.oauth.title02%>

+

<%=translation.errors.oauth.content05%> - <% if (error.message) { -%> <%= error.message %> <% } else { -%> - internal error + <%=translation.errors.oauth.content06%> <% } -%>