TD: Translate default labels
This commit is contained in:
committed by
WandererFan
parent
54bb9c9c62
commit
94426e1f54
@@ -135,7 +135,9 @@ TechDraw::DrawViewImage* TaskActiveView::createActiveView()
|
||||
}
|
||||
|
||||
//we are sure we have a 3D window!
|
||||
std::string imageName = m_pageFeat->getDocument()->getUniqueObjectName("ActiveView");
|
||||
const std::string objectName{QT_TR_NOOP("ActiveView")};
|
||||
std::string imageName = m_pageFeat->getDocument()->getUniqueObjectName(objectName.c_str());
|
||||
std::string generatedSuffix {imageName.substr(objectName.length())};
|
||||
std::string imageType = "TechDraw::DrawViewImage";
|
||||
|
||||
std::string pageName = m_pageFeat->getNameInDocument();
|
||||
@@ -210,6 +212,9 @@ TechDraw::DrawViewImage* TaskActiveView::createActiveView()
|
||||
}
|
||||
}
|
||||
|
||||
std::string translatedObjectName{tr("ActiveView").toStdString()};
|
||||
newObj->Label.setValue(translatedObjectName + generatedSuffix);
|
||||
|
||||
return newImg;
|
||||
}
|
||||
|
||||
|
||||
@@ -556,7 +556,9 @@ void TaskComplexSection::createComplexSection()
|
||||
|
||||
Gui::Command::openCommand(QT_TRANSLATE_NOOP("Command", "Create ComplexSection"));
|
||||
if (!m_section) {
|
||||
m_sectionName = m_page->getDocument()->getUniqueObjectName("ComplexSection");
|
||||
const std::string objectName{QT_TR_NOOP("ComplexSection")};
|
||||
std::string imageName = m_page->getDocument()->getUniqueObjectName(objectName.c_str());
|
||||
std::string generatedSuffix {imageName.substr(objectName.length())};
|
||||
std::string sectionType = "TechDraw::DrawComplexSection";
|
||||
|
||||
Command::doCommand(Command::Doc, "App.ActiveDocument.addObject('%s', '%s')",
|
||||
@@ -625,6 +627,9 @@ void TaskComplexSection::createComplexSection()
|
||||
double rotation = requiredRotation(viewDirectionAngle);
|
||||
Command::doCommand(Command::Doc, "App.ActiveDocument.%s.Rotation = %.6f",
|
||||
m_sectionName.c_str(), rotation);
|
||||
|
||||
std::string translatedObjectName{tr(objectName.c_str()).toStdString()};
|
||||
newObj->Label.setValue(translatedObjectName + generatedSuffix);
|
||||
}
|
||||
Gui::Command::commitCommand();
|
||||
}
|
||||
|
||||
@@ -434,7 +434,9 @@ void TaskDetail::createDetail()
|
||||
// Base::Console().Message("TD::createDetail()\n");
|
||||
Gui::Command::openCommand(QT_TRANSLATE_NOOP("Command", "Create Detail View"));
|
||||
|
||||
m_detailName = m_doc->getUniqueObjectName("Detail");
|
||||
const std::string objectName{QT_TR_NOOP("Detail")};
|
||||
std::string m_detailName = m_doc->getUniqueObjectName(objectName.c_str());
|
||||
std::string generatedSuffix {m_detailName.substr(objectName.length())};
|
||||
|
||||
Gui::Command::doCommand(Command::Doc, "App.activeDocument().addObject('TechDraw::DrawViewDetail', '%s')",
|
||||
m_detailName.c_str());
|
||||
@@ -458,6 +460,9 @@ void TaskDetail::createDetail()
|
||||
Gui::Command::doCommand(Command::Doc, "App.activeDocument().%s.addView(App.activeDocument().%s)",
|
||||
m_pageName.c_str(), m_detailName.c_str());
|
||||
|
||||
std::string translatedObjectName{tr(objectName.c_str()).toStdString()};
|
||||
docObj->Label.setValue(translatedObjectName + generatedSuffix);
|
||||
|
||||
Gui::Command::updateActive();
|
||||
Gui::Command::commitCommand();
|
||||
|
||||
|
||||
@@ -195,9 +195,12 @@ void TaskHatch::createHatch()
|
||||
{
|
||||
// Base::Console().Message("TH::createHatch()\n");
|
||||
App::Document* doc = m_dvp->getDocument();
|
||||
std::string FeatName = doc->getUniqueObjectName("Hatch");
|
||||
const std::string objectName{QT_TR_NOOP("Hatch")};
|
||||
std::string FeatName = doc->getUniqueObjectName(objectName.c_str());
|
||||
std::string generatedSuffix {FeatName.substr(objectName.length())};
|
||||
std::string translatedObjectName{tr(objectName.c_str()).toStdString()};
|
||||
std::stringstream featLabel;
|
||||
featLabel << FeatName << "F" <<
|
||||
featLabel << translatedObjectName << generatedSuffix << "F" <<
|
||||
TechDraw::DrawUtil::getIndexFromName(m_subs.at(0)); //use 1st face# for label
|
||||
|
||||
Command::openCommand(QT_TRANSLATE_NOOP("Command", "Create Hatch"));
|
||||
|
||||
@@ -335,7 +335,9 @@ void TaskLeaderLine::onLineStyleChanged()
|
||||
void TaskLeaderLine::createLeaderFeature(std::vector<Base::Vector3d> converted)
|
||||
{
|
||||
// Base::Console().Message("TTL::createLeaderFeature()\n");
|
||||
m_leaderName = m_basePage->getDocument()->getUniqueObjectName("LeaderLine");
|
||||
const std::string objectName{QT_TR_NOOP("LeaderLine")};
|
||||
std::string m_leaderName = m_basePage->getDocument()->getUniqueObjectName(objectName.c_str());
|
||||
std::string generatedSuffix {m_leaderName.substr(objectName.length())};
|
||||
m_leaderType = "TechDraw::DrawLeaderLine";
|
||||
|
||||
std::string PageName = m_basePage->getNameInDocument();
|
||||
@@ -377,6 +379,9 @@ void TaskLeaderLine::createLeaderFeature(std::vector<Base::Vector3d> converted)
|
||||
}
|
||||
}
|
||||
|
||||
std::string translatedObjectName{tr(objectName.c_str()).toStdString()};
|
||||
obj->Label.setValue(translatedObjectName + generatedSuffix);
|
||||
|
||||
Gui::Command::updateActive();
|
||||
Gui::Command::commitCommand();
|
||||
|
||||
|
||||
@@ -280,7 +280,9 @@ App::Color TaskRichAnno::prefLineColor()
|
||||
void TaskRichAnno::createAnnoFeature()
|
||||
{
|
||||
// Base::Console().Message("TRA::createAnnoFeature()");
|
||||
std::string annoName = m_basePage->getDocument()->getUniqueObjectName("RichTextAnnotation");
|
||||
const std::string objectName{QT_TR_NOOP("RichTextAnnotation")};
|
||||
std::string annoName = m_basePage->getDocument()->getUniqueObjectName(objectName.c_str());
|
||||
std::string generatedSuffix {annoName.substr(objectName.length())};
|
||||
std::string annoType = "TechDraw::DrawRichAnno";
|
||||
|
||||
std::string PageName = m_basePage->getNameInDocument();
|
||||
@@ -326,6 +328,9 @@ void TaskRichAnno::createAnnoFeature()
|
||||
}
|
||||
}
|
||||
|
||||
std::string translatedObjectName{tr(objectName.c_str()).toStdString()};
|
||||
obj->Label.setValue(translatedObjectName + generatedSuffix);
|
||||
|
||||
Gui::Command::commitCommand();
|
||||
Gui::Command::updateActive();
|
||||
|
||||
|
||||
@@ -500,7 +500,9 @@ TechDraw::DrawViewSection* TaskSectionView::createSectionView(void)
|
||||
|
||||
Gui::Command::openCommand(QT_TRANSLATE_NOOP("Command", "Create SectionView"));
|
||||
if (!m_section) {
|
||||
m_sectionName = m_base->getDocument()->getUniqueObjectName("SectionView");
|
||||
const std::string objectName{QT_TR_NOOP("SectionView")};
|
||||
std::string m_sectionName = m_base->getDocument()->getUniqueObjectName(objectName.c_str());
|
||||
std::string generatedSuffix {m_sectionName.substr(objectName.length())};
|
||||
std::string sectionType = "TechDraw::DrawViewSection";
|
||||
|
||||
Command::doCommand(Command::Doc, "App.ActiveDocument.addObject('%s', '%s')",
|
||||
@@ -545,6 +547,9 @@ TechDraw::DrawViewSection* TaskSectionView::createSectionView(void)
|
||||
double rotation = requiredRotation(viewDirectionAngle);
|
||||
Command::doCommand(Command::Doc, "App.ActiveDocument.%s.Rotation = %.6f",
|
||||
m_sectionName.c_str(), rotation);
|
||||
|
||||
std::string translatedObjectName{tr(objectName.c_str()).toStdString()};
|
||||
newObj->Label.setValue(translatedObjectName + generatedSuffix);
|
||||
}
|
||||
Gui::Command::commitCommand();
|
||||
return m_section;
|
||||
|
||||
@@ -457,7 +457,10 @@ TechDraw::DrawWeldSymbol* TaskWeldingSymbol::createWeldingSymbol()
|
||||
{
|
||||
// Base::Console().Message("TWS::createWeldingSymbol()\n");
|
||||
|
||||
std::string symbolName = m_leadFeat->getDocument()->getUniqueObjectName("WeldSymbol");
|
||||
const std::string objectName{QT_TR_NOOP("SectionView")};
|
||||
std::string symbolName = m_leadFeat->getDocument()->getUniqueObjectName(objectName.c_str());
|
||||
std::string generatedSuffix {symbolName.substr(objectName.length())};
|
||||
|
||||
std::string symbolType = "TechDraw::DrawWeldSymbol";
|
||||
|
||||
TechDraw::DrawPage* page = m_leadFeat->findParentPage();
|
||||
@@ -495,6 +498,9 @@ TechDraw::DrawWeldSymbol* TaskWeldingSymbol::createWeldingSymbol()
|
||||
if (!newObj || !newSym)
|
||||
throw Base::RuntimeError("TaskWeldingSymbol - new symbol object not found");
|
||||
|
||||
std::string translatedObjectName{tr(objectName.c_str()).toStdString()};
|
||||
newObj->Label.setValue(translatedObjectName + generatedSuffix);
|
||||
|
||||
return newSym;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user