i18n loopback client
This commit is contained in:
parent
1eb0fb9c8d
commit
0cf11ceff0
|
@ -11,6 +11,7 @@
|
||||||
"compression": "^1.0.3",
|
"compression": "^1.0.3",
|
||||||
"cors": "^2.5.2",
|
"cors": "^2.5.2",
|
||||||
"helmet": "^1.3.0",
|
"helmet": "^1.3.0",
|
||||||
|
"i18n": "^0.8.3",
|
||||||
"loopback": "^2.38.0",
|
"loopback": "^2.38.0",
|
||||||
"loopback-boot": "^2.6.5",
|
"loopback-boot": "^2.6.5",
|
||||||
"loopback-component-explorer": "^2.7.0",
|
"loopback-component-explorer": "^2.7.0",
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
{
|
||||||
|
"Hello": "Hello english"
|
||||||
|
}
|
|
@ -0,0 +1,3 @@
|
||||||
|
{
|
||||||
|
"Hello": "Hola español"
|
||||||
|
}
|
|
@ -5,6 +5,20 @@ var boot = require('loopback-boot');
|
||||||
|
|
||||||
var app = module.exports = loopback();
|
var app = module.exports = loopback();
|
||||||
|
|
||||||
|
/*i18n*/
|
||||||
|
var i18n = require("i18n");
|
||||||
|
i18n.configure({
|
||||||
|
directory: __dirname + '/i18n',
|
||||||
|
defaultLocale: "es"
|
||||||
|
});
|
||||||
|
|
||||||
|
/* Prueba i18n */
|
||||||
|
app.get('/prueba', function (req,res){
|
||||||
|
i18n.setLocale(req.get('Accept-Language').substring(0,2));
|
||||||
|
res.send(i18n.__("Hello"));
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
app.start = function() {
|
app.start = function() {
|
||||||
// start the web server
|
// start the web server
|
||||||
return app.listen(function() {
|
return app.listen(function() {
|
||||||
|
|
Loading…
Reference in New Issue