mirror of
https://gitee.com/vnotex/vnote.git
synced 2025-07-05 13:59:52 +08:00
bug-fix: use en locale for help docs if user's locale is missing
This commit is contained in:
parent
ec0b98f050
commit
97721f3e92
@ -1143,9 +1143,9 @@ QWebEngineView *VUtils::getWebEngineView(QWidget *p_parent)
|
||||
return viewer;
|
||||
}
|
||||
|
||||
QString VUtils::getFileNameWithLocale(const QString &p_name)
|
||||
QString VUtils::getFileNameWithLocale(const QString &p_name, const QString &p_locale)
|
||||
{
|
||||
QString locale = getLocale();
|
||||
QString locale = p_locale.isEmpty() ? getLocale() : p_locale;
|
||||
locale = locale.split('_')[0];
|
||||
|
||||
QFileInfo fi(p_name);
|
||||
@ -1162,7 +1162,12 @@ QString VUtils::getFileNameWithLocale(const QString &p_name)
|
||||
QString VUtils::getDocFile(const QString &p_name)
|
||||
{
|
||||
QDir dir(VNote::c_docFileFolder);
|
||||
return dir.filePath(getFileNameWithLocale(p_name));
|
||||
QString name(getFileNameWithLocale(p_name));
|
||||
if (!dir.exists(name)) {
|
||||
name = getFileNameWithLocale(p_name, "en_US");
|
||||
}
|
||||
|
||||
return dir.filePath(name);
|
||||
}
|
||||
|
||||
QString VUtils::getCaptainShortcutSequenceText(const QString &p_operation)
|
||||
|
@ -279,8 +279,10 @@ public:
|
||||
|
||||
static void setDynamicProperty(QWidget *p_widget, const char *p_prop, bool p_val = true);
|
||||
|
||||
// Return a file name with locale.
|
||||
static QString getFileNameWithLocale(const QString &p_name);
|
||||
// Return a file name with locale @p_locale.
|
||||
// If @p_locale is empty, use system's locale instead.
|
||||
static QString getFileNameWithLocale(const QString &p_name,
|
||||
const QString &p_locale = QString());
|
||||
|
||||
// Return a doc file path.
|
||||
static QString getDocFile(const QString &p_name);
|
||||
|
Loading…
x
Reference in New Issue
Block a user