Function: useValaxyI18n()
function useValaxyI18n(): object;Defined in: packages/valaxy/client/composables/locale.ts:84
Experimental
以 $locale: 开头的 key 会被认为是国际化的 key 会从 locales/ 目录中获取对应的翻译
Returns
$t
$t: (key) => string;vue-i18n t function
translate $locale:key
Parameters
key
string
Returns
string
$tCategory
$tCategory: (key) => string;translate category name (auto-lookup category.{key} in locale files)
Parameters
key
string
Returns
string
$tO
$tO: <T>(data?) => string | T;translate object
{ "zh-CN": "你好", "en": "Hello" }
Type Parameters
T
T = string
Parameters
data?
string | Record<string, T>
Returns
string | T
$tTag
$tTag: (key) => string;translate tag name (auto-lookup tag.{key} in locale files)
Parameters
key
string
Returns
string
$tTerm
$tTerm: (namespace, key) => string;translate taxonomy term (auto-lookup {namespace}.{key} in locale files)
Parameters
namespace
key
string
Returns
string
En
Translate a taxonomy term.
Resolution order:
$locale:prefix → strip and translate viat()- Locale key
{namespace}.{key}exists → translate viat() - Fallback → return the original key as-is
The result is cached by locale + namespace + key to avoid repeated te() / t() lookups in tag clouds and category trees.
Zh
翻译 taxonomy 术语。
解析顺序:
$locale:前缀 → 去掉前缀后通过t()翻译- locale 中存在
{namespace}.{key}→ 通过t()翻译 - 兜底 → 原样返回
结果会按 locale + namespace + key 做轻量缓存, 避免标签云和分类树中重复执行 te() / t()。
locale
locale: WritableComputedRef<string, string>;