feat(translate): keep translated subtitles next to the video so they load on reopen #14
@@ -255,6 +255,12 @@ void TranslationService::applyGlossaryEdits(const GlossaryStore::Glossary &previ
|
||||
if (m_lastTranslationPath.isEmpty() || !QFileInfo::exists(m_lastTranslationPath)) {
|
||||
return;
|
||||
}
|
||||
// A translation the user has edited since is theirs; leave it alone.
|
||||
const QString registryFile = TranslationStore::registryFile();
|
||||
TranslationStore::Registry registry = TranslationStore::load(registryFile);
|
||||
if (!TranslationStore::isOwned(registry, m_lastTranslationPath)) {
|
||||
return;
|
||||
}
|
||||
QFile file(m_lastTranslationPath);
|
||||
if (!file.open(QIODevice::ReadOnly)) {
|
||||
return;
|
||||
@@ -307,8 +313,6 @@ void TranslationService::applyGlossaryEdits(const GlossaryStore::Glossary &previ
|
||||
return;
|
||||
}
|
||||
// Still QtPotato's file, so a later translation may replace it.
|
||||
const QString registryFile = TranslationStore::registryFile();
|
||||
TranslationStore::Registry registry = TranslationStore::load(registryFile);
|
||||
TranslationStore::recordRewrite(registry, m_lastTranslationPath, data);
|
||||
TranslationStore::save(registryFile, registry);
|
||||
Q_EMIT translated(QUrl::fromLocalFile(m_lastTranslationPath), true);
|
||||
|
||||
Reference in new issue
Block a user