FAQ
Is the extraction logic the same for English and Chinese source code?
Not exactly.
In English source code, many strings may be protocol values, type values, class names, paths, or internal identifiers. Not all English text should be translated. Therefore, English mode prioritizes user-visible UI text, notifications, object display fields, component display attributes, JSX/Vue text, etc.
In non-English source code, extraction from scripts and JSX/TSX is more open, but still skips styles, paths, regex, type declarations, processed $t(...), and other technical contexts.
Why are some default values not extracted?
Destructuring defaults and function parameter defaults usually represent data structure fallbacks, not necessarily user-visible text.
const { propertyName = 'User name' } = objectToDestruct
function submit(label = 'Save') {}These are skipped by default to avoid accidentally modifying interface adapters, utility functions, and type fallbacks. Fallback expressions actually used for display are extracted:
const text = data?.text || 'Default text'
const desc = data?.description ?? 'No description'How to temporarily skip a section of code?
Use ignore comments:
// @hias-i18n-ignore-next
message.success('Keep original')
/* @hias-i18n-ignore-start */
const a = 'Keep original'
const b = 'Keep original too'
/* @hias-i18n-ignore-end */Vue template:
<!-- @hias-i18n-ignore-next -->
<div>保持原文</div>Ignore entire file:
// @hias-i18n-ignore-fileWhy shouldn't Chinese in image paths be translated?
Resource paths are file references, not user-visible text.
<img src="@/assets/images/ssHome/供应商总数量.png" alt="供应商总数量" />The src should remain unchanged, while alt can be translated:
<img src="@/assets/images/ssHome/供应商总数量.png" :alt="$t('vue3All.total_number_of_suppliers')" />Why aren't parentheses included in translation keys?
When Chinese is combined with expressions, punctuation usually belongs to page structure, not the text itself.
Recommended:
<h1>{{ $t('vue3All.leave_a_message') }}({{ remarkList ? remarkList.length : 0 }})</h1>Locale file:
{
"leave_a_message": "留言"
}This way different languages can maintain text independently, and the quantity structure in the page is clearer.
Should long sentences be split into multiple keys?
Generally not recommended. Natural language paragraphs should be processed as complete sentences or complete paragraphs.
Not recommended:
<div>
{t('part_one')},{t('part_two')},{t('part_three')}
</div>Recommended:
<div>{t('jsxAll.river_story')}</div>Machine translation and human proofreading are easier to handle with complete semantics.
How to choose between Login and login?
Short text like buttons, menus, status, and table column names usually use title case, e.g., Login, Normal Status.
Long sentences, prompts, and description text usually use sentence case, e.g., Please enter your username.
Other languages may not have English-like capitalization rules, so it's recommended to limit capitalization strategies to English target languages, and prioritize human translations for multilingual glossaries.
Should Chinese in regex be translated?
Usually not.
const regex = /中文|English/giuRegex is program matching logic; translation may change business logic.
English mode also skips regex.
How to check for missing keys in locale files?
Run:
hias tcheck src --report .hias\reports\tcheck.jsonIt checks for missing keys, unused keys, inconsistent keys across locale JSON files, and unparseable JSON files.