fhir-ig-translation

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Translating a FHIR Implementation Guide

翻译FHIR实施指南

Experimental. This skill has not been verified against a real task since its last change. Verify its output before relying on it.
Produces the translation supplements of an IG-Publisher-based guide and puts them exactly where the publisher looks for them. The guide's own configuration decides which language is the source and which are the translations — this skill reads that rather than assuming it.
实验性技能。本技能自上次修改后尚未通过真实任务验证。在依赖其输出之前,请先验证结果。
生成基于IG-Publisher的指南所需的翻译补充包,并将其精准放置在Publisher查找的位置。指南自身的配置会决定源语言和目标语言——本技能会读取该配置而非自行假设。

Preconditions

前置条件

  1. Locate the guide. From the working directory, expect
    input/pagecontent/
    together with a
    sushi-config.yaml
    or an
    ig.ini
    .
    scripts/ig-translate.sh
    checks this itself and exits 2 with a message if the directory is not an IG project — it deliberately does not report "nothing to translate", which is what a silent failure here looks like.
  2. Derive the language pair — never assume it. Read the guide's own
    sushi-config.yaml
    :
    yaml
    parameters:
      i18n-default-lang: en        # the SOURCE language
      i18n-lang:
        - de                       # the TARGET language(s)
      translation-sources:
        - input/translations/de
    • i18n-default-lang
      is the source: the language
      input/pagecontent/
      is written in, and the authoritative text.
    • each
      i18n-lang
      entry is a target: a language that gets a rendering under
      /<lang>/
      .
    • If
      i18n-default-lang
      is absent, the publisher's default applies and the source language is not declared. Report that and ask rather than guessing — a guess here puts every file in the wrong place.
    • If no
      i18n-lang
      is configured, there is no target language yet. Adding one is a change to the guide's configuration and a decision for its maintainer, not for this skill.
    This is the step that must not be skipped. The MII reversed its own default from German to English once; a skill that had hard-coded the old direction would have placed every file wrongly while reporting success.
  3. Build first. Resource supplements need generated resources: the publisher writes
    fsh-generated/resources/
    and generates supplement templates per resource on each build. Translating before a green build means inventing
    msgid
    values, which is fabrication.
  4. Check whether this is the guide's problem or the template's. Language support is usually split between an IG and the template package it renders with, and the split is about responsibility, not paths:
    • This skill covers the guide's own content: supplements and translated pages under
      input/translations/<lang>/
      .
    • A template package owns the language mechanism and policy — language-neutral header/footer/CSS, inherited UI-string catalogues, and the choice of default language.
    For the MII KDS module template that template package is https://github.com/forschungsgruppe-digital-health/ig-template-mii-kds, which carries its own skill for those obligations. If the task is "keep the template's overrides language-neutral", that is the template's problem, not this one.
  1. 定位指南目录。从工作目录出发,需存在
    input/pagecontent/
    目录,以及
    sushi-config.yaml
    ig.ini
    文件。
    scripts/ig-translate.sh
    会自行检查该条件,若当前目录不是IG项目则会以退出码2终止并给出提示——它不会刻意报告“无内容可翻译”,这是静默失败的表现。
  2. 推导语言对——绝不自行假设。读取指南自身的
    sushi-config.yaml
    文件:
    yaml
    parameters:
      i18n-default-lang: en        # 源语言
      i18n-lang:
        - de                       # 目标语言
      translation-sources:
        - input/translations/de
    • i18n-default-lang
      源语言
      input/pagecontent/
      目录下内容所使用的语言,也是权威文本语言。
    • 每个
      i18n-lang
      条目为目标语言:会在
      /<lang>/
      路径下生成对应语言的版本。
    • i18n-default-lang
      缺失,则使用Publisher的默认设置,且源语言未声明。此时需报告该情况并询问用户,而非自行猜测——错误的猜测会导致所有文件存放位置错误。
    • 若未配置
      i18n-lang
      ,则当前无目标语言。添加目标语言属于指南配置变更,需由指南维护者决定,而非本技能处理。
    此步骤不可跳过。MII曾将自身默认语言从德语改为英语;若技能硬编码旧的语言方向,会导致所有文件存放错误却仍报告成功。
  3. 先完成构建。资源补充包需要已生成的资源:Publisher会生成
    fsh-generated/resources/
    目录,并在每次构建时为每个资源生成补充包模板。在构建成功前进行翻译意味着自行编造
    msgid
    值,这属于伪造内容。
  4. 区分问题归属:指南还是模板。语言支持通常分为IG指南和其使用的模板包两部分,区分依据是责任范围而非路径:
    • 本技能负责指南自身内容:
      input/translations/<lang>/
      下的补充包和翻译页面。
    • 模板包负责语言机制和策略:与语言无关的页眉/页脚/CSS、继承的UI字符串目录,以及默认语言的选择。
    针对MII KDS模块模板,对应的模板包为https://github.com/forschungsgruppe-digital-health/ig-template-mii-kds,该包有专门的技能处理相关职责。若任务为“保持模板的覆盖内容与语言无关”,则属于模板包的问题,而非本技能的处理范围。

Procedure

操作步骤

Output language: the target language derived in Preconditions 2. These instructions are English; what this skill produces is prose in the target language. Neither follows from the other, so it is stated. The examples below use
de
as the target because that is the common case here; substitute the language you actually derived.
Resolve the script path first. The commands below name the tool relative to this skill's own directory, not to your working directory — which is the project you are operating on. Set
SKILL_DIR
to the directory containing this
SKILL.md
(you just read it, so you know where it is) and use it in every invocation:
bash
SKILL_DIR=<the directory containing this SKILL.md>   # e.g. .claude/skills/fhir-ig-translation
Running a bare
scripts/...
from the project root does not merely fail — if the project happens to have its own
scripts/
directory with a same-named file, it silently runs that instead.
  1. Scan to get the target path for every page and resource:
    bash
    bash "$SKILL_DIR/scripts/ig-translate.sh" --scan <lang>              # cwd = the guide's root
    bash "$SKILL_DIR/scripts/ig-translate.sh" --scan <lang> path/to/ig   # or point at it
    The language argument is required — the script refuses to default it, so no run can silently translate into a language nobody chose.
  2. Resource supplements. One file per StructureDefinition, CodeSystem or Questionnaire at
    input/translations/<lang>/<Type>-<id>.po
    , where
    msgid
    is the exact source text from
    fsh-generated/resources/<Type>-<id>.json
    and
    msgstr
    is the translation. Copy the publisher's generated template rather than hand-writing the
    msgid
    .
  3. Narrative pages. One translation per page at
    input/translations/<lang>/pagecontent/<same-filename>.md
    — the same file name, the same structure, the same links, FHIR identifiers unchanged. Never a
    <name>-<lang>.md
    sibling in
    input/pagecontent/
    : the toolchain renders that as a separate page, not as a translation.
  4. Menu, if the guide has one:
    input/translations/<lang>/includes/menu.xml
    , mirroring
    input/includes/menu.xml
    . A
    menu:
    property in
    sushi-config.yaml
    generates one untranslatable menu and competes with this — it must not be used alongside.
  5. The IG-level catalogue
    input/translations/<lang>/ImplementationGuide-<ig-id>.po
    . Not a resource supplement and not optional: without it the
    pages:
    -tree page titles stay in the default language, so
    /<lang>/
    renders localized page bodies under default-language breadcrumbs.
    <ig-id>
    is the
    id
    of
    fsh-generated/resources/ImplementationGuide-<id>.json
    ; build the unit set from that file's
    definition.page
    tree — the authoritative page set — using
    input/includes/menu.xml
    only as a wording seed, and emit an empty
    msgstr
    plus a review flag for every title left untranslated.
    The sibling
    mii-ig-migration
    skill bundles a generator for exactly this file. It is a precondition, not an assumption: a consumer may have installed this skill alone, in which case the sibling path does not exist. Check first, and when it is absent either install it with the pinned command below or write the units by hand — never proceed on a path that does not resolve. Invoke it through a resolved
    $SKILL_DIR
    , never a bare
    scripts/…
    , which the project's own
    scripts/
    would shadow:
    bash
    GEN="$SKILL_DIR/../mii-ig-migration/scripts/gen-page-title-po.py"
    if [ -f "$GEN" ]; then python3 "$GEN" --help; else
      echo "gen-page-title-po.py not installed — install the sibling skill, or write the units by hand:"
      echo 'npx skills add "https://github.com/forschungsgruppe-digital-health/agent-skills/tree/v0.12.0" --skill mii-ig-migration --agent claude-code codex --yes'
    fi
    The
    /tree/<ref>
    form is what pins;
    owner/repo@<ref>
    does not — in that CLI
    @
    introduces a skill name and the command silently installs from the default branch.
    Read that script's header before regenerating an existing catalogue: the same file also carries hand-added units (the guide's
    title
    , per-artifact names) that the generator does not own, and its header states how it treats them.
  6. Validate, then build:
    bash
    bash "$SKILL_DIR/scripts/ig-translate.sh" --validate <lang>
    Findings (
    [WARN]
    ) exit 1; a run that finds nothing to validate says so explicitly and exits 0 — add
    --strict
    to make an empty translation set fail too, which is the right wiring for CI.
  7. Bilingual human review is mandatory before the translated rendering is trusted. Mark every machine translation
    TODO:REVIEW
    until a human has signed it off.
输出语言:前置条件2中推导的目标语言。以下说明使用英文,但本技能生成的内容为目标语言的文本。两者相互独立,特此说明。下方示例使用
de
作为目标语言(这是常见场景),请替换为实际推导的语言。
先确定脚本路径。下方命令中的工具路径是相对于本技能自身目录,而非你的工作目录(即你正在操作的项目目录)。设置
SKILL_DIR
为包含此
SKILL.md
的目录(你正在阅读该文件,所以知道其位置),并在每次调用时使用该变量:
bash
SKILL_DIR=<包含此SKILL.md的目录>   # 示例:.claude/skills/fhir-ig-translation
若直接从项目根目录运行
scripts/...
,不仅会失败——如果项目恰好有自己的
scripts/
目录且包含同名文件,会静默运行项目自身的脚本,而非本技能的脚本。
  1. 扫描以获取每个页面和资源的目标路径:
    bash
    bash "$SKILL_DIR/scripts/ig-translate.sh" --scan <lang>              # 当前工作目录 = 指南根目录
    bash "$SKILL_DIR/scripts/ig-translate.sh" --scan <lang> path/to/ig   # 或直接指定指南路径
    语言参数为必填项——脚本拒绝使用默认值,因此不会出现静默翻译为无人选择的语言的情况。
  2. 资源补充包。每个StructureDefinition、CodeSystem或Questionnaire对应一个文件,路径为
    input/translations/<lang>/<Type>-<id>.po
    ,其中
    msgid
    fsh-generated/resources/<Type>-<id>.json
    中的精确源文本
    msgstr
    为翻译内容。请复制Publisher生成的模板,而非手动编写
    msgid
  3. 叙述性页面。每个页面对应一个翻译文件,路径为
    input/translations/<lang>/pagecontent/<相同文件名>.md
    ——文件名、结构、链接保持一致,FHIR标识符不做修改。绝对不要
    input/pagecontent/
    目录下创建
    <name>-<lang>.md
    同级文件:工具链会将其渲染为独立页面,而非翻译版本。
  4. 菜单(若指南有菜单):
    input/translations/<lang>/includes/menu.xml
    ,与
    input/includes/menu.xml
    结构一致。若
    sushi-config.yaml
    中有
    menu:
    属性,会生成一个不可翻译的菜单并与此方式冲突——请勿同时使用。
  5. IG级目录文件
    input/translations/<lang>/ImplementationGuide-<ig-id>.po
    。这不是资源补充包,且为必填项:若无此文件,
    pages:
    树的页面标题会保持默认语言,导致
    /<lang>/
    路径下显示本地化的页面内容,但面包屑仍为默认语言。
    <ig-id>
    fsh-generated/resources/ImplementationGuide-<id>.json
    中的
    id
    ;需从该文件的
    definition.page
    树(权威页面集合)构建单元集——仅将
    input/includes/menu.xml
    作为措辞参考,并为每个未翻译的标题生成**空
    msgstr
    **及审核标记。
    同级的
    mii-ig-migration
    技能包含此文件的生成器。这是一个前置条件而非假设:用户可能仅安装了本技能,此时同级路径不存在该生成器。请先检查,若不存在则使用下方固定命令安装该技能,或手动编写单元集——绝对不要在路径不存在的情况下继续操作。请通过已解析的
    $SKILL_DIR
    调用,而非直接使用
    scripts/…
    ,否则会被项目自身的
    scripts/
    目录覆盖:
    bash
    GEN="$SKILL_DIR/../mii-ig-migration/scripts/gen-page-title-po.py"
    if [ -f "$GEN" ]; then python3 "$GEN" --help; else
      echo "gen-page-title-po.py未安装——请安装同级技能,或手动编写单元集:"
      echo 'npx skills add "https://github.com/forschungsgruppe-digital-health/agent-skills/tree/v0.12.0" --skill mii-ig-migration --agent claude-code codex --yes'
    fi
    /tree/<ref>
    格式用于固定版本;
    owner/repo@<ref>
    无法固定版本——在该CLI中
    @
    用于指定技能名称,命令会静默从默认分支安装。
    在重新生成现有目录文件前,请阅读该脚本的头部说明:同一文件还包含手动添加的单元(指南的
    title
    、每个制品的名称),生成器不会覆盖这些内容,脚本头部说明了其处理方式。
  6. 验证并构建
    bash
    bash "$SKILL_DIR/scripts/ig-translate.sh" --validate <lang>
    检测到问题(
    [WARN]
    )会以退出码1终止;若检测到“无内容可验证”会明确提示并以退出码0终止——添加
    --strict
    参数可使空翻译集也触发失败,这是CI环境的正确配置。
  7. 双语人工审核为强制要求,在信任翻译版本前必须执行。将所有机器翻译内容标记为
    TODO:REVIEW
    ,直至人工确认通过。

Harvest mode — adopting an existing rendering

提取模式——采用现有翻译版本

When a rendering in the target language already exists somewhere, harvest it instead of re-translating:
  1. Fill in
    references/harvest-config.yaml
    : the source of the target-language text (a parallel rendered guide for narrative; FSH
    translation
    extensions or
    designation
    s for resource texts) and the page/artefact mapping.
  2. Resources: move the existing designations or translation extensions into
    input/translations/<lang>/<Type>-<id>.po
    . The page titles of the existing rendering are a translation seed for the IG-level catalogue (step 5), not a substitute for it.
  3. Narrative: copy the page content into
    input/translations/<lang>/pagecontent/<name>.md
    , citing the source path per page. Invent nothing; mark anything unclear
    TODO:REVIEW
    .
  4. Validate, build and review as above.
当目标语言的版本已在其他位置存在时,请提取该版本而非重新翻译:
  1. 填写
    references/harvest-config.yaml
    :目标语言文本的来源(叙述性内容可使用平行渲染的指南;资源文本可使用FSH
    translation
    扩展或
    designation
    s),以及页面/制品的映射关系。
  2. 资源:将现有的designations或translation扩展移动至
    input/translations/<lang>/<Type>-<id>.po
    。现有版本的页面标题可作为IG级目录文件(步骤5)的翻译参考,但不能替代该文件。
  3. 叙述性内容:将页面内容复制到
    input/translations/<lang>/pagecontent/<name>.md
    ,并为每个页面注明来源路径。请勿编造内容;将任何不明确的内容标记为
    TODO:REVIEW
  4. 按上述步骤进行验证、构建和审核。

What the toolchain actually renders

工具链实际渲染逻辑

Verified with IG Publisher 2.2.11 and
fhir2.base.template
0.1.0 (2026-07) unless the row says otherwise — one row rests on HL7's reference IG, whose live build was produced by publisher 2.0.13, and one row is explicitly unverified. Each row states its own basis; do not read the heading as covering all of them. This is publisher behaviour and applies to any language pair.
ContentTranslatable?Mechanism
Narrative pages (
input/pagecontent/<name>.md
)
Yes, renders
input/translations/<lang>/pagecontent/<same-filename>
— the whole page renders on
/<lang>/
. No file → falls back to the default-language source.
Resource texts of StructureDefinition, CodeSystem, Questionnaire (
description
, designations, element
definition
)
Yes, rendersSupplement
input/translations/<lang>/<Type>-<id>.{po|xliff|json}
Menu (
input/includes/menu.xml
)
Yes
input/translations/<lang>/includes/menu.xml
ImplementationGuide own
title
, and per-artifact
definition.resource.name
Yes, renders — but observed on the 2.0.13 reference build, not on our pin
input/translations/<lang>/ImplementationGuide-<ig-id>.po
. Not a resource supplement — the publisher imports the IG's translations at load time (
PublisherIGLoader
importFromTranslations
, read from the source), so the
TRANSLATION_SUPPLEMENT_RESOURCE_TYPES
restriction does not apply. Units are keyed by FHIRPath in the
#:
comment.
es
header title +
es/artifacts.html
artifact names were seen on HL7's reference build
ImplementationGuide
description
,
publisher
,
name
, per-artifact
.description
UnverifiedUnits for these exist in the reference catalogue and belong in the same file; no rendering was observed for them, on either build.
name
is FHIR's computer-friendly name, not display text — do not expect it to render at all. Add them, do not claim them
Breadcrumbs & titles of
pages:
-tree pages
(breadcrumbs incl. the root label, TOC page body, browser
<title>
)
Yes, renders
ImplementationGuide.definition.page.title
units in the same IG-level
.po
; the publisher feeds them into the per-language
titlelang
/
breadcrumblang
maps. Verified on 2.2.11 on a migrated MII KDS module with the breadcrumb override deleted (23 units;
temp/pages/_data/pages.json
titlelang
differs en/de for all 23, zero before). The left-hand navigation menu was not inspected — no claim is made for it. Generate the units from the
pages:
tree
of the generated
ImplementationGuide-<id>.json
(the authoritative set), using the menus only as a wording seed, and emit an empty
msgstr
+ a review flag for any title left untranslated. HL7's
FHIR/multi-lang-test-ig
ships such a file and renders
es
/
nl
breadcrumbs from it; both MII template repos already ship one on their
dev
branch. This retires the breadcrumb override (
fragment-pagebegin.html
+
input/includes/breadcrumb-titles-de.txt
), which shipped in exactly one release, template v0.5.0 — never in v0.4.0 or earlier, never on
dev
. A module generated from v0.5.0 should gain this
.po
and drop the override. Never work around it with sibling pages or menu tricks
ValueSet,
concept.display
/
concept.definition
Partial / No — unresolvedNot applied from a plain
.po
supplement on this toolchain. Conflict, deliberately left open:
references/translate-spec.md
§ 1 lists
concept.display
/
concept.definition
among the fields a supported CodeSystem supplement does translate. Neither claim has a build behind it; the next run that touches a CodeSystem supplement must test it and replace both
A language in
i18n-lang
but absent from
translation-sources
No — silentlyIts
.po
files are ignored without error or warning and the default language renders. Check this pairing before concluding a mechanism is unsupported
Treat this table as ground truth, and re-verify it whenever the pinned IG Publisher or base template version changes. Read the pins from the guide's own build workflow, not from this file.
Obsolete claims, recorded so they are not reintroduced:
  • An earlier version of this skill used a
    <name>-<lang>.md
    sibling for pages and stated that narrative pages were "not yet" renderable. Both were wrong. The correct mechanism is a translation-source folder, as HL7's own
    FHIR/multi-lang-test-ig
    demonstrates.
  • This skill claimed that
    ImplementationGuide-<id>.po
    is "ignored by the Publisher", that there is "no supplement mechanism" for the IG title, and that default-language breadcrumbs on
    pages:
    -tree pages are "a toolchain limitation, not a defect" requiring the MII template's
    breadcrumb-titles-de.txt
    workaround. All wrong: it generalized
    TRANSLATION_SUPPLEMENT_RESOURCE_TYPES
    — which really does restrict resource supplements — to the IG resource, which is translated by a separate load-time import. The page-title mechanism was verified on 2.2.11 (our pin) against an MII KDS module with the template's breadcrumb override deleted; HL7's reference IG ships such a
    .po
    and its live build — produced by 2.0.13 — renders
    es
    /
    nl
    breadcrumbs from it. That says nothing about since when the publisher supports this: no support floor is claimed, and none should be inferred from those two version numbers. The real cause of "translations do not apply" is usually the
    translation-sources
    footgun in the table above.
除非另有说明,以下内容基于IG Publisher 2.2.11
fhir2.base.template
0.1.0(2026-07)验证——其中一行基于HL7的参考IG,其在线版本由Publisher 2.0.13生成,另一行明确为未验证内容。每行均注明其验证依据;请勿认为标题覆盖所有内容。这是Publisher的行为,适用于任何语言对。
内容是否可翻译?实现机制
叙述性页面 (
input/pagecontent/<name>.md
)
是,可渲染
input/translations/<lang>/pagecontent/<相同文件名>
—— 整个页面会在
/<lang>/
路径下渲染。若无该文件,则回退到默认语言源文件。
StructureDefinition、CodeSystem、Questionnaire的资源文本
description
、designations、元素
definition
是,可渲染补充文件
input/translations/<lang>/<Type>-<id>.{po|xliff|json}
菜单 (
input/includes/menu.xml
)
input/translations/<lang>/includes/menu.xml
ImplementationGuide自身的
title
,以及每个制品的
definition.resource.name
是,可渲染——但仅在2.0.13参考版本中验证,未在我们固定的版本中验证
input/translations/<lang>/ImplementationGuide-<ig-id>.po
。这不是资源补充包——Publisher会在加载时导入IG的翻译内容(
PublisherIGLoader
importFromTranslations
,从源读取),因此
TRANSLATION_SUPPLEMENT_RESOURCE_TYPES
限制不适用于此。单元以FHIRPath作为
#:
注释中的键。在HL7的参考版本中可看到
es
语言的页眉标题 +
/es/artifacts.html
页面上的制品名称已翻译
ImplementationGuide的
description
publisher
name
,每个制品的
.description
未验证参考目录中包含这些单元,应放在同一文件中;未在任何版本中观察到渲染效果
name
是FHIR的计算机友好名称,而非显示文本——请勿期望其会被渲染。可添加这些单元,但不要声称其可渲染
pages:
树页面的面包屑和标题
(面包屑包括根标签、TOC页面内容、浏览器
<title>
是,可渲染同一IG级
.po
文件中的
ImplementationGuide.definition.page.title
单元;Publisher会将其导入到对应语言的
titlelang
/
breadcrumblang
映射中。已在2.2.11版本中验证:迁移后的MII KDS模块删除了面包屑覆盖内容(23个单元;
temp/pages/_data/pages.json
中的
titlelang
在中英文版本中均不同,之前为完全一致)。未检查左侧导航菜单——不对其做任何渲染声称。从生成的
ImplementationGuide-<id>.json
的**
pages:
树**(权威集合)生成单元,仅将菜单作为措辞参考,并为每个未翻译的标题生成空
msgstr
+ 审核标记。HL7的
FHIR/multi-lang-test-ig
包含此类文件,并从中渲染
es
/
nl
语言的面包屑;两个MII模板仓库的
dev
分支已包含该文件。这替代了面包屑覆盖方案(
fragment-pagebegin.html
+
input/includes/breadcrumb-titles-de.txt
),该方案仅在模板v0.5.0版本中提供——从未在v0.4.0或更早版本中提供,也未在
dev
分支中提供。从v0.5.0生成的模块应添加此
.po
文件并删除覆盖方案。请勿使用同级页面或菜单技巧来规避此问题
ValueSet的
concept.display
/
concept.definition
部分支持/不支持——未解决在当前工具链中,普通
.po
补充包无法应用此翻译。冲突,故意保留未解决
references/translate-spec.md
§1列出
concept.display
/
concept.definition
为受支持的CodeSystem补充包可翻译字段。两种说法均无构建验证支持;下次处理CodeSystem补充包时必须进行测试并替换这两种说法
i18n-lang
中配置的语言,但未在
translation-sources
中声明
否——静默失效
.po
文件会被忽略且无错误或警告,默认语言会被渲染。在判定机制不支持前,请检查此配对关系
请将此表格视为事实依据,并在固定的IG Publisher或基础模板版本变更时重新验证。请从指南自身的构建工作流中读取固定版本,而非从此文件中读取。
已过时的错误声明(记录以避免重新引入):
  • 本技能早期版本使用
    <name>-<lang>.md
    同级文件处理页面,并声称叙述性页面“尚未”可渲染。两种说法均错误。正确的机制是使用翻译源文件夹,如HL7自身的
    FHIR/multi-lang-test-ig
    所示。
  • 本技能曾声称
    ImplementationGuide-<id>.po
    “被Publisher忽略”、IG标题“无补充机制”,且
    pages:
    树页面的默认语言面包屑是“工具链限制而非缺陷”,需要MII模板的
    breadcrumb-titles-de.txt
    workaround。所有说法均错误:它将
    TRANSLATION_SUPPLEMENT_RESOURCE_TYPES
    (确实限制资源补充包)的范围泛化到了IG资源,而IG资源是通过单独的加载时导入进行翻译的。页面标题机制已在2.2.11版本(我们固定的版本)中验证:迁移后的MII KDS模块删除了模板的面包屑覆盖内容;HL7的参考IG包含此类
    .po
    文件,其在线版本(由2.0.13生成)从中渲染
    es
    /
    nl
    语言的面包屑。这并未说明Publisher从哪个版本开始支持此机制:未声明最低支持版本,也不应从这两个版本号中推断。“翻译未生效”的真正原因通常是表格中提到的
    translation-sources
    陷阱。

Verification

验证

bash
bash "$SKILL_DIR/scripts/ig-translate.sh" --validate <lang>          # --strict: empty set fails too
  • Exit 2 with a clear message when run outside an IG, or when the language argument is missing — a silent empty scan is the failure mode this guards against.
  • --validate
    reports
    [OK]
    per supplement and per page, and no
    [WARN]
    ; any
    [WARN]
    exits 1, and its summary line states how many supplements and pages were actually checked. "Checked: 0" with exit 0 is an explicit nothing to validate, never a claim that translations are valid (
    --strict
    turns it into a failure).
  • The script WARNs when
    <lang>
    is not among the guide's
    i18n-lang
    targets or when
    i18n-default-lang
    is undeclared — a best-effort echo of Preconditions 2, not a substitute for it.
  • Every
    .po
    filename is
    <Type>-<id>
    and matches a real
    fsh-generated/resources/<Type>-<id>.json
    — including
    ImplementationGuide-<ig-id>.po
    , which is a legitimate file, not a naming error.
  • No supplement exists for an unsupported type, and no
    menu.po
    exists — the publisher ignores both.
  • Every
    i18n-lang
    entry has a matching
    translation-sources
    entry; otherwise that language's
    .po
    files are ignored silently.
  • Every translated page has a source page of the same name under
    input/pagecontent/
    .
  • After a build,
    /<lang>/
    artefact pages show the translated element texts and
    /<lang>/
    narrative pages render in the target language.
  • After a build with an IG-level
    .po
    ,
    /<lang>/
    breadcrumbs, the TOC page body and the browser
    <title>
    are in the target language, and
    temp/pages/_data/pages.json
    carries a
    titlelang
    that differs from the default-language title for every page in the
    pages:
    tree. A page whose
    titlelang
    still equals the source title has no unit, or an empty
    msgstr
    , or the language is missing from
    translation-sources
    .
  • The default-language
    input/pagecontent/
    and the FSH sources are unchanged
    git diff
    on them is empty.
bash
bash "$SKILL_DIR/scripts/ig-translate.sh" --validate <lang>          # --strict: 空翻译集也会失败
  • 在IG目录外运行或缺少语言参数时,以退出码2终止并给出明确提示——这是为了防止静默空扫描的失败模式。
  • --validate
    会为每个补充包和页面报告
    [OK]
    ,无
    [WARN]
    ;若存在
    [WARN]
    则以退出码1终止,摘要行说明实际检查的补充包和页面数量。“已检查:0”且退出码0表示明确的“无内容可验证”,而非声称翻译有效(
    --strict
    会将其转为失败)。
  • <lang>
    不在指南的
    i18n-lang
    目标语言中,或
    i18n-default-lang
    未声明时,脚本会发出警告——这是对前置条件2的尽力检查,而非替代该步骤。
  • 每个
    .po
    文件名均为
    <Type>-<id>
    ,且与真实的
    fsh-generated/resources/<Type>-<id>.json
    文件匹配——包括
    ImplementationGuide-<ig-id>.po
    ,这是合法文件,而非命名错误。
  • 不存在不支持类型的补充包,也不存在
    menu.po
    文件——Publisher会忽略这两种文件。
  • 每个
    i18n-lang
    条目都有对应的
    translation-sources
    条目;否则该语言的
    .po
    文件会被静默忽略。
  • 每个翻译页面在
    input/pagecontent/
    下都有同名的源页面。
  • 构建完成后,
    /<lang>/
    路径下的制品页面显示翻译后的元素文本,
    /<lang>/
    路径下的叙述性页面以目标语言渲染。
  • 添加IG级
    .po
    文件并构建后,
    /<lang>/
    路径下的面包屑、TOC页面内容和浏览器
    <title>
    均为目标语言,且
    temp/pages/_data/pages.json
    包含
    titlelang
    字段,与
    pages:
    树中每个页面的默认语言标题不同。若某个页面的
    titlelang
    仍与源标题相同,则表示该页面无对应单元、
    msgstr
    为空,或该语言未在
    translation-sources
    中声明。
  • 默认语言的
    input/pagecontent/
    和FSH源文件未被修改——对其执行
    git diff
    结果为空。

Guardrails

约束规则

  • The default-language source stays leading and binding. A translation is a rendering aid, never the normative text. Which language that is comes from
    i18n-default-lang
    , not from this file.
  • Never change the source. Translations are additive under
    input/translations/<lang>/
    .
  • FHIR identifiers stay untranslated
    name
    ,
    id
    , codes and canonical URLs are not language.
  • No invention. Mark every machine translation
    TODO:REVIEW
    ; bilingual human review is mandatory.
  • Only on confirmation. The default is a dry-run scan.
  • Propose, do not merge. Deliver changes as a pull request, and determine the target branch from the repository's own convention — do not assume one. An earlier version of this skill hard-coded
    dev
    , which is one repository's convention and wrong everywhere else.
  • 默认语言源文件始终为权威版本。翻译仅为渲染辅助,绝非规范性文本。默认语言由
    i18n-default-lang
    决定,而非此文件。
  • 绝不修改源文件。翻译内容为
    input/translations/<lang>/
    下的新增内容。
  • FHIR标识符保持不翻译——
    name
    id
    、代码和规范URL不属于语言内容。
  • 不编造内容。将所有机器翻译内容标记为
    TODO:REVIEW
    ;双语人工审核为强制要求。
  • 仅在确认后执行。默认执行空运行扫描。
  • 仅提交建议,不直接合并。将变更作为拉取请求提交,并根据仓库自身约定确定目标分支——不要自行假设。本技能早期版本硬编码
    dev
    分支,这仅适用于某一个仓库的约定,在其他仓库均不适用。

Scope and delimitation

范围与边界

Covers producing and placing a guide's translation supplements, in both directions of provenance: translating the default-language source, or harvesting an existing rendering.
Deliberately not covered:
  • Measuring or comparing guides — see
    fhir-ig-analysis
    .
  • Migrating a guide onto the MII KDS module template — see
    mii-ig-migration
    , which sets translation up as one step of a migration and then hands over here.
  • A template package's language mechanism and policy — a different repository's concern; see Preconditions 4.
  • Choosing the guide's languages. Adding an
    i18n-lang
    entry changes the guide's configuration and is its maintainer's decision.
  • Judging whether a translation is good. That is the mandatory human review, not this skill.
If a skill of this name is provided both by this catalog and locally, the local one wins.
涵盖生成并放置指南的翻译补充包,支持两种来源方向:从默认语言源文件翻译,或从现有版本提取。
明确不涵盖的内容:
  • 指南的度量或对比——请参考
    fhir-ig-analysis
    技能。
  • 将指南迁移至MII KDS模块模板——请参考
    mii-ig-migration
    技能,该技能将翻译设置作为迁移的一个步骤,之后移交至本技能处理。
  • 模板包的语言机制和策略——属于其他仓库的职责;请参考前置条件4。
  • 选择指南的语言。添加
    i18n-lang
    条目属于指南配置变更,需由指南维护者决定。
  • 判断翻译质量。这是强制人工审核的职责,而非本技能的处理范围。
若本技能在本地和技能目录中均存在,优先使用本地版本。

References

参考资料

  • references/translate-spec.md
    — the full mechanics, file conventions and formats.
  • references/harvest-config.yaml
    — configuration schema for harvest mode.
  • references/triggers.md
    — the Gate 3 prompt set.
  • scripts/ig-translate.sh
    — scan and validate; dry-run by design, it writes nothing. It scans for the IG-level catalogue alongside the resource supplements and accepts it in
    --validate
    ; genuinely unsupported types still WARN. Validation findings exit 1;
    --strict
    also fails an empty translation set.
  • references/translate-spec.md
    —— 完整的机制、文件约定和格式说明。
  • references/harvest-config.yaml
    —— 提取模式的配置 schema。
  • references/triggers.md
    —— Gate 3提示集。
  • scripts/ig-translate.sh
    —— 扫描和验证工具;默认执行空运行,不写入任何内容。它会扫描IG级目录文件和资源补充包,并在
    --validate
    时接受该文件;真正不支持的类型仍会发出警告。验证到问题会以退出码1终止;
    --strict
    参数会使空翻译集也触发失败。

Provenance

来源说明

Derived from
skills/ig-translate
in
forschungsgruppe-digital-health/mii-kds-module-template
at commit
b5beedb17a66a4397d597429668c7b6d54202c62
, which in turn adapted the
ig-translate
skill of
forschungsgruppe-digital-health/mii-kds-sample-ig-inoffiziell
(CC-BY-4.0) and refocused it on the module side. Both steps of that lineage are recorded deliberately.
Reworked on 2026-07-31 for this catalog. Beyond the catalog contract, four substantive changes:
  • The helper now ships with the skill. It previously lived in the source repository's
    scripts/
    and was referenced by parent traversal.
  • scripts/ig-translate.sh
    operates on the current working directory and detects whether it is an IG project. It previously did
    cd "$(dirname "$0")/.."
    , assuming it sat in
    <module-repo>/scripts/
    ; installed as part of a skill that
    cd
    reaches the skill directory, and the scan would have reported every page as missing.
  • The
    dev
    branch target was removed from the description and the guardrails, and replaced by discovering the repository's own convention.
  • The language pair is derived, not assumed. The inherited skill was written for one direction (
    en
    de
    ) and for MII KDS modules specifically, which made a
    fhir-
    prefix on its name an overclaim. It now reads
    i18n-default-lang
    and
    i18n-lang
    from the guide being worked on, the script requires an explicit language argument instead of defaulting to
    de
    , and the mechanics are stated for any language pair. That is what earns the prefix.
Revised on 2026-08-01 after the skill's first real-task exercise (a dry run against
kerndatensatz-dokument
):
--validate
findings now exit 1 and an empty translation set is reported explicitly (and fails under
--strict
) instead of an unconditional exit 0; the script cross-checks
<lang>
against the guide's i18n parameters with best-effort warnings; the harvest config's
page_map
example now covers non-English source page names; and the
allowed-tools
grant covers executing the bundled bash script. The dry-run findings live in the
mii-kds-dokument-ig-inoffiziell
sandbox under
docs/reports/dry-run-2026-07-31/
.
Revised on 2026-08-05 to retire a documented false claim: that the publisher cannot localize the titles of
pages:
-tree pages and that an
ImplementationGuide-<id>.po
is ignored. Evidence, and nothing beyond it:
  • Our own build on our own pin (IG Publisher 2.2.11) — the migrated MII KDS Dokument guide with the template's breadcrumb override deleted and 23
    page.title
    units supplied:
    /de/
    breadcrumbs German including the root label "Inhaltsverzeichnis", the TOC page body German, the browser
    <title>
    German, and
    temp/pages/_data/pages.json
    titlelang
    differing en/de for all 23 pages (zero before). Build health unchanged (sushi 0 errors, QA err=7 = the established baseline). The left-hand nav,
    IG.description
    ,
    IG.publisher
    ,
    IG.name
    and artifact names were not observed on 2.2.11 and are not claimed for it.
  • HL7's reference IG
    FHIR/multi-lang-test-ig
    , live build produced by publisher 2.0.13 — localized
    es
    /
    nl
    breadcrumbs, a translated IG title in the
    /es/
    header, translated artifact names on
    /es/artifacts.html
    , and
    fr
    (in
    i18n-lang
    , absent from
    translation-sources
    ) as a controlled negative. A different publisher version from ours; kept separable in the tables.
  • Prior art in our own organisation: both MII template repos already carry a correct catalogue on their
    dev
    branch, and
    ig-template-mii-kds
    records the same mechanism in the MII's own
    kerndatensatz-basis
    module, "verified 2026-07-30".
Consequences here: the rendering table attributes every row to the build that supports it and marks the unobserved fields unverified; the breadcrumb override is recorded as shipping in exactly one release, template v0.5.0 (never v0.4.0 or earlier, never on
dev
), as a misdiagnosis now being retired; a Procedure step for the IG-level catalogue was added, pointing at the generator bundled with
mii-ig-migration
; the CodeSystem
concept.display
/
definition
conflict between this file and
references/translate-spec.md
is flagged as unresolved instead of silently decided; and
scripts/ig-translate.sh
no longer WARNs on (nor fails) an
ImplementationGuide-<id>.po
— the very file the procedure now mandates — while genuinely unsupported types still do.
Original licence: CC-BY-4.0, as declared by both source repositories.
scripts/
is Apache-2.0, matching this repository's code licence.
衍生自
forschungsgruppe-digital-health/mii-kds-module-template
中的
skills/ig-translate
,提交哈希为
b5beedb17a66a4397d597429668c7b6d54202c62
,该版本又改编自
forschungsgruppe-digital-health/mii-kds-sample-ig-inoffiziell
ig-translate
技能(CC-BY-4.0许可),并将其重新聚焦于模块侧。该传承的两个步骤均已明确记录。
2026-07-31针对本技能目录进行了重写。除符合目录约定外,主要有四项实质性变更:
  • 辅助工具现在与技能捆绑发布。此前它位于源仓库的
    scripts/
    目录中,通过父路径引用。
  • scripts/ig-translate.sh
    当前工作目录运行,并检测该目录是否为IG项目。此前它执行
    cd "$(dirname "$0")/.."
    ,假设它位于
    <module-repo>/scripts/
    目录;作为技能安装后,
    cd
    会进入技能目录,扫描会报告所有页面缺失。
  • 描述和约束规则中移除了
    dev
    分支目标,改为根据仓库自身约定确定。
  • 语言对通过推导获得,而非假设。继承的技能仅针对一个语言方向(
    en
    de
    ),且专门针对MII KDS模块,因此其名称中的
    fhir-
    前缀名不副实。现在它会从正在处理的指南中读取
    i18n-default-lang
    i18n-lang
    ,脚本要求显式指定语言参数而非默认使用
    de
    ,且机制说明适用于任何语言对。这才使其配得上
    fhir-
    前缀。
2026-08-01在本技能首次真实任务演练(针对
kerndatensatz-dokument
的空运行)后进行了修订:
--validate
检测到问题现在会以退出码1终止,空翻译集会被明确报告(在
--strict
下会失败),而非无条件以退出码0终止;脚本会尽力检查
<lang>
是否与指南的i18n参数匹配并发出警告;提取配置的
page_map
示例现在支持非英文源页面名称;
allowed-tools
权限涵盖执行捆绑的bash脚本。空运行结果存放在
mii-kds-dokument-ig-inoffiziell
沙箱的
docs/reports/dry-run-2026-07-31/
目录下。
2026-08-05修订以纠正已记录的错误声明:即Publisher无法本地化
pages:
树页面的标题,且
ImplementationGuide-<id>.po
被忽略。仅基于以下证据:
  • 我们固定版本的构建(IG Publisher 2.2.11)——迁移后的MII KDS Dokument指南删除了模板的面包屑覆盖内容,并提供了23个
    page.title
    单元:
    /de/
    路径下的面包屑为德语(包括根标签“Inhaltsverzeichnis”),TOC页面内容为德语,浏览器
    <title>
    为德语,且
    temp/pages/_data/pages.json
    中的
    titlelang
    在中英文版本中均不同(之前完全一致)。构建状态未变(sushi 0错误,QA err=7 = 既定基线)。左侧导航、
    IG.description
    IG.publisher
    IG.name
    和制品名称未在2.2.11版本中观察到翻译效果,因此不对其做声称。
  • HL7的参考IG
    FHIR/multi-lang-test-ig
    ,在线版本由Publisher 2.0.13生成——本地化的
    es
    /
    nl
    语言面包屑,
    /es/
    页眉中的翻译后IG标题,
    /es/artifacts.html
    页面上的翻译后制品名称,以及
    fr
    语言(在
    i18n-lang
    中配置,但未在
    translation-sources
    中声明)作为受控负例。这与我们的版本不同;在表格中单独列出。
  • 我们组织内的既有实践:两个MII模板仓库的
    dev
    分支已包含正确的目录文件,
    ig-template-mii-kds
    在MII自身的
    kerndatensatz-basis
    模块中记录了相同的机制,“已验证2026-07-30”。
此次修订的影响:渲染表格中每行均注明支持其的构建版本,并将未观察到的字段标记为未验证;面包屑覆盖方案被记录为仅在模板v0.5.0版本中提供(从未在v0.4.0或更早版本中提供,也未在
dev
分支中提供),作为已纠正的错误诊断;操作步骤中添加了IG级目录文件的步骤,指向
mii-ig-migration
技能捆绑的生成器;本文件与
references/translate-spec.md
之间关于CodeSystem
concept.display
/
definition
的冲突被标记为未解决,而非静默处理;
scripts/ig-translate.sh
不再对
ImplementationGuide-<id>.po
发出警告(或失败)——该文件现在是操作步骤中强制要求的——而真正不支持的类型仍会发出警告。
原始许可:CC-BY-4.0,如两个源仓库所声明。
scripts/
目录下的文件采用Apache-2.0许可,与本仓库的代码许可一致。