Skip to content

Commit

Permalink
home controller language support
Browse files Browse the repository at this point in the history
  • Loading branch information
luiseduardobrito committed Sep 25, 2013
1 parent 427bdb5 commit 8b1e641
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 5 deletions.
13 changes: 9 additions & 4 deletions api/controllers/home.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,32 @@ var response = require("../adapters/response");
var model = require("../adapters/model");
var policy = require("../policies/");

var lang = require("../../language").getDefault();

module.exports = {

index: function(req, res) {

response(res).view("home/index", {
title: "node-web-cluster",
message: "Welcome to the index page!"
title: lang.home.title,
message: lang.home.message
});
},

login: function(req, res) {

response(res).view("home/login", {
title: "node-web-cluster",
title: lang.home.title,
message: lang.home.message,
destination: req.param("destination") || "dashboard"
});
},

signup: function(req, res) {

response(res).view("home/signup", {
title: "node-web-cluster",
title: lang.home.title,
message: lang.home.message,
destination: req.param("destination") || "dashboard"
});
},
Expand All @@ -46,6 +50,7 @@ module.exports = {
response(res).view("home/dashboard", {

title: "node-web-cluster",
message: lang.home.message,
user: u
});

Expand Down
6 changes: 6 additions & 0 deletions language/en-US.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,12 @@ module.exports = {
query_error: "Problem querying database"
},

home: {

title: "Node Web Cluster",
message: "Welcome to the index page!"
},

user: {

email_registered: "Email already registered",
Expand Down
8 changes: 8 additions & 0 deletions language/pt-BR.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,14 @@ module.exports = {
query_error: "Erro ao conectar ao banco de dados"
},

// controllers

home: {

title: "Node Web Cluster",
message: "Bem vindo a pagina inicial do projeto!"
},

user: {

email_registered: "Email já registrado no sistema",
Expand Down
2 changes: 1 addition & 1 deletion views/home/index.ejs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<!DOCTYPE html>

Welcome!
<%= message %>

<br />
<br /><a href="signup">Sign-up</a> | <a href="login">Login</a> | <a data-on="click" data-event="app/destroy" data-pub='{"msg": "app destroyed by user"}'> Destroy </a>

0 comments on commit 8b1e641

Please sign in to comment.