Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Yesglot Node.js Example

This project is a tiny Express + i18next example that shows how a Node.js app can keep its copy in JSON locale files and let Yesglot manage translation updates through Git.

The app itself is intentionally small:

  • one JSON API endpoint: GET /api/holiday-check
  • one minimal HTML page: GET /
  • locale files in locales/<language>/translation.json
  • holiday data from the public Nager.Date API
  • styling built with Tailwind CSS and daisyUI

What the example demonstrates

  • server-side localization in a Node.js app
  • a language switcher for the UI
  • browser-based "today" detection
  • country selection that is separate from the UI language
  • localized API responses for titles, labels, status text, and countdown strings

That separation is the main localization point:

  • the UI can be French
  • the selected holiday country can be Japan
  • the holiday name can still come from the upstream holiday source

How to run it

Prerequisites

  • Node.js 20+
  • npm

Install dependencies

npm install

Start the dev server

npm run dev

If you are editing the daisyUI/Tailwind styles, run this in a second terminal:

npm run dev:css

Open:

http://localhost:4321

Run tests

npm test

API shape

Example request:

GET /api/holiday-check?country=NL&date=2026-12-25&lang=fr

Example response:

{
  "requested": {
    "country": "NL",
    "date": "2026-12-25",
    "language": "fr"
  },
  "country": {
    "code": "NL",
    "name": "Pays-Bas"
  },
  "selectedDate": {
    "iso": "2026-12-25",
    "display": "25 décembre 2026"
  },
  "isHoliday": true,
  "status": {
    "kind": "holiday",
    "badge": "Férié",
    "title": "Aujourd’hui est un jour férié",
    "body": "Noël figure au calendrier en Pays-Bas aujourd’hui."
  }
}

Project structure

src/
  config.js
  holiday-service.js
  i18n.js
  render-page.js
  server.js
  styles.css
public/
  app.js
  output.css
locales/
  en/translation.json
  fr/translation.json
  de/translation.json
  nl/translation.json
  tr/translation.json
yesglot.toml

Yesglot integration

This repo stores all app copy in regular JSON files under locales/. That means the workflow is straightforward:

  1. Update the English source file: locales/en/translation.json
  2. Commit and push your change
  3. Let Yesglot open a PR with translated updates
  4. Review the PR and merge it

The included yesglot.toml points at the source and target locale files so the repo is ready to use as a Yesglot example.

About

An example setup of Yesglot on a Node/Express.js project

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages