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
This commit is contained in:
Ian Bassi
2026-10-13 10:53:57 -03:00
committed by GitHub
parent b77b5afd49
commit e821665e4b
154 changed files with 98207 additions and 17434 deletions
+23 -26
View File
@@ -1686,7 +1686,7 @@ ExtruderGroup::NozzleRow ExtruderGroup::create_nozzle_row()
plater->update_machine_sync_status();
}
});
combo_flow->SetToolTip(_L("Flow"));
combo_flow->SetToolTip(_L_CONTEXT("Flow", "Nozzle Flow"));
row.flow = combo_flow;
use_nozzle_row_font(combo_flow);
@@ -4125,13 +4125,12 @@ void Sidebar::update_presets(Preset::Type preset_type)
std::vector<NozzleType> nozzle_types(cfg_nozzle_type->size());
for (size_t idx = 0; idx < cfg_nozzle_type->size(); ++idx)
nozzle_types[idx] = NozzleType(cfg_nozzle_type->values[idx]);
nozzle_type = _L( // NEEDFIX this part can be replaced with shorter names
nozzle_types[0] == ntHardenedSteel ? "Hardened Steel" :
nozzle_types[0] == ntStainlessSteel ? "Stainless Steel" :
nozzle_types[0] == ntTungstenCarbide ? "Tungsten Carbide" :
nozzle_types[0] == ntBrass ? "Brass"
: "-" // Undefined
);
// NEEDFIX this part can be replaced with shorter names
nozzle_type = nozzle_types[0] == ntHardenedSteel ? _L("Hardened Steel") :
nozzle_types[0] == ntStainlessSteel ? _L("Stainless Steel") :
nozzle_types[0] == ntTungstenCarbide ? _L("Tungsten Carbide") :
nozzle_types[0] == ntBrass ? _L("Brass")
: wxString("-"); // Undefined
}
p->label_nozzle_type->SetLabel(nozzle_type);
p->label_nozzle_type->SetToolTip(nozzle_type == "-" ? "" : nozzle_type);
@@ -4965,7 +4964,7 @@ void Sidebar::collect_physical_filament_info(std::vector<std::string>& color_str
for (size_t i = 0; i < num_physical; ++i) {
auto* combo = p->combos_filament[i];
names.push_back(combo ? into_u8(combo->GetValue()) : "Filament " + std::to_string(i + 1));
names.push_back(into_u8(combo ? combo->GetValue() : wxString::Format(_L("Filament %d"), int(i + 1))));
}
auto& preset_bundle = *wxGetApp().preset_bundle;
@@ -5333,7 +5332,7 @@ void Sidebar::remove_all_mixed_filaments()
// Worth a confirmation: this drops filament slots the model may be painted with, and anything
// painted in one falls back to a plain filament.
MessageDialog dlg(this, format_wxstr(_L("Remove all %1% mixed filaments?"), count), _L("Mixed Filament"),
MessageDialog dlg(this, format_wxstr(_L_PLURAL("Remove %1% mixed filament?", "Remove all %1% mixed filaments?", count), count), _L("Mixed Filament"),
wxYES_NO | wxNO_DEFAULT | wxICON_QUESTION);
if (dlg.ShowModal() != wxID_YES)
return;
@@ -12156,7 +12155,7 @@ void Plater::priv::reload_from_disk()
}
}
else {
wxString message = _L("Do you want to replace it") + " ?";
wxString message = _L("Do you want to replace it?");
MessageDialog dlg(q, message, _L("Message"), wxYES_NO | wxYES_DEFAULT | wxICON_QUESTION);
if (dlg.ShowModal() == wxID_YES)
#if ENABLE_RELOAD_FROM_DISK_REWORK
@@ -13065,9 +13064,7 @@ void Plater::priv::on_select_preset(wxCommandEvent &evt)
void Plater::priv::on_slicing_update(SlicingStatusEvent &evt)
{
BOOST_LOG_TRIVIAL(debug) << __FUNCTION__ << boost::format(": event_type %1%, percent %2%, text %3%") % evt.GetEventType() % evt.status.percent % evt.status.text;
//BBS: add slice project logic
std::string title_text = _u8L("Slicing");
evt.status.text = title_text + evt.status.text;
// The plate's status callback has already prefixed the text with "Slicing plate N:".
if (evt.status.percent >= 0) {
if (!m_worker.is_idle()) {
// Avoid a race condition
@@ -13635,8 +13632,8 @@ static std::vector<wxString> collect_imex_warnings(PartPlate* plate)
const int secondary_bed_temp = bed_temps->values[secondary_logical];
if (secondary_bed_temp > 0 && std::abs(secondary_bed_temp - primary_bed_temp) > 5) {
warnings.push_back(wxString::Format(
_L("Bed temperature conflict: T%d (%s) sets the bed to %d\u00B0C \u2014 "
"T%d (%s) requires %d\u00B0C. The primary tool controls the bed; "
_L("Bed temperature conflict: T%d (%s) sets the bed to %d℃ \u2014 "
"T%d (%s) requires %d℃. The primary tool controls the bed; "
"secondary tools print at whatever temperature it sets."),
primary_tool, primary_display_type, primary_bed_temp,
tool_idx, secondary_display_type, secondary_bed_temp));
@@ -15698,7 +15695,7 @@ bool Plater::priv::run_textured_mesh_import_dialog(Slic3r::Model& loaded_model,
name = preset->label(false);
}
if (name.empty())
name = "Filament " + std::to_string(i + 1);
name = into_u8(wxString::Format(_L("Filament %d"), int(i + 1)));
entry.name = name;
if (entry.kind == TextureFilamentKind::ExistingMixed) {
@@ -16826,7 +16823,7 @@ void Plater::_calib_pa_pattern(const Calib_Params& params)
if (accels.empty()) {
accels.assign({accel});
const auto msg{_L("INFO:") + "\n" +
_L("No accelerations provided for calibration. Use default acceleration value ") + std::to_string(long(accel)) + _L(u8"mm/s²")};
format_wxstr(_L("No accelerations provided for calibration. Use default acceleration value %1%mm/s²"), long(accel))};
get_notification_manager()->push_notification(msg.utf8_string());
} else {
// set max acceleration in case of batch mode to get correct test pattern size
@@ -16891,7 +16888,7 @@ void Plater::_calib_pa_pattern(const Calib_Params& params)
speeds.assign({speed});
const auto msg{_L("INFO:") + "\n" +
_L("No speeds provided for calibration. Use default optimal speed ") + std::to_string(long(speed)) + _L("mm/s")};
format_wxstr(_L("No speeds provided for calibration. Use default optimal speed %1%mm/s"), long(speed))};
get_notification_manager()->push_notification(msg.utf8_string());
} else if (speeds.size() == 1) {
// If we have single value provided, set speed using global configuration.
@@ -17315,7 +17312,7 @@ void Plater::calib_temp(const Calib_Params& params) {
if (printer_config.has("belt_printer") && printer_config.opt_bool("belt_printer") &&
! boost::filesystem::exists(belt_temp_tower_asset(params))) {
MessageDialog dlg(static_cast<wxWindow *>(wxGetApp().mainframe),
format_wxstr(_L("No belt temperature tower is available for the range %1% to %2% °C. "
format_wxstr(_L("No belt temperature tower is available for the range %1% to %2%℃. "
"Use a range the tower models cover, for example 230 to 190."),
(int) lround(params.start), (int) lround(params.end)),
_L("Temperature tower"), wxICON_ERROR | wxOK);
@@ -18152,7 +18149,7 @@ void Plater::load_gcode(const wxString& filename)
p->preview->get_canvas3d()->zoom_to_plate(0);
if (p->preview->get_canvas3d()->get_gcode_layers_zs().empty()) {
MessageDialog(this, _L("The selected file") + ":\n" + filename + "\n" + _L("Does not contain valid G-code."),
MessageDialog(this, format_wxstr(_L("The selected file:\n%1%\ndoes not contain valid G-code."), filename),
wxString(GCODEVIEWER_APP_NAME) + " - " + _L("An Error has occurred while loading the G-code file."), wxCLOSE | wxICON_WARNING | wxCENTRE).ShowModal();
set_project_filename(_L(DEFAULT_PROJECT_NAME));
} else {
@@ -23880,7 +23877,7 @@ Plater::ImexGhostTooltip Plater::format_imex_ghost_tooltip(int physical_head) co
const PartPlate* plate = p->partplate_list.get_curr_plate();
if (!plate) {
t.label = "T" + std::to_string(physical_head) + " -> (no plate)";
t.label = Slic3r::format(_u8L("T%1% -> (no plate)"), physical_head);
return t;
}
@@ -23891,8 +23888,8 @@ Plater::ImexGhostTooltip Plater::format_imex_ghost_tooltip(int physical_head) co
// No filament slot resolves to this physical head. Usually means the printer's
// extruder count is understated relative to the filament palette (user added a
// filament without extending printer_extruder_id in the Machine tab).
t.label = "T" + std::to_string(physical_head) + " — no filament routed\n"
"Add an extruder in the Machine tab so this head has a filament slot.";
// TRN IDEX/IQEX ghost tooltip. %1% is the number of the physical print head.
t.label = Slic3r::format(_u8L("T%1% — no filament routed\nAdd an extruder in the Machine tab so this head has a filament slot."), physical_head);
return t;
}
t.filament_slot_1based = logical + 1;
@@ -23900,8 +23897,8 @@ Plater::ImexGhostTooltip Plater::format_imex_ghost_tooltip(int physical_head) co
// from one resolution, not two.
t.swatch = plate->get_imex_head_filament_color(physical_head, pem, map);
t.swatch.a(1.0f); // tooltip swatch opaque
t.label = "T" + std::to_string(physical_head) +
" -> filament " + std::to_string(t.filament_slot_1based);
// TRN IDEX/IQEX ghost tooltip. %1% is the number of the physical print head, %2% the filament it prints.
t.label = Slic3r::format(_u8L("T%1% -> filament %2%"), physical_head, t.filament_slot_1based);
return t;
}