[App] Fix of untranslated first document's name (#7156)

* Change no need function newDocument("Unnamed") call to variant without parameter. "Unnamed" set in App newDocument function instead.
* Refactor New Document command to run without parameter.
* Translate new document's userName. Internal name = "Unnamed".
* Crowdin Add to updatets.py App.ts. Create new file App.ts
* Fix error where document name is set with one function parameter. In this situation set internal and user name to string variable. For default function call (without parameter) set internal name to Unnamed, userName = translate ("Unnamed")
This commit is contained in:
Kuzemko Alexsandr
2022-10-21 05:35:09 +03:00
committed by GitHub
parent 086de5430f
commit 2eb55d48c7
11 changed files with 43 additions and 11 deletions

View File

@@ -407,9 +407,13 @@ void Application::renameDocument(const char *OldName, const char *NewName)
Document* Application::newDocument(const char * Name, const char * UserName, bool createView, bool tempDoc)
{
bool defaultConstructor= false;
// get a valid name anyway!
if (!Name || Name[0] == '\0')
{
Name = "Unnamed";
defaultConstructor= true; //we have function call like newDocument();
}
string name = getUniqueDocumentName(Name, tempDoc);
// return the temporary document if it exists
@@ -424,7 +428,14 @@ Document* Application::newDocument(const char * Name, const char * UserName, boo
userName = UserName;
}
else {
userName = Name;
if (defaultConstructor) //we have function call newDocument() thus set internal name to "Unnamed" and userName to translated string "Unnamed"
{
QString L10nUserName = QObject::tr("Unnamed");
userName = L10nUserName.toStdString().c_str();
}
else {
userName = Name;
}
std::vector<std::string> names;
names.reserve(DocMap.size());
std::map<string,Document*>::const_iterator pos;