diff --git a/dialogs/preferencesdialog.cpp b/dialogs/preferencesdialog.cpp index 2e5e8ef81..b9218eda1 100644 --- a/dialogs/preferencesdialog.cpp +++ b/dialogs/preferencesdialog.cpp @@ -384,17 +384,24 @@ void PreferencesDialog::setup_ui() { language_combobox->addItem(QLocale::languageToString(QLocale("en-US").language())); // add languages from file - QDir translation_dir(QApplication::applicationDirPath().append("/ts")); - QStringList translation_files = translation_dir.entryList({"*.qm"}, QDir::Files | QDir::NoDotAndDotDot); - for (int i=0;iaddItem(QLocale(locale_str).nativeLanguageName(), locale_full_path); + QList translation_paths = get_language_paths(); - if (config.language_file == locale_full_path) { - language_combobox->setCurrentIndex(language_combobox->count() - 1); + // iterate through all language search paths + for (int j=0;jaddItem(QLocale(locale_str).nativeLanguageName(), locale_full_path); + + if (config.language_file == locale_full_path) { + language_combobox->setCurrentIndex(language_combobox->count() - 1); + } + } } } diff --git a/io/path.cpp b/io/path.cpp index 1c7ba4b67..dc5b26a89 100644 --- a/io/path.cpp +++ b/io/path.cpp @@ -44,3 +44,12 @@ QString get_file_hash(const QString& filename) { QString cache_file = filename.mid(filename.lastIndexOf('/')+1) + QString::number(file_info.size()) + QString::number(file_info.lastModified().toMSecsSinceEpoch()); return QCryptographicHash::hash(cache_file.toUtf8(), QCryptographicHash::Md5).toHex(); } + +QList get_language_paths() { + QList language_paths; + language_paths.append(get_app_dir() + "/ts"); + language_paths.append(get_app_dir() + "/../share/olive-editor/ts"); + QString env_path(qgetenv("OLIVE_LANG_PATH")); + if (!env_path.isEmpty()) language_paths.append(env_path); + return language_paths; +} diff --git a/io/path.h b/io/path.h index 2a721c0fd..67771b330 100644 --- a/io/path.h +++ b/io/path.h @@ -7,6 +7,7 @@ QString get_app_dir(); QString get_data_path(); QString get_config_path(); QList get_effects_paths(); +QList get_language_paths(); // generate hash algorithm used to uniquely identify files QString get_file_hash(const QString& filename); diff --git a/main.cpp b/main.cpp index 434a62113..bae67df3e 100644 --- a/main.cpp +++ b/main.cpp @@ -43,6 +43,11 @@ int main(int argc, char *argv[]) { "\t--no-debug\t\tDisable internal debug log and output directly to console\n" "\t--disable-blend-modes\tDisable shader-based blending for older GPUs\n" "\t--translation \tSet an external language file to use\n" + "\n" + "Environment Variables:\n" + "\tOLIVE_EFFECTS_PATH\tSpecify a path to search for GLSL shader effects\n" + "\tFREI0R_PATH\t\tSpecify a path to search for Frei0r effects\n" + "\tOLIVE_LANG_PATH\t\tSpecify a path to search for translation files\n" "\n", argv[0]); return 0; } else if (!strcmp(argv[i], "--fullscreen") || !strcmp(argv[i], "-f")) {