Translations are compiled, but I can't get app to come up in Spanish
I ran lupdate on my code and made two translation files, bezitopo_en.ts and bezitopo_es.ts . I compiled the program, getting .qm files, and tried to run the program in Spanish. It came up in English. What's wrong?
Here's my main program:
Code:
int main(int argc, char *argv[])
{
app.installTranslator(&translator);
TinWindow window;
window.show();
return app.exec();
}
Here's the relevant part of CMakeLists.txt:
Code:
find_package(Qt5Core)
find_package(Qt5Widgets)
find_package(Qt5Gui)
find_package(Qt5LinguistTools)
qt5_add_resources(lib_resources viewtin.qrc)
qt5_add_translation(qm_files bezitopo_en.ts bezitopo_es.ts)
add_executable(viewtin angle.cpp arc.cpp bezier.cpp bezier3d.cpp binio.cpp breakline.cpp
cidialog.cpp circle.cpp cogo.cpp color.cpp
contour.cpp csv.cpp document.cpp drawobj.cpp ellipsoid.cpp
geoid.cpp geoidboundary.cpp halton.cpp kml.cpp
latlong.cpp ldecimal.cpp linetype.cpp
manysum.cpp measure.cpp measurebutton.cpp penwidth.cpp
pnezd.cpp point.cpp pointlist.cpp polyline.cpp projection.cpp
ps.cpp qindex.cpp quaternion.cpp random.cpp relprime.cpp rendercache.cpp
rootfind.cpp segment.cpp spiral.cpp spolygon.cpp test.cpp tin.cpp
tinwindow.cpp vball.cpp vcurve.cpp viewtin.cpp zoom.cpp zoombutton.cpp
${lib_resources} ${qm_files})
And here are the commands I tried:
Code:
~/build/bezitopo/dbg$ LANGUAGE=es_ES ./viewtin &
~/build/bezitopo/dbg$ LANGUAGE=es ./viewtin &
~/build/bezitopo/dbg$ LANG=es_ES.utf8 ./viewtin &
~/build/bezitopo/dbg$ LANG=es ./viewtin &
~/build/bezitopo/dbg$ LANG=es_CO ./viewtin &
~/build/bezitopo/dbg$ LANG=es_ES ./viewtin &
I brought the binary up in Okteta and looked for one of the strings in UTF-16, but didn't find it. What am I doing wrong? The resources (icons) work just fine.
Re: Translations are compiled, but I can't get app to come up in Spanish
I tried adding the .qm files to the .qrc file, but it didn't compile. The .qm files are in the build directory; the icons are in the source directory.
Re: Translations are compiled, but I can't get app to come up in Spanish
I ended up installing the .qm files.
CMakeLists.txt:
Code:
set(SHARE_DIR ${CMAKE_INSTALL_PREFIX}/share/bezitopo)
install(FILES ${qm_files} DESTINATION share/bezitopo)
config.h.in:
Code:
#define SHARE_DIR "@SHARE_DIR@"
Main program:
Code:
int main(int argc, char *argv[])
{
{
//cout<<"Translations found in current directory"<<endl;
app.installTranslator(&translator);
}
{
//cout<<"Translations found in share directory"<<endl;
app.installTranslator(&translator);
}
TinWindow window;
window.show();
return app.exec();
}