本文整理汇总了C++中Locale::languagename方法的典型用法代码示例。如果您正苦于以下问题:C++ Locale::languagename方法的具体用法?C++ Locale::languagename怎么用?C++ Locale::languagename使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Locale
的用法示例。
在下文中一共展示了Locale::languagename方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: run
void UserTaskDeadlineEmailGenerator::run()
{
qDebug() << "EmailGenerator: Generating UserClaimedTaskDeadlinePassed email";
UserClaimedTaskDeadlinePassed email_message;
email_message.ParseFromString(this->protoBody.toStdString());
ConfigParser settings;
QString error = "";
QSharedPointer<Email> email = QSharedPointer<Email>(new Email);
QSharedPointer<User> user = QSharedPointer<User>();
QSharedPointer<Task> task = QSharedPointer<Task>();
QSharedPointer<MySQLHandler> db = MySQLHandler::getInstance();
user = UserDao::getUser(db, email_message.translator_id());
task = TaskDao::getTask(db, email_message.task_id());
if(!user || !task) {
error = "Failed to generate UserClaimedTaskDeadlinePassed email: Unable to find relevant ";
error += "data in the Database. Searched for User ID ";
error += QString::number(email_message.translator_id()) + " and Task ID ";
error += QString::number(email_message.task_id()) + ".";
}
if(error.compare("") == 0) {
ctemplate::TemplateDictionary dict("user_claimed_task_deadline_exceeded");
if(user->display_name() != "") {
dict.ShowSection("USER_HAS_NAME");
dict.SetValue("USERNAME", user->display_name());
} else {
dict.ShowSection("NO_USER_NAME");
}
dict.SetValue("TASK_TITLE", task->title());
dict.SetValue("SITE_NAME", settings.get("site.name").toStdString());
QString task_type = "Translation";
switch(task->tasktype())
{
case 1:
task_type = "Segmentation";
break;
case 2:
task_type = "Translation";
break;
case 3:
task_type = "Proofreading";
break;
case 4:
task_type = "Desegmentation";
break;
}
dict.SetValue("TASK_TYPE", task_type.toStdString());
Locale taskSourceLocale = task->sourcelocale();
Locale taskTargetLocale = task->targetlocale();
dict.SetValue("SOURCE_LANGUAGE",taskSourceLocale.languagename());
dict.SetValue("TARGET_LANGUAGE",taskTargetLocale.languagename());
bool footer_enabled=(QString::compare("y", settings.get("email-footer.enabled")) == 0);
if (footer_enabled)
{
QString donate_link = settings.get("email-footer.donate_link");
ctemplate::TemplateDictionary* footer_dict = dict.AddIncludeDictionary("FOOTER");
QString footer_location = QString(TEMPLATE_DIRECTORY) + "emails/footer.tpl";
footer_dict -> SetValue("DONATE_LINK",donate_link.toStdString());
footer_dict -> SetFilename(footer_location.toStdString());
}
std::string email_body;
QString template_location = QString(TEMPLATE_DIRECTORY) + "emails/user-claimed-task-deadline-passed.tpl";
ctemplate::ExpandTemplate(template_location.toStdString(), ctemplate::DO_NOT_STRIP, &dict, &email_body);
email->setSender(settings.get("site.system_email_address"));;
email->addRecipient(QString::fromStdString(user->email()));
email->setSubject(settings.get("site.name") + ": Task Deadline Passed");
email->setBody(QString::fromUtf8(email_body.c_str()));
} else {
email = this->generateErrorEmail(error);
}
this->emailQueue->insert(email, currentMessage);
}
示例2: run
void TrackedTaskUploadedEmailGenerator::run()
{
qDebug() << "EmailGenerator - Generating TrackedTaskUploaded email";
TrackedTaskUploaded email_message;
email_message.ParseFromString(this->protoBody.toStdString());
ConfigParser settings;
QString error = "";
QSharedPointer<Email> email = QSharedPointer<Email>(new Email());
QSharedPointer<MySQLHandler> db = MySQLHandler::getInstance();
QSharedPointer<User> user = UserDao::getUser(db, email_message.user_id());
QSharedPointer<User> translator = UserDao::getUser(db, email_message.translator_id());
QSharedPointer<Task> task = TaskDao::getTask(db, email_message.task_id());
QSharedPointer<Project> project = QSharedPointer<Project>();
QSharedPointer<Organisation> org = QSharedPointer<Organisation>();
if(user.isNull() || translator.isNull() || task.isNull()) {
error = "Failed to generate task translation uploaded email. Unable ";
error += "to find relevant inforamtion in the Database. Searched for ";
error += "User ID " + QString::number(email_message.user_id()) + ", ";
error += "Translator ID " + QString::number(email_message.translator_id());
error += " and task and project identified by task ID ";
error += QString::number(email_message.task_id()) + ".";
} else {
project = ProjectDao::getProject(db, task->projectid());
if (project.isNull()) {
error = "Failed to generate task translation uploaded email. Unable ";
error += "to find relevant inforamtion in the Database. Could not find ";
error += "project with ID " + QString::number(task->projectid());
} else {
org = OrganisationDao::getOrg(db, project->organisationid());
if(org.isNull()) {
error = "Failed to generate task translation uploaded email. Unable ";
error += "to find relevant inforamtion in the Database. Could not find ";
error += "Organisation with ID " + QString::number(project->organisationid()) + ".";
}
}
}
if(error.compare("") == 0) {
ctemplate::TemplateDictionary dict("tracked-task-uploaded");
dict.SetValue("USERNAME", user->display_name());
dict.SetValue("TRANSLATOR_NAME", translator->display_name());
dict.SetValue("TASK_TITLE", task->title());
dict.SetValue("ORG_NAME", org->name());
dict.SetValue("SITE_NAME", settings.get("site.name").toStdString());
QString task_type = "Translation";
switch(task->tasktype())
{
case 1:
task_type = "Segmentation";
break;
case 2:
task_type = "Translation";
break;
case 3:
task_type = "Proofreading";
break;
case 4:
task_type = "Desegmentation";
break;
}
dict.SetValue("TASK_TYPE", task_type.toStdString());
Locale taskSourceLocale = task->sourcelocale();
Locale taskTargetLocale = task->targetlocale();
dict.SetValue("SOURCE_LANGUAGE",taskSourceLocale.languagename());
dict.SetValue("TARGET_LANGUAGE",taskTargetLocale.languagename());
QString reviewUrl = settings.get("site.url");
reviewUrl += "org/" + QString::number(org->id()) + "/task/" + QString::number(task->id()) + "/review";
dict.SetValue("TASK_REVIEW", reviewUrl.toStdString());
QString dash_url = settings.get("site.url");
dash_url += "org/dashboard";
dict.SetValue("DASHBOARD_URL", dash_url.toStdString());
QString taskView = settings.get("site.url");
taskView += "task/" + QString::number(task->id()) + "/view";
dict.SetValue("TASK_VIEW", taskView.toStdString());
QString projectView = settings.get("site.url");
projectView += "project/" + QString::number(task->projectid()) + "/view";
dict.SetValue("PROJECT_VIEW", projectView.toStdString());
bool footer_enabled=(QString::compare("y", settings.get("email-footer.enabled")) == 0);
if (footer_enabled)
{
QString donate_link = settings.get("email-footer.donate_link");
ctemplate::TemplateDictionary* footer_dict = dict.AddIncludeDictionary("FOOTER");
QString footer_location = QString(TEMPLATE_DIRECTORY) + "emails/footer.tpl";
footer_dict -> SetValue("DONATE_LINK",donate_link.toStdString());
//.........这里部分代码省略.........
开发者ID:TheRosettaFoundation,项目名称:SOLAS-Match-Backend,代码行数:101,代码来源:TrackedTaskUploadedEmailGenerator.cpp
示例3: run
void OrgTaskRevokedGenerator::run()
{
qDebug() << "Email Generator - Generating OrgTaskRevokedEmail";
OrgTaskRevokedEmail emailMessage;
emailMessage.ParseFromString(this->protoBody.toStdString());
ConfigParser settings;
QSharedPointer<Email> email = QSharedPointer<Email>(new Email());
QSharedPointer<MySQLHandler> db = MySQLHandler::getInstance();
QSharedPointer<User> user = UserDao::getUser(db, emailMessage.user_id());
QSharedPointer<Task> task = TaskDao::getTask(db, emailMessage.task_id());
QSharedPointer<User> claimant = UserDao::getUser(db, emailMessage.claimant_id());
QString error = "";
if (user.isNull() || task.isNull() || claimant.isNull()) {
error = "Unable to generate OrgTaskRevokedEmail. Unable to find relevant data in the database. ";
error += "Searched for user ids " + QString::number(emailMessage.user_id()) + " and ";
error += QString::number(emailMessage.claimant_id()) + " and task id ";
error += QString::number(emailMessage.task_id()) + ".";
}
if (error.compare("") == 0) {
ctemplate::TemplateDictionary dict("OrgTaskRevoked");
dict.SetValue("USERNAME", user->display_name());
dict.SetValue("TASK_TITLE", task->title());
QString taskView = settings.get("site.url") + "task/" + QString::number(task->id()) + "/view";
dict.SetValue("TASK_VIEW", taskView.toStdString());
QString userProfile = settings.get("site.url") + QString::number(claimant->id()) + "/profile";
dict.SetValue("USER_PROFILE", userProfile.toStdString());
dict.SetValue("CLAIMANT_NAME", claimant->display_name());
dict.SetValue("SITE_NAME", settings.get("site.name").toStdString());
QString task_type = "Translation";
switch(task->tasktype())
{
case 1:
task_type = "Segmentation";
break;
case 2:
task_type = "Translation";
break;
case 3:
task_type = "Proofreading";
break;
case 4:
task_type = "Desegmentation";
break;
}
dict.SetValue("TASK_TYPE", task_type.toStdString());
Locale taskSourceLocale = task->sourcelocale();
Locale taskTargetLocale = task->targetlocale();
dict.SetValue("SOURCE_LANGUAGE",taskSourceLocale.languagename());
dict.SetValue("TARGET_LANGUAGE",taskTargetLocale.languagename());
bool footer_enabled=(QString::compare("y", settings.get("email-footer.enabled")) == 0);
if (footer_enabled)
{
QString donate_link = settings.get("email-footer.donate_link");
ctemplate::TemplateDictionary* footer_dict = dict.AddIncludeDictionary("FOOTER");
QString footer_location = QString(TEMPLATE_DIRECTORY) + "emails/footer.tpl";
footer_dict -> SetValue("DONATE_LINK",donate_link.toStdString());
footer_dict -> SetFilename(footer_location.toStdString());
}
std::string email_body;
QString template_location = QString(TEMPLATE_DIRECTORY) + "emails/org-task-revoked.tpl";
ctemplate::ExpandTemplate(template_location.toStdString(), ctemplate::DO_NOT_STRIP, &dict, &email_body);
email->setSender(settings.get("site.system_email_address"));
email->addRecipient(QString::fromStdString(user->email()));
email->setSubject(settings.get("site.name") + ": Task Revoked");
email->setBody(QString::fromUtf8(email_body.c_str()));
} else {
email = this->generateErrorEmail(error);
}
this->emailQueue->insert(email, currentMessage);
}