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:
int main(int argc, char *argv[])
{
app.installTranslator(&translator);
TinWindow window;
window.show();
return app.exec();
}
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QTranslator translator;
if (translator.load(QLocale(),QLatin1String("bezitopo"),QLatin1String("_"),QLatin1String(":")))
app.installTranslator(&translator);
TinWindow window;
window.show();
return app.exec();
}
To copy to clipboard, switch view to plain text mode
Here's the relevant part of CMakeLists.txt:
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})
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})
To copy to clipboard, switch view to plain text mode
And here are the commands I tried:
~/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 &
~/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 &
To copy to clipboard, switch view to plain text mode
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.
Bookmarks