mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-27 23:34:06 +00:00
Merge pull request #151 from xiaoyifang/fix/embed-ts
revert embed translation
This commit is contained in:
commit
9ff0e77ffa
13
config.cc
13
config.cc
|
@ -2264,17 +2264,12 @@ QString getProgramDataDir() noexcept
|
|||
#endif
|
||||
}
|
||||
|
||||
QString getEmbedLocDir() noexcept
|
||||
{
|
||||
return ":/locale";
|
||||
}
|
||||
|
||||
QString getLocDir() noexcept
|
||||
{
|
||||
if ( QDir( getProgramDataDir() ).cd( "locale" ) )
|
||||
return getProgramDataDir() + "/locale";
|
||||
else
|
||||
return QCoreApplication::applicationDirPath() + "/locale";
|
||||
if ( QDir( getProgramDataDir() ).cd( "locale" ) )
|
||||
return getProgramDataDir() + "/locale";
|
||||
else
|
||||
return QCoreApplication::applicationDirPath() + "/locale";
|
||||
}
|
||||
|
||||
QString getHelpDir() noexcept
|
||||
|
|
|
@ -811,7 +811,6 @@ QString getUserQtCssFileName() ;
|
|||
QString getProgramDataDir() noexcept;
|
||||
|
||||
/// Returns the directory storing program localizized files (.qm).
|
||||
QString getEmbedLocDir() noexcept;
|
||||
QString getLocDir() noexcept;
|
||||
|
||||
/// Returns the directory storing program help files (.qch).
|
||||
|
|
|
@ -69,19 +69,18 @@ CONFIG += exceptions \
|
|||
stl \
|
||||
c++17 \
|
||||
lrelease \
|
||||
embed_translations \
|
||||
utf8_source \
|
||||
force_debug_info
|
||||
|
||||
mac {
|
||||
DEBUG:CONFIG += app_bundle
|
||||
CONFIG += app_bundle
|
||||
}
|
||||
|
||||
QM_FILES_RESOURCE_PREFIX = /locale/
|
||||
|
||||
QM_FILES_INSTALL_PATH = /locale/
|
||||
OBJECTS_DIR = build
|
||||
UI_DIR = build
|
||||
MOC_DIR = build
|
||||
#RCC_DIR = build
|
||||
RCC_DIR = build
|
||||
LIBS += -lz \
|
||||
-lbz2 \
|
||||
-llzo2
|
||||
|
@ -628,13 +627,38 @@ TRANSLATIONS += locale/ru_RU.ts \
|
|||
locale/jb_JB.ts \
|
||||
locale/hi_IN.ts \
|
||||
locale/ie_001.ts
|
||||
|
||||
# Build version file
|
||||
!isEmpty( hasGit ) {
|
||||
PRE_TARGETDEPS += $$PWD/version.txt
|
||||
}
|
||||
|
||||
# This makes qmake generate translations
|
||||
|
||||
|
||||
isEmpty(QMAKE_LRELEASE):QMAKE_LRELEASE = $$[QT_INSTALL_BINS]/lrelease
|
||||
|
||||
|
||||
# The *.qm files might not exist when qmake is run for the first time,
|
||||
# causing the standard install rule to be ignored, and no translations
|
||||
# will be installed. With this, we create the qm files during qmake run.
|
||||
!win32 {
|
||||
system($${QMAKE_LRELEASE} -silent $${_PRO_FILE_} 2> /dev/null)
|
||||
}
|
||||
else{
|
||||
system($${QMAKE_LRELEASE} -silent $${_PRO_FILE_})
|
||||
}
|
||||
|
||||
updateqm.input = TRANSLATIONS
|
||||
updateqm.output = locale/${QMAKE_FILE_BASE}.qm
|
||||
updateqm.commands = $$QMAKE_LRELEASE \
|
||||
${QMAKE_FILE_IN} \
|
||||
-qm \
|
||||
${QMAKE_FILE_OUT}
|
||||
updateqm.CONFIG += no_link
|
||||
QMAKE_EXTRA_COMPILERS += updateqm
|
||||
TS_OUT = $$TRANSLATIONS
|
||||
TS_OUT ~= s/.ts/.qm/g
|
||||
PRE_TARGETDEPS += $$TS_OUT
|
||||
|
||||
include( thirdparty/qtsingleapplication/src/qtsingleapplication.pri )
|
||||
|
||||
|
|
2
main.cc
2
main.cc
|
@ -399,7 +399,7 @@ int main( int argc, char ** argv )
|
|||
app.installTranslator( &qtTranslator );
|
||||
}
|
||||
|
||||
translator.load( Config::getEmbedLocDir() + "/" + localeName );
|
||||
translator.load( Config::getLocDir() + "/" + localeName );
|
||||
app.installTranslator( &translator );
|
||||
|
||||
QTranslator webengineTs;
|
||||
|
|
|
@ -41,7 +41,7 @@ Preferences::Preferences( QWidget * parent, Config::Class & cfg_ ):
|
|||
|
||||
// See which other translations do we have
|
||||
|
||||
QStringList availLocs = QDir( Config::getEmbedLocDir() ).entryList( QStringList( "*.qm" ),
|
||||
QStringList availLocs = QDir( Config::getLocDir() ).entryList( QStringList( "*.qm" ),
|
||||
QDir::Files );
|
||||
|
||||
// We need to sort by language name -- otherwise list looks really weird
|
||||
|
|
Loading…
Reference in a new issue