返回

gt-node@0.6.0

Ernest McCarter avatarErnest McCarter
gt-noderuntime-translationtx

概述

gt-node 现在提供了 tx()——一个可在 runtime 翻译字符串的函数。将任意字符串传给 tx(),即可获得翻译后的版本,无需 build 步骤。

这让你能够在服务器端翻译动态内容:用户生成的文本、数据库中的值、API 响应,或任何无法预先确定的内容。

用法

基本用法

import { tx } from 'gt-node';

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

使用变量

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

指定区域设置

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

链接