mirror of
https://github.com/kotatogram/kotatogram-desktop
synced 2025-08-31 14:45:14 +00:00
Fill only English and currently used default JSON (if there are any)
This commit is contained in:
@@ -72,6 +72,7 @@
|
||||
<file alias="kotatogramdesktop.desktop">../../../../lib/xdg/kotatogramdesktop.desktop</file>
|
||||
</qresource>
|
||||
<qresource prefix="/ktg_lang">
|
||||
<file alias="en.json">../../langs/rewrites/en.json</file>
|
||||
<file alias="ru.json">../../langs/rewrites/ru.json</file>
|
||||
<file alias="uk.json">../../langs/rewrites/uk.json</file>
|
||||
<file alias="tr.json">../../langs/rewrites/tr.json</file>
|
||||
|
@@ -566,9 +566,15 @@ void Instance::fillDefaultJson() {
|
||||
if (!QDir().exists(jsonLangDir())) QDir().mkpath(jsonLangDir());
|
||||
|
||||
const auto langs = QDir(":/ktg_lang").entryList(QStringList() << "*.json", QDir::Files);
|
||||
auto neededLangs = QStringList() << "en" << id() << baseId();
|
||||
neededLangs.removeDuplicates();
|
||||
|
||||
for (auto language : langs) {
|
||||
language.chop(5);
|
||||
if (!neededLangs.contains(language)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
const auto path = jsonLangDir() + language + ".default.json";
|
||||
const auto pathRaw = jsonLangDir() + language + "-raw.default.json";
|
||||
auto input = QFile(qsl(":/ktg_lang/%1.json").arg(language));
|
||||
@@ -581,7 +587,7 @@ void Instance::fillDefaultJson() {
|
||||
output.close();
|
||||
}
|
||||
|
||||
if (outputRaw.open(QIODevice::WriteOnly)) {
|
||||
if (language != qstr("en") && outputRaw.open(QIODevice::WriteOnly)) {
|
||||
outputRaw.write(inputData);
|
||||
outputRaw.close();
|
||||
}
|
||||
|
Reference in New Issue
Block a user