Skip to content

Instantly share code, notes, and snippets.

View kutanov's full-sized avatar

Roman Kutanov kutanov

View GitHub Profile
import { HttpClient } from '@angular/common/http';
import {
TRANSLOCO_LOADER,
Translation,
TranslocoLoader,
TRANSLOCO_CONFIG,
translocoConfig,
TranslocoModule
} from '@ngneat/transloco';
import { Injectable, NgModule } from '@angular/core';
@kutanov
kutanov / index.pug
Last active February 15, 2020 03:41
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 / styles.css
Last active February 15, 2020 03:39
body {
padding: 50px;
font: 14px "Lucida Grande", Helvetica, Arial, sans-serif;
}
a {
color: #00B7FF;
}
table {
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>
app.use(
middleware.handle(i18next, {
ignoreRoutes: ["/foo"], // or function(req, res, options, i18next) { /* return true to ignore */ }
removeLngFromUrl: false
})
);
@kutanov
kutanov / translation.json
Created February 15, 2020 03:18
locales/en/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 February 15, 2020 03:15
locales/ru/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": "Гарри Поттер и Философский камень"
}
var express = require('express');
var router = express.Router();
const IndexContoller = require('../controllers/index_controller');
/* GET home page. */
router.get('/', IndexContoller.list);
module.exports = router;
@kutanov
kutanov / index.pug
Created February 15, 2020 01:36
pug
extends layout
block content
h1 Welcome to #{title}
p It's a translation article application
var express = require('express');
var router = express.Router();
const i18next = require('i18next');
class IndexController {
static list(req, res, next) {
res.render('index', { title: 'Express'});
}
}