Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Tobias Hunger
qt-creator
Commits
40546f9a
Commit
40546f9a
authored
Apr 20, 2009
by
Oswald Buddenhagen
Browse files
load translations
parent
067bab07
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/app/main.cpp
View file @
40546f9a
...
...
@@ -38,6 +38,9 @@
#include
<QtCore/QFileInfo>
#include
<QtCore/QDebug>
#include
<QtCore/QTimer>
#include
<QtCore/QLibraryInfo>
#include
<QtCore/QTranslator>
#include
<QtCore/QVariant>
#include
<QtGui/QMessageBox>
#include
<QtGui/QApplication>
...
...
@@ -197,6 +200,12 @@ static inline QStringList getPluginPaths()
return
rc
;
}
#ifdef Q_OS_MAC
# define SHARE_PATH "/../Resources"
#else
# define SHARE_PATH "/../share/qtcreator"
#endif
int
main
(
int
argc
,
char
**
argv
)
{
#ifdef Q_OS_DARWIN
...
...
@@ -208,6 +217,23 @@ int main(int argc, char **argv)
#endif
SharedTools
::
QtSingleApplication
app
((
QLatin1String
(
appNameC
)),
argc
,
argv
);
QTranslator
translator
;
QTranslator
qtTranslator
;
const
QString
&
locale
=
QLocale
::
system
().
name
();
if
(
translator
.
load
(
QLatin1String
(
"qtcreator_"
)
+
locale
,
QCoreApplication
::
applicationDirPath
()
+
QLatin1String
(
SHARE_PATH
"/translations"
)))
{
if
(
qtTranslator
.
load
(
QLatin1String
(
"qt_"
)
+
locale
,
QLibraryInfo
::
location
(
QLibraryInfo
::
TranslationsPath
)))
{
app
.
installTranslator
(
&
translator
);
app
.
installTranslator
(
&
qtTranslator
);
app
.
setProperty
(
"qtc_locale"
,
locale
);
}
else
{
translator
.
load
(
QString
());
// unload()
}
}
// Load
ExtensionSystem
::
PluginManager
pluginManager
;
pluginManager
.
setFileExtension
(
QLatin1String
(
"pluginspec"
));
...
...
src/plugins/designer/formeditorplugin.cpp
View file @
40546f9a
...
...
@@ -44,9 +44,12 @@
#include
<coreplugin/coreconstants.h>
#include
<coreplugin/uniqueidmanager.h>
#include
<QtCore/QCoreApplication>
#include
<QtCore/QtPlugin>
#include
<QtCore/QDebug>
#include
<QtCore/QProcess>
#include
<QtCore/QLibraryInfo>
#include
<QtCore/QTranslator>
#ifdef CPP_ENABLED
# include <QtGui/QAction>
...
...
@@ -115,6 +118,14 @@ bool FormEditorPlugin::initialize(const QStringList &arguments, QString *error)
FormEditorW
::
ensureInitStage
(
FormEditorW
::
RegisterPlugins
);
}
QString
locale
=
qApp
->
property
(
"qtc_locale"
).
toString
();
if
(
!
locale
.
isEmpty
())
{
QTranslator
*
qtr
=
new
QTranslator
(
this
);
qtr
->
load
(
QLatin1String
(
"designer_"
)
+
locale
,
QLibraryInfo
::
location
(
QLibraryInfo
::
TranslationsPath
));
qApp
->
installTranslator
(
qtr
);
}
error
->
clear
();
return
true
;
}
...
...
src/plugins/help/helpplugin.cpp
View file @
40546f9a
...
...
@@ -58,6 +58,8 @@
#include
<QtCore/QSettings>
#include
<QtCore/QDir>
#include
<QtCore/QResource>
#include
<QtCore/QLibraryInfo>
#include
<QtCore/QTranslator>
#include
<QtGui/QAction>
#include
<QtGui/QShortcut>
#include
<QtGui/QSplitter>
...
...
@@ -129,6 +131,14 @@ bool HelpPlugin::initialize(const QStringList &arguments, QString *error)
QList
<
int
>
modecontext
;
modecontext
<<
m_core
->
uniqueIDManager
()
->
uniqueIdentifier
(
Constants
::
C_MODE_HELP
);
QString
locale
=
qApp
->
property
(
"qtc_locale"
).
toString
();
if
(
!
locale
.
isEmpty
())
{
QTranslator
*
qtr
=
new
QTranslator
(
this
);
qtr
->
load
(
QLatin1String
(
"assistant_"
)
+
locale
,
QLibraryInfo
::
location
(
QLibraryInfo
::
TranslationsPath
));
qApp
->
installTranslator
(
qtr
);
}
// FIXME shouldn't the help engine create the directory if it doesn't exist?
QFileInfo
fi
(
m_core
->
settings
()
->
fileName
());
QDir
directory
(
fi
.
absolutePath
()
+
"/qtcreator"
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment