| 40 | } |
| 41 | |
| 42 | void Language::initialize() |
| 43 | { |
| 44 | if (!documents::languageGlobal.isEmpty()) { |
| 45 | return; |
| 46 | } |
| 47 | |
| 48 | QJsonParseError err; |
| 49 | QFile file(globalPath()); |
| 50 | if (file.open(QFile::ReadOnly)) { |
| 51 | auto data = file.readAll(); |
| 52 | documents::languageGlobal = QJsonDocument::fromJson(data, &err); |
| 53 | file.close(); |
| 54 | } |
| 55 | |
| 56 | if (documents::languageGlobal.isEmpty()) { |
| 57 | CommonDialog::ok(QObject::tr("The format of the language configuration file is incorrect or damaged. " |
| 58 | "Check that the file is released correctly. " |
| 59 | "If it cannot be solved, reinstall the software to solve the problem")); |
| 60 | qCritical() << QString("Failed, %0 jsonDoc is Empty. ").arg(globalPath()) |
| 61 | + "errorString: " + err.errorString(); |
| 62 | abort(); |
| 63 | } |
| 64 | } |
| 65 | |
| 66 | bool Language::recovery() |
| 67 | { |