Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 1,000,000+ packages pre-installed, including @freddieridell/glot with all npm packages installed. Try it out:

var glot = require("@freddieridell/glot")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

@freddieridell/glot v0.0.8

a tiny, simple, powerful, expressive, i18n library


min badge minzipped badge

A tiny, simple, powerful, expressive, i18n library


import createGlot from "@freddieridell/glot";
import { format as formatDate } from "date-fns/fp";

//initalise with dictionary
const glot = createGlot({
    en: {
        greetings: "'ello, govna'",
        date: "yyyy-MM-dd",
        thing_1: "number one",
        thing_2: "number two",
    fra: {
        greetings: "'sup, Monsieur",
})({ lang: "en" });

//basic usage

//switch language
console.log(glot({ lang: "fra" })`greetings`);
const foreverFrench = glot({ lang: "fra" });

//create parameterized functions
const localisedDteFormatter = glot({ mkFn: formatDate })`date`;
console.log(localisedDteFormatter(new Date()));

// interpolate values
new Array(2).fill(null).map((_, i) => console.log(glot`thing_${i + 1}`));


  • [ ] create companion react component
  • [ ] think about pluralisation
  • [ ] types
    • [ ] reasonml
    • [ ] flow
    • [ ] typescript
  • [x] tune babel config to reduce bundle size
  • [x] write tests, full coverage
  • [x] write better readme
  • [x] write better readme
RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free