Skip to content

Instantly share code, notes, and snippets.

Avatar

Marcus Spiegel mashpie

View GitHub Profile
View machine.js
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@mashpie
mashpie / i18n-express4-cookie-example.js
Last active Aug 30, 2019
i18n-express4-cookie-example
View i18n-express4-cookie-example.js
@mashpie
mashpie / i18n-restify-app.js
Created Jun 2, 2013
i18n-node in an restify app setup
View i18n-restify-app.js
// require modules
var restify = require('restify'),
i18n = require('i18n'),
app;
// minimal config
i18n.configure({
locales: ['en', 'de'],
directory: __dirname + '/locales'
});
@mashpie
mashpie / i18n-express-mustache-app.js
Last active Sep 26, 2018
express + i18n-node + mustache (via consolidate.js) and avoid concurrency issues
View i18n-express-mustache-app.js
// require modules
var express = require('express'),
i18n = require('../../i18n'),
url = require('url'),
cons = require('consolidate'),
app = module.exports = express();
// minimal config
i18n.configure({
locales: ['en', 'de'],
@mashpie
mashpie / i18n-express-hbs-app.js
Last active Jun 18, 2021
express + i18n-node + handlebars and avoid concurrency issues
View i18n-express-hbs-app.js
// require modules
var express = require('express'),
i18n = require('i18n'),
hbs = require('hbs'),
app = module.exports = express();
i18n.configure({
locales: ['en', 'fr'],
cookie: 'locale',
directory: "" + __dirname + "/locales"
@mashpie
mashpie / i18n-node-http.js
Last active May 3, 2021
basic plain vanilla setup in node with http
View i18n-node-http.js
// require modules
var http = require('http'),
i18n = require('i18n'),
app;
// minimal config
i18n.configure({
locales: ['en', 'de'],
directory: __dirname + '/locales'
});
@mashpie
mashpie / i18n-express-cookie-app.js
Last active Sep 13, 2017
express + i18n-node + cookieParser and avoid concurrency issues
View i18n-express-cookie-app.js