Make the cable feature speak English like the rest of the interface

English has been the source language of the program for a while now
(upstream: "Make English the source language ..."), the cable feature
came in with French ones: about 200 translatable strings over 30 files,
the two settings pages built from .ui files, four comments and one test
which asserted the old wording (blocking review comment by ispyisail).

The wording follows what the code base already uses where it exists:
Plant (=) and Location (+) as qetinformation.cpp names those element
information, Designation for the field the cable form calls its BMK,
Length, Sheet for folio, Automatic numbering, Cross-reference, and Right
aligned / Centred / Left aligned the way cabletextformatdialog.cpp
already spells the three alignment entries.

Two things are more than a word-for-word swap:

- xrefpropertieswidget.cpp:291 wrote the label of the master field on
  every type change with a hardcoded tr("Maitre"), so the English
  "Master" coming from the .ui was overwritten for every type, cable or
  not: a real bug next to being French. The wording now comes back from
  the .ui and only a cable renames the field to "Text:", so the two
  cannot drift apart again.

- tst_cabletypelist kept asserting that a new catalogue is *labelled*
  in French. That label line is the translated header and reads English
  now. The test still reads files with French headers on purpose:
  headerAliasMap() keeps the five old French labels as aliases next to
  the English ones, so catalogues written by earlier builds, including
  the one the reviewer reads her own types from, keep loading.

The .ts files are deliberately not regenerated here. Upstream
regenerates them on master, as it did for the language change itself,
and a translation is keyed on the source string: while the sources were
French a German user saw French in the cable dialogs, and an English
source string with no translation yet shows as it is.

Build clean, ctest 92/93, the one failure being the pre-existing
headless tst_menubarkeyboard.
This commit is contained in:
Kellermorph
2026-10-10 13:48:45 +02:00
parent 3f23e3dd2b
commit 9771ca96c9
30 changed files with 375 additions and 350 deletions
+11 -6
View File
@@ -133,13 +133,16 @@ void XRefPropertiesWidget::setReadOnly(bool ro) {
*/
void XRefPropertiesWidget::buildUi()
{
//Wording of the master label as the .ui wrote it, kept to put it
//back for every type which does not rename it.
m_master_label_text = ui->label_6->text();
ui -> m_type_cb -> addItem(tr("Coil"), "coil");
ui -> m_type_cb -> addItem(tr("Organ of protection"), "protection");
ui -> m_type_cb -> addItem(tr("Switch / button"), "commutator");
ui -> m_type_cb -> addItem(tr("Programmable Logic Controller (PLC)"), "plc");
//Not an element: the type of the cross references a cable writes
//in its own label when it runs on several folios.
ui -> m_type_cb -> addItem(tr("Câble"), "cable");
ui -> m_type_cb -> addItem(tr("Cable"), "cable");
ui -> m_snap_to_cb -> addItem(tr("Footer"), "bottom");
ui -> m_snap_to_cb -> addItem(tr("Under the label of the element"), "label");
@@ -288,7 +291,9 @@ void XRefPropertiesWidget::updateDisplay()
ui->m_display_gb->setVisible(!is_cable);
ui->label_7->setVisible(!is_cable);
ui->m_slave_le->setVisible(!is_cable);
ui->label_6->setText(is_cable ? tr("Texte :") : tr("Maitre"));
//The wording of every type which is not a cable comes back from
//the .ui, so the label cannot drift away from the designer one.
ui->label_6->setText(is_cable ? tr("Text:") : m_master_label_text);
//Only a cable writes its reference into its own label, so only a
//cable has a text whose font to choose here: the cross references
@@ -296,13 +301,13 @@ void XRefPropertiesWidget::updateDisplay()
ui->m_font_pb->setVisible(is_cable);
if (m_current_font.isEmpty())
{
ui->m_font_pb->setToolTip(tr("Police et taille : celles des textes de câble"));
ui->m_font_pb->setToolTip(tr("Font and size: those of the cable texts"));
}
else
{
QFont font;
if (QETUtils::fontFromString(font, m_current_font)) {
ui->m_font_pb->setToolTip(tr("Police et taille : %1, %2 pt")
ui->m_font_pb->setToolTip(tr("Font and size: %1, %2 pt")
.arg(font.family()).arg(font.pointSizeF()));
}
}
@@ -361,10 +366,10 @@ void XRefPropertiesWidget::chooseXRefFont()
bool ok = false;
const QFont font = QFontDialog::getFont(&ok, initial, this,
tr("Police du texte de querverweis"));
tr("Font of the cross-reference text"));
if (!ok) return;
m_current_font = QETUtils::fontToString(font);
ui->m_font_pb->setToolTip(tr("Police et taille : %1, %2 pt")
ui->m_font_pb->setToolTip(tr("Font and size: %1, %2 pt")
.arg(font.family()).arg(font.pointSizeF()));
}