November 15, 2011

maxmotor maxmotor
Lab Rat
84 posts

[Solved] Not all the text in my application is translated.

 

Hello Qt devs!

As the title says, not all the text in my application is translated when running this code:

  1. QTranslator translator;
  2. translator.load("dan.qm");
  3. a.installTranslator(&translator);

Only parts of my application are translated. When looking in QLinguist, all sentences seems to be accepted – none are greyed out.

Has anyone experienced this as well?

Thank you for your time!

13 replies

November 15, 2011

RazrFalcon RazrFalcon
Lab Rat
125 posts

Which lines non-translated?
Did you use tr() in your code?

 Signature 

QT != Qt
Gentoo + KDE

November 15, 2011

Stavros Filippidis Stavros Filippidis
Lab Rat
388 posts

As the previous poster said, only strings included in tr() will be translated! :-)

November 15, 2011

maxmotor maxmotor
Lab Rat
84 posts

Yes I did use tr() on all strings.

November 15, 2011

Stavros Filippidis Stavros Filippidis
Lab Rat
388 posts

Strange! Could you post one line of code which translated and one that did not?

November 15, 2011

maxmotor maxmotor
Lab Rat
84 posts

In one line:

  1. gpsUpdaterScreen = new ValueUpdater(tr("GPS coordinates"), tr("Get the GPS coordinates of the demo equipment."), myResources->getGpsObject(), tr("In order to affect the GPS position, please move around."));

The last string in that line is translated – the rest is not.

November 15, 2011

RazrFalcon RazrFalcon
Lab Rat
125 posts

Can you post lupdate log?

PS: I think the use of tr() in class constructor is bad idea…

 Signature 

QT != Qt
Gentoo + KDE

November 15, 2011

maxmotor maxmotor
Lab Rat
84 posts

Setting up a MinGW/Qt only environment…
QTDIR set to C:\Qt\4.7.4
PATH set to C:\Qt\4.7.4\bin
— Adding C:\MinGW\bin to PATH
— Adding C:\Windows\System32 to PATH
QMAKESPEC set to win32-g++

C:\Qt\4.7.4>cd..

C:\Qt>cd..

C:\>cd Users\Mads\workspace\FlexTabDemo

C:\Users\Mads\workspace\FlexTabDemo>lupdate FlexTabDemo.pro
C:/Qt/4.7.4/mkspecs/features/default_post.prf(5):Function ‘system’ is not implem
ented
C:/Qt/4.7.4/mkspecs/features/debug_and_release.prf(66):Function ‘eval’ is not im
plemented
C:/Qt/4.7.4/mkspecs/features/debug_and_release.prf(69):Function ‘eval’ is not im
plemented
C:/Qt/4.7.4/mkspecs/features/debug_and_release.prf(72):Function ‘eval’ is not im
plemented
C:/Qt/4.7.4/mkspecs/features/debug_and_release.prf(75):Function ‘eval’ is not im
plemented
C:/Qt/4.7.4/mkspecs/features/debug_and_release.prf(78):Function ‘eval’ is not im
plemented
C:/Qt/4.7.4/mkspecs/features/debug_and_release.prf(80):Function ‘eval’ is not im
plemented
C:/Qt/4.7.4/mkspecs/features/debug_and_release.prf(82):Function ‘eval’ is not im
plemented
C:/Qt/4.7.4/mkspecs/features/debug_and_release.prf(84):Function ‘eval’ is not im
plemented
C:/Qt/4.7.4/src/corelib/tools/qstringbuilder.h:45: circular inclusion of c:/Qt/4
.7.4/include/QtCore/qstring.h
C:/Qt/4.7.4/src/gui/painting/qwmatrix.h:45: circular inclusion of c:/Qt/4.7.4/in
clude/QtGui/qmatrix.h
c:/Qt/4.7.4/include/QtGui/qaction.h:1: circular inclusion of C:/Qt/4.7.4/src/gui
/kernel/qaction.h
c:/Qt/4.7.4/include/QtGui/qboxlayout.h:1: circular inclusion of C:/Qt/4.7.4/src/
gui/kernel/qboxlayout.h
C:/Qt/4.7.4/src/gui/kernel/qgridlayout.h:45: circular inclusion of c:/Qt/4.7.4/i
nclude/QtGui/qlayout.h
Updating ‘dan.ts’… Found 82 source text(s) (0 new and 82 already existing)
Updating ‘eng.ts’… Found 82 source text(s) (0 new and 82 already existing)
Updating ‘ger.ts’… Found 82 source text(s) (0 new and 82 already existing)

C:\Users\Mads\workspace\FlexTabDemo>

November 15, 2011

Andre Andre
Robot Herder
6396 posts

RazrFalcon wrote:
PS: I think the use of tr() in class constructor is bad idea…

Could you explain why you think so?
I don’t see anything wrong with doing that in this way, but I may be overlooking something.

November 15, 2011

Stavros Filippidis Stavros Filippidis
Lab Rat
388 posts

I agree with Andre. :-)

November 15, 2011

RazrFalcon RazrFalcon
Lab Rat
125 posts

Andre, it’s only my suggestion. I’m not sure about this. :-)

 Signature 

QT != Qt
Gentoo + KDE

November 16, 2011

maxmotor maxmotor
Lab Rat
84 posts

Okay I’m a bit embarrassed…

When I first were introduced to Qt Linguist (last week) – a colleague showed me how to use it. It seemed quite simple. And it is, really! You just have to do ALL steps. :)

I forgot to run “lrelease myProject.pro”…

I’m sorry for the inconvenience.

Thank you for your time!

November 16, 2011

Andre Andre
Robot Herder
6396 posts

Ah, ok. Thanks for reporting back!

December 3, 2011

syrianzoro syrianzoro
Lab Rat
63 posts

I get the same problem but I can’t find the solution ?
please tell me how you resolved it ?
the ts file doesn’t generated absolutely

  1. Project MESSAGE:
  2. C:/Qt/4.7.4/mkspecs/features/default_post.prf(5):Function 'system' is not implemented
  3. C:/Qt/4.7.4/mkspecs/features/debug_and_release.prf(66):Function 'eval' is not implemented
  4. C:/Qt/4.7.4/mkspecs/features/debug_and_release.prf(69):Function 'eval' is not implemented
  5. C:/Qt/4.7.4/mkspecs/features/debug_and_release.prf(72):Function 'eval' is not implemented
  6. C:/Qt/4.7.4/mkspecs/features/debug_and_release.prf(75):Function 'eval' is not implemented
  7. C:/Qt/4.7.4/mkspecs/features/debug_and_release.prf(78):Function 'eval' is not implemented
  8. C:/Qt/4.7.4/mkspecs/features/debug_and_release.prf(80):Function 'eval' is not implemented
  9. C:/Qt/4.7.4/mkspecs/features/debug_and_release.prf(82):Function 'eval' is not implemented
  10. C:/Qt/4.7.4/mkspecs/features/debug_and_release.prf(84):Function 'eval' is not implemented
  11.  
  12. This application has requested the Runtime to terminate it in an unusual way.
  13. Please contact the application's support team for more information.

 Signature 

Qt is the future

 
  ‹‹ Problem in getting focus?      [Solved] QGraphicsView not updating ››

You must log in to post a reply. Not a member yet? Register here!