Skip to content

Commit

Permalink
Translate errors
Browse files Browse the repository at this point in the history
  • Loading branch information
apozohue10 committed Sep 20, 2019
1 parent 876cf82 commit 7fcbe99
Show file tree
Hide file tree
Showing 17 changed files with 160 additions and 39 deletions.
2 changes: 1 addition & 1 deletion controllers/web/applications.js
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion controllers/web/organizations.js
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion controllers/web/users.js
Expand Up @@ -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) {
Expand Down
34 changes: 31 additions & 3 deletions etc/translations/en.json
Expand Up @@ -838,21 +838,18 @@
"authorize_btn": "Authorize"
}
},

"modal": {
"select": "Select your country",
"next": "Next step",
"close": "Close"
},

"countries": {
"spain": "Spain",
"slovenia": "Slovenia",
"italy": "Italy",
"austria": "Austria",
"portugal": "Portugal"
},

"saml2": {
"label01": "Support Contact Person",
"label02": "Name",
Expand Down Expand Up @@ -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"
}
}
}
31 changes: 31 additions & 0 deletions etc/translations/es.json
Expand Up @@ -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"
}
}
}
31 changes: 31 additions & 0 deletions etc/translations/ja.json
Expand Up @@ -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"
}
}
}
31 changes: 31 additions & 0 deletions etc/translations/ko.json
Expand Up @@ -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"
}
}
}
2 changes: 1 addition & 1 deletion routes/oauth2/oauth2.js
Expand Up @@ -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);
}
Expand Down
2 changes: 1 addition & 1 deletion routes/saml2/saml2.js
Expand Up @@ -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);
}
Expand Down
2 changes: 1 addition & 1 deletion routes/web/homes.js
Expand Up @@ -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;
2 changes: 1 addition & 1 deletion routes/web/index.js
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion routes/web/not_authenticate.js
Expand Up @@ -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;
2 changes: 1 addition & 1 deletion views/errors/generic.ejs
@@ -1,6 +1,6 @@
<div class="error">
<h1><%= error.message %></h1>
<p>Code: <%= error.status %></p>
<p><%=translation.errors.generic.content01%>: <%= error.status %></p>
<% if (error.stack) { -%>
<pre><%= error.stack %></pre>
<% } -%>
Expand Down
8 changes: 0 additions & 8 deletions views/errors/notFound.ejs

This file was deleted.

8 changes: 8 additions & 0 deletions views/errors/not_found.ejs
@@ -0,0 +1,8 @@
<div class="error">
<div class="error-404">
<div class="image"></div>
<h1><%=translation.errors.not_found.title01%></h1>
<p><%=translation.errors.not_found.content01%> <a href='/idm'><%=translation.errors.not_found.content02%></a></p>
</div>
</div>

22 changes: 11 additions & 11 deletions views/errors/oauth.ejs
@@ -1,46 +1,46 @@
<div class="error">
<h1>ops! something went wrong!</h1>
<p>contact with the administrators of
<h1><%=translation.errors.oauth.title01%></h1>
<p><%=translation.errors.oauth.content01%>
<% if (application) { -%>
<a href="<%= application.url%>"> <%= application.name %></a>
<% } else { -%>
your web service provider
<%=translation.errors.oauth.content02%>
<% } -%>
and send your
<%=translation.errors.oauth.content03%>
<a data-toggle="collapse" href="#error_oauth" aria-expanded="true" aria-controls="error_oauth" class="collapsed">
error details <i class="fa fa-angle-up"></i>
<%=translation.errors.oauth.content04%> <i class="fa fa-angle-up"></i>
</a>
</p>
<div class="collapse_out">
<div id="error_oauth" class="form-group collapse" role="tabpanel">
<div class="error-oauth">
<h2>OAuth2 request has failed!</h2>
<p><b>error - </b>
<h2><%=translation.errors.oauth.title02%></h2>
<p><b><%=translation.errors.oauth.content05%> - </b>
<% if (error.message) { -%>
<%= error.message %>
<% } else { -%>
internal error
<%=translation.errors.oauth.content06%>
<% } -%>
</p>
<div id="request_parameters" class="collapse_out">
<div>
<div class="panel-heading">client_id (required)</div>
<div class="panel-heading">client_id <%=translation.errors.oauth.content07%></div>
<% if (query.client_id) { -%>
<%= query.client_id %>
<% } else { -%>
undefined
<% } -%>
</div>
<div>
<div class="panel-heading">response_type (required)</div>
<div class="panel-heading">response_type <%=translation.errors.oauth.content07%></div>
<% if (query.response_type) { -%>
<%= query.response_type %>
<% } else { -%>
undefined
<% } -%>
</div>
<div>
<div class="panel-heading">state (required)</div>
<div class="panel-heading">state <%=translation.errors.oauth.content07%></div>
<% if (query.state) { -%>
<%= query.state %>
<% } else { -%>
Expand Down
16 changes: 8 additions & 8 deletions views/errors/saml.ejs
@@ -1,24 +1,24 @@
<div class="error">
<h1>ops! something went wrong!</h1>
<p>contact with the administrators of
<h1><%=translation.errors.oauth.title01%></h1>
<p><%=translation.errors.oauth.content01%>
<% if (application) { -%>
<a href="<%= application.url%>"> <%= application.name %></a>
<% } else { -%>
your web service provider
<%=translation.errors.oauth.content02%>
<% } -%>
and send your
<%=translation.errors.oauth.content03%>
<a data-toggle="collapse" href="#error_saml" aria-expanded="true" aria-controls="error_saml" class="collapsed">
error details <i class="fa fa-angle-up"></i>
<%=translation.errors.oauth.content04%> <i class="fa fa-angle-up"></i>
</a>
</p>
<div class="collapse_out">
<div id="error_saml" class="form-group collapse" role="tabpanel">
<h2>Saml2 request has failed!</h2>
<p><b>error - </b>
<h2><%=translation.errors.oauth.title02%></h2>
<p><b><%=translation.errors.oauth.content05%> - </b>
<% if (error.message) { -%>
<%= error.message %>
<% } else { -%>
internal error
<%=translation.errors.oauth.content06%>
<% } -%>
</p>
</div>
Expand Down

0 comments on commit 7fcbe99

Please sign in to comment.