Added support for translations.

This commit is contained in:
leo 2014-09-15 23:41:46 +00:00
parent 7c7b461fb0
commit 34de3928b6
5 changed files with 1488 additions and 2 deletions

View file

@ -965,7 +965,8 @@ bool Project::OnOpenDocument(const char* lpszPathName)
return false; return false;
} }
LoadLDraw(QTextStream(&File)); QTextStream Stream(&File);
LoadLDraw(Stream);
} }
mCurrentStep = step; mCurrentStep = step;
@ -1032,7 +1033,9 @@ void Project::CheckPoint(const char* Description)
void Project::LoadCheckPoint(lcModelHistoryEntry* CheckPoint) void Project::LoadCheckPoint(lcModelHistoryEntry* CheckPoint)
{ {
DeleteContents(true); DeleteContents(true);
LoadLDraw(QTextStream(CheckPoint->File, QIODevice::ReadOnly));
QTextStream Stream(CheckPoint->File, QIODevice::ReadOnly);
LoadLDraw(Stream);
const lcArray<View*> Views = gMainWindow->GetViews(); const lcArray<View*> Views = gMainWindow->GetViews();
for (int i = 0; i < Views.GetSize (); i++) for (int i = 0; i < Views.GetSize (); i++)

View file

@ -22,6 +22,22 @@ win32 {
QMAKE_CXXFLAGS_WARN_ON += -Wno-unused-parameter QMAKE_CXXFLAGS_WARN_ON += -Wno-unused-parameter
} }
isEmpty(QMAKE_LRELEASE) {
win32:QMAKE_LRELEASE = $$[QT_INSTALL_BINS]\\lrelease.exe
else:QMAKE_LRELEASE = $$[QT_INSTALL_BINS]/lrelease
unix {
!exists($$QMAKE_LRELEASE) { QMAKE_LRELEASE = lrelease-qt4 }
} else {
!exists($$QMAKE_LRELEASE) { QMAKE_LRELEASE = lrelease }
}
}
lrelease.input = TRANSLATIONS
lrelease.output = resources/${QMAKE_FILE_BASE}.qm
lrelease.commands = $$QMAKE_LRELEASE -silent ${QMAKE_FILE_IN} -qm resources/${QMAKE_FILE_BASE}.qm
lrelease.CONFIG += no_link target_predeps
QMAKE_EXTRA_COMPILERS += lrelease
unix:!macx { unix:!macx {
TARGET = leocad TARGET = leocad
} else { } else {
@ -220,3 +236,4 @@ FORMS += \
qt/lc_qfinddialog.ui qt/lc_qfinddialog.ui
OTHER_FILES += OTHER_FILES +=
RESOURCES += leocad.qrc RESOURCES += leocad.qrc
TRANSLATIONS = resources/leocad_pt_BR.ts

View file

@ -67,5 +67,6 @@
<file>resources/piece_show_later.png</file> <file>resources/piece_show_later.png</file>
<file>resources/time_add_keys.png</file> <file>resources/time_add_keys.png</file>
<file>resources/library.zip</file> <file>resources/library.zip</file>
<file>resources/leocad_pt_BR.qm</file>
</qresource> </qresource>
</RCC> </RCC>

View file

@ -132,6 +132,10 @@ int main(int argc, char *argv[])
QCoreApplication::setApplicationName("LeoCAD"); QCoreApplication::setApplicationName("LeoCAD");
QCoreApplication::setApplicationVersion(LC_VERSION_TEXT); QCoreApplication::setApplicationVersion(LC_VERSION_TEXT);
QTranslator Translator;
Translator.load(QString("leocad_") + QLocale::system().name() + ".qm", ":/resources");
app.installTranslator(&Translator);
g_App = new lcApplication(); g_App = new lcApplication();
gMainWindow = new lcMainWindow(); gMainWindow = new lcMainWindow();

1461
resources/leocad_pt_BR.ts Normal file

File diff suppressed because it is too large Load diff