From 6d57d4d44a8e35948948ad5ac6983f712537e4c4 Mon Sep 17 00:00:00 2001 From: moss-bryophyta <261561981+moss-bryophyta@users.noreply.github.com> Date: Wed, 29 Apr 2026 08:04:00 -0700 Subject: [PATCH] fix(node): update strings guide for three translation approaches MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - description: "Two approaches" → "Three approaches" (tx() was added) - callout: "Both approaches" → clarify getGT() and msg()/getMessages() are build-time, tx() is runtime - fix msg() link: /docs/node/api/get-messages → /docs/node/api/strings/msg (correct page) --- docs/en-US/node/guides/strings.mdx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/en-US/node/guides/strings.mdx b/docs/en-US/node/guides/strings.mdx index 877797ae..bcf13fdf 100644 --- a/docs/en-US/node/guides/strings.mdx +++ b/docs/en-US/node/guides/strings.mdx @@ -1,6 +1,6 @@ --- title: String Translation Patterns -description: Two approaches to translating strings in Node.js — inline and pre-registered +description: Three approaches to translating strings in Node.js — inline, pre-registered, and on-demand --- There are three ways to translate strings in `gt-node`: @@ -38,7 +38,7 @@ gt('{city} weather: {temp}°F', { city: 'Tokyo', temp: 72 }); ## Pre-registered strings with `msg()` / `getMessages()` -Use [`msg()`](/docs/node/api/get-messages) to register strings at module scope — outside of any request handler. Then use [`getMessages()`](/docs/node/api/get-messages) inside handlers to resolve them for the current locale: +Use [`msg()`](/docs/node/api/strings/msg) to register strings at module scope — outside of any request handler. Then use [`getMessages()`](/docs/node/api/get-messages) inside handlers to resolve them for the current locale: ```js title="messages.js" import { msg } from 'gt-node'; @@ -96,7 +96,7 @@ app.post('/api/translate', async (req, res) => { | `tx()` | Dynamic or user-generated content not known at build time | - Both approaches produce identical translations. The difference is only in code organization — pick whichever fits your project structure. + `getGT()` and `msg()` / `getMessages()` both produce identical build-time translations. The difference is only in code organization — pick whichever fits your project structure. Use `tx()` only when the content is not known at build time. ## Using `$context` for disambiguation