[TD]add label translation for Page and Template

This commit is contained in:
wandererfan
2023-08-17 17:26:08 -04:00
committed by WandererFan
parent 414e06d54d
commit 49a9442d61
14 changed files with 152 additions and 21 deletions

View File

@@ -61,6 +61,7 @@
#include <Base/FileInfo.h>
#include <Base/Parameter.h>
#include <Base/Stream.h>
#include <Base/Tools.h>
#include <Base/UnitsApi.h>
#include <Base/Vector3D.h>
@@ -1594,6 +1595,18 @@ void DrawUtil::copyFile(std::string inSpec, std::string outSpec)
}
}
//! static method that provides a translated std::string for objects that are not derived from DrawView
std::string DrawUtil::translateArbitrary(std::string context, std::string baseName, std::string uniqueName)
{
std::string suffix("");
if (uniqueName.length() > baseName.length()) {
suffix = uniqueName.substr(baseName.length(), uniqueName.length() - baseName.length());
}
QString qTranslated = qApp->translate(context.c_str(), baseName.c_str());
std::string ssTranslated = Base::Tools::toStdString(qTranslated);
return ssTranslated + suffix;
}
//============================
// various debugging routines.