Files
OrcaSlicer/AGENTS.md
T
Ian Bassi e821665e4b Add orca-translations Claude skill and PO tool (#16436)
* Add orca-translations Claude skill and PO tool

Add a .claude skill that guides translation passes over the localization/i18n gettext catalogs. It covers the workflow: run gettext, settle new glossary terms, translate in batches, verify, and report.

Includes translation-rules.md, which condenses the placeholder, line-break and glossary rules plus the guidance on review notes.

Also adds scripts/po_tool.py (standard library only). It lists pending entries with glossary hints, validates and applies translations, adding '# AI Translated' and '# Needs human review' comments, and rewrites only the entries it changes. It can also check catalogs, look up existing translations, suggest glossary candidates and update the wiki glossary TSV.

* Let po_tool apply translations by entry id

pending now gives each entry a short id, so a translation file can name
entries by id instead of repeating the English msgid. apply accepts either.

A "review": "" item clears an earlier review note when overwriting an
entry, and check gives each msgfmt run its own temporary output file so
parallel checks do not collide.

* Fill all empty translations

Regenerate the template with run_gettext --full and translate every empty
entry in the 22 catalogs (7,089 entries) with the orca-translations skill,
following the localization glossary, including the new belt printer,
IDEX/IQEX and plugin terms. Every new entry is marked "# AI Translated";
122 also carry "# Needs human review" with what to check.

* Show entry ids in po_tool lookup and search translations

lookup now prints each entry's id, so an entry found there can be
rewritten with apply --overwrite without repeating the English, and
--msgstr searches the translations instead of the msgids, which finds
every entry that still uses a term being changed.

SKILL.md describes how to change an established term: check the
catalog's usage first, update the glossary cell, then rewrite only the
entries where the term has that meaning.

* Fix mistranslated terms and align catalogs with the glossary

Correct labels that the glossary had copied, and the entries that used
them:
- ca: Raft was rendered as the Brim term; it is now "Rai". Exhaust fan,
  Monotonic line, Unretract, Slice, Lateral Honeycomb and PA Tower
  labels fixed.
- cs: Lightning infill is "Blesk", not "Osvětlení" (illumination).
- sv: Retraction is "Retraktion", not "Reduktion"; Unretract,
  Lagerhöjd, Delkylningsfläkt, Utsugsfläkt, Aligned Rectilinear and the
  Preset label fixed.
- de: Brim is "Rand" and Skirt is "Umrandung", as most entries already
  had them.
- lt: brim entries used the Skirt word "apvadas"; they now use "kraštas".
- es: Sparse infill is "relleno de baja densidad", the catalog majority.
- eu: nozzle wipe is "garbiketa", not purge.
- th: the project plate is "เพลต", distinct from the bed.
- uk: Quarter Cubic, Latin "PA" in PA Tower, and Belt purge tower.
- pl: Cross Hatch, Tri-hexagon, Volumetric speed and Raft labels.
- zh_TW: Brim stays "Brim", as the existing labels have it.
- tr: "Prime Tower" read "Prime Minister Tower".
- ko: the plugin "Capabilities" label read "performance".
- Build Volume labels fixed in tr, de, cs and eu.

All 242 rewritten entries are marked "# AI Translated".

* Make more UI text translatable and fix pluralization and context

Audit the sources for text that translators could not translate
correctly and fix it.

Mark text that reached users in English only: IDEX/IQEX role names,
plugin permission prompts and errors, 3MF/preset loading errors, G-code
placeholder parser errors, calibration and device messages, notification
texts, file dialog filters, and the config validation messages.

Replace sentences built from translated fragments, such as the prime
tower warnings, "left"/"right" nozzle names, and "Filament " + number,
with single msgids that have placeholders, so translators can reorder
and inflect them.

Use plural forms for texts with a count ("%1% mixed filaments",
"%d objects", "%1% triangles") instead of "(s)" and mismatched verbs.
Fix the swapped singular/plural pair in "The following presets inherit
this preset".

Add translation contexts where one English word has several meanings
(Subscribed/Local, Standard, Pause, View, Step, Model, Camera, Flow,
Filter, Others, Prepare, the Design tools). Show "Size" instead of
"Build Volume" in the Cut tool, which displays the object size.

Fix code that compared translated text with English (the Edit G-code
dialog group, the plugin registration failure check), and add the
bundled web pages' missing string-table entries. Use the single
character for degrees Celsius, say "G-code", and describe the head
filament map without internal jargon.

Install the libslic3r translate callback before the presets load, so
their load errors are translated, and list the 28 source files that had
marked strings but were never extracted into localization/i18n/list.txt.

* Suggest earlier translations and list fuzzy entries in po_tool pending

pending now attaches the closest earlier translation of a similar
English text (from obsolete or translated entries), so a reworded or
split string keeps its wording, and it lists fuzzy entries by default,
since users never see them. A fuzzy entry also carries its stale
translation as previous_translation.

* Fix wording of the non-boolean operands error

The logical operation error said "operators" where it means the
operands the operation was applied to.

* Translate the newly translatable strings in all languages

Regenerate the template after the translatability changes and fill every
new or changed entry in the 22 catalogs (about 12,800 entries): the
strings that became translatable, the plural forms, the entries split by
context, and the previously fuzzy singular entries that became plurals.

Every new entry is marked "# AI Translated", and about 360 also carry a
"# Needs human review" note saying what to check. Terms follow the
localization glossary. Earlier translations of reworded strings were
reused where the meaning was unchanged. Existing entries were not
changed, and obsolete entries are kept.

* Document the source translatability audit in the orca-translations skill

Add a reference describing how strings reach translators, what to look
for (untranslated text, spliced sentences, missing plurals, ambiguous
words), what not to translate, where a context cannot be carried, and
what to do after the edits, plus a scanner that lists untranslated
user-facing string literals.

* Document how to write translatable strings in AGENTS.md

Tell developers to keep each message complete in one msgid: use
placeholders instead of concatenating translated fragments, plural forms
for counts, and contexts for ambiguous words, and to list new source
files in localization/i18n/list.txt. Add a matching code review item.

* Translate the strings added since the rebase

Regenerate the template against the current main and translate the 26
new entries per language: the Fix Model commands and messages, and the
texture displacement image adjustment panel. Each new entry is marked
"# AI Translated"; existing entries are unchanged.

* tidy
2026-10-13 10:53:57 -03:00

9.4 KiB

CLAUDE.md

OrcaSlicer — open-source C++17 3D slicer. wxWidgets GUI, CMake build system.

Build Commands

Build the Release configuration unless asked otherwise.

# macOS
cmake --build build/arm64 --config Release --target all --

# Linux
cmake --build build --config Release --target all --

# Windows
cmake --build . --config Release --target ALL_BUILD -- -m

Testing

Catch2 framework. Tests in tests/; see tests/AGENTS.md for where a new test belongs and the conventions to follow.

cd build && ctest -C Release --output-on-failure    # all tests
ctest --test-dir ./tests/libslic3r -C Release       # individual suite
ctest --test-dir ./tests/fff_print -C Release

Documentation

  • Docs live in docs/; the high-level design of a subsystem goes in docs/HLSD/<subsystem>.md.
  • Describe the design as it stands — what the subsystem does, why it exists, and the constraints that shape it. Not the route that got there: no phases, task lists, status markers, or "before/after this PR" framing.
  • Planning and investigation output (brainstorms, superpowers design and plan docs) stays in docs/superpowers/, which is gitignored. Never commit it.
  • Write a doc only when the design is not evident from the code, and when a change invalidates an existing one, update it in the same PR.

Code Style

  • C++17, selective C++20. PascalCase classes, snake_case functions/variables
  • #pragma once for headers. Smart pointers and RAII preferred
  • Include what you use: include the header for every symbol a file uses, and keep headers compilable on their own. Never rely on the precompiled header or a transitive include. The clang-tidy CI job enforces this on changed lines; run the same check locally with scripts/run_clang_tidy.sh (scripts\run_clang_tidy.ps1 on Windows), which sets up everything it needs
  • Parallelization via TBB — be mindful of shared state
  • Always use SetSizerAndFit(sizer) instead of SetSizer(sizer) on top level window. Unless SetSizer must be called before the full layout is built, call sizer->SetSizeHints(window) afterwards in this case.

Key Entry Points

  • App startup: src/OrcaSlicer.cpp
  • Slicing pipeline: src/libslic3r/Print.cpp
  • All print/printer/material settings: src/libslic3r/PrintConfig.cpp
  • GUI: src/slic3r/GUI/
  • Core algorithms: src/libslic3r/ (GCode/, Fill/, Support/, Geometry/, Format/, Arachne/)
  • Printer profiles: resources/profiles/[manufacturer].json

Critical Constraints

  • Backward compatibility required for .3mf project files and printer profiles
  • Cross-platform — all changes must work on Windows, macOS, and Linux
  • Profile/format changes need version migration handling
  • Dependencies built separately in deps/build/, then linked to main app

Code review focus areas

  • Changes must not cause regressions in existing functionality, defaults, profiles, or project compatibility.
  • Features gated by options must not affect existing behavior when those options are disabled.
  • Changes should follow the existing code style and architecture. Architectural changes should be justified in code comments and the PR description.
  • Add helper functions or utilities only when existing code cannot reasonably be reused. Avoid duplication.
  • Keep code concise and clear. Manually simplify AI generated bloated codes before review.
  • Include targeted tests or documented verification for behavior changes, especially in slicing logic, profiles, formats, and GUI defaults.
  • For profile changes (resources/profiles/<Vendor>/**), check that version in the sibling resources/profiles/<Vendor>.json was bumped.
  • For new or changed UI strings, check they follow Writing translatable strings in the source: no concatenated fragments, plural forms for counts, contexts for ambiguous words.
  • For translation changes (localization/i18n/**/*.po), check that recurring terms match the Localization glossary for that language.

Localization & translations

Catalogs live in localization/i18n/<lang>/OrcaSlicer_<lang>.po; the template is OrcaSlicer.pot. See the Localization guide for the human-facing version of these principles.

Writing translatable strings in the source

Translators see one msgid at a time and cannot change the code around it, so each message must be complete in a single msgid. Use the wrapper that fits instead of assembling text from pieces:

  • One msgid per sentence, with placeholders. Never build a message by concatenating translated fragments (_L("A") + name + _L(" is B")) or by splicing a translated word such as _L("left") into another sentence: the translator can't reorder or inflect the parts. Write format(_L("%1% is too close to others"), name).
  • A count needs a plural form. Don't write file(s) or leave a verb unchanged after a number. Use _L_PLURAL("%1% object", "%1% objects", n). libslic3r has no plural lookup, so word the message so it doesn't depend on a count, or build it in the GUI.
  • An ambiguous word needs a context. When a short string means different things in different places (verb or noun, a mode name, a CAD term), give each sense its own context with _L_CONTEXT/_u8L_CONTEXT/L_CONTEXT. Keep the most common sense without a context so its existing translations stay valid.
  • Mark every user-visible string (_L/_u8L, or L where it is translated later) and list new source files in localization/i18n/list.txt: files that aren't listed are never extracted.
  • Add a // TRN comment above a new string whose meaning or placeholders aren't obvious.
  • Never choose behavior by comparing translated text; compare ids or flags.

See .claude/skills/orca-translations/references/source-audit.md for the full checklist.

Terminology

  • Use the Localization glossary as the source of truth for recurring terms, so the same English term is always rendered the same way within a language, and terms that must stay in English (brand/product names, acronyms, materials, file formats, G-code tokens, macros/variables/identifiers) are not translated.
  • If a term's established translation changes, update both the affected .po files and the glossary (localization_glossary.tsv, then regenerate) so they stay in sync.
  • Translate the meaning, not the words. Check what the string actually controls before translating it — English reuses one word for different things. Flow ratio (multiplier), Flow Rate (throughput) and Flow Dynamics (pressure compensation) are three different terms; extruder may mean the toolhead, the feeder motor, or the nozzle depending on the string.
  • Reuse one template per recurring message shape (Failed to connect to …, Are you sure you want to …?), even where the English wording varies.

Editing rules

  • Only edit msgstr — never change msgid, and never "fix" wrong English in the translation alone. Report the source string instead.
  • Preserve exactly: placeholders (%s, %d, %1%, %zu, %%), every \n (count and position, including leading/trailing), leading/trailing spaces, HTML tags, ℃, and the file's encoding and line endings.
  • Never reorder positional arguments in a c-format string. If the msgid is %d then %s, that order must hold — swapping them breaks at runtime.
  • msgctxt separates homonyms — always read it. Back/Camera View is the rear view of the 3D navigator, while Back/Navigation is the go-back button; Top exists in the Alignment, Layers and Camera View senses.
  • When a string needs disambiguating, add context in the source (_L_CONTEXT/_u8L_CONTEXT), don't work around it in the translation.
  • A literal % inside a string xgettext flagged possible-c-format will fail msgfmt. Fix it with a // xgettext:no-c-format, no-boost-format comment above the string in the source — do not mangle the translation or use %% in text that is never passed through printf.
  • Plural entries: read nplurals from the catalog's Plural-Forms header (it is not always 2 — ja/ko/zh/th/vi use 1, ru/cs/pl/lt use 3, uk uses 4). Each form must be genuinely inflected for its quantity; repeating one sentence across all forms is a bug in Slavic/Baltic languages, though it is correct for Turkish and Hungarian.
  • An entry whose msgstr equals its msgid is untranslated even though it is not empty; a plural entry with any empty form is likewise incomplete.
  • Mark machine-produced translations with an # AI Translated translator comment. Don't add it to a human translation you didn't actually rewrite.
  • When you can't be sure of a machine translation's meaning or UI wording, also add # Needs human review: <what to check>. Never use fuzzy for this — fuzzy entries are hidden from users.
  • Don't reflow or re-wrap unrelated entries — keep the diff limited to the strings you changed.

Verifying

  • scripts/run_gettext.bat --full (Windows) regenerates the template, merges every catalog and compiles the .mo files. It must exit 0.
  • Or check a single catalog with msgfmt --check-format -o <out>.mo localization/i18n/<lang>/OrcaSlicer_<lang>.po.
  • Fuzzy entries are not shown to users. If you correct one, clear its fuzzy flag, otherwise the fix never ships.