Back

gt-node@0.6.0

Ernest McCarter avatarErnest McCarter
gt-noderuntime-translationtx

Overview

gt-node now has tx() — a function for translating strings at runtime. Pass any string to tx() and get back a translated version, no build step needed.

This unlocks server-side translation of dynamic content: user-generated text, database values, API responses, or anything that isn't known ahead of time.

Usage

Basic

import { tx } from 'gt-node';

const translated = await tx('Processing complete');

With variables

const translated = await tx('Hello, {name}!', { name: 'María' });

Specifying a locale

const status = await tx('Order shipped', { $locale: 'ja' });