Skip to content

Instantly share code, notes, and snippets.

Roman Kutanov kutanov

Block or report user

Report or block kutanov

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View styles.css
body {
padding: 50px;
font: 14px "Lucida Grande", Helvetica, Arial, sans-serif;
}
a {
color: #00B7FF;
}
table {
View index.pug
extends layout
block content
h1 Welcome to #{title}
p Welcome #{t("home.title")}
p It's a translation article application
a(href='?lng=en') English <br>
a(href='?lng=ru') Russian
<br>
View app.js
app.use(
middleware.handle(i18next, {
ignoreRoutes: ["/foo"], // or function(req, res, options, i18next) { /* return true to ignore */ }
removeLngFromUrl: false
})
);
View index.pug
extends layout
block content
h1 Welcome to #{title}
p Welcome #{t("home.title")}
p It's a translation article application
a(href='?lng=en') English <br>
a(href='?lng=ru') Russian
@kutanov
kutanov / translation.json
Created Feb 15, 2020
locales/en/translation.json
View translation.json
{
"home": {
"title": "Book shop",
"total": "There are {{counter}} books in the list",
"buttonText": "Refresh button",
"buttonHTML": "<button onClick='window.location.reload();'>$t(buttonText)</button>",
}
}
@kutanov
kutanov / translation.json
Last active Feb 15, 2020
locales/ru/translation.json
View translation.json
{
"home": {
"title": "Книжный магазин",
"total": "Всего в списке {{counter}} книг",
"buttonText": "Обновить страницу",
"buttonHTML": "<button onClick='window.location.reload();'>$t(buttonText)</button>",
},
"Something for Nothing": "Кое что задаром",
"Harry Potter and the Philosopher's Stone": "Гарри Поттер и Философский камень"
}
View index.js
var express = require('express');
var router = express.Router();
const IndexContoller = require('../controllers/index_controller');
/* GET home page. */
router.get('/', IndexContoller.list);
module.exports = router;
View index.pug
extends layout
block content
h1 Welcome to #{title}
p It's a translation article application
View index_controller.js
var express = require('express');
var router = express.Router();
const i18next = require('i18next');
class IndexController {
static list(req, res, next) {
res.render('index', { title: 'Express'});
}
}
@kutanov
kutanov / app.js
Created Feb 15, 2020
app.js full
View app.js
var createError = require('http-errors');
var express = require('express');
var path = require('path');
var cookieParser = require('cookie-parser');
var logger = require('morgan');
var indexRouter = require('./routes/index');
var usersRouter = require('./routes/users');
var app = express();
You can’t perform that action at this time.