![]() Registered Member ![]()
|
Hi mates;
I'm writting a program and everty time I started up I get the next message: Starting: /home/musikolo/workspace-qt/myprogram/build/myprogram KGlobal::locale::Warning your global KLocale is being recreated with a valid main component instead of a fake component, this usually means you tried to call i18n related functions before your main component was created. You should not do that since it most likely will not work Thus, I've tried to go back to the basis, i.e., to do something as basic as this: http://techbase.kde.org/Development/Tut ... st_program But I still get the same warning message: Starting: /home/musikolo/workspace-qt/myprogram/build/myprogram KGlobal::locale::Warning your global KLocale is being recreated with a valid main component instead of a fake component, this usually means you tried to call i18n related functions before your main component was created. You should not do that since it most likely will not work tutorial1(10658)/kdeui (KNotification) KNotificationManager::notificationClosed: 355 *** Exited normally *** I'm addition to the warning message, I don't get my program to load the Spanish catalog, in spite of being created properly and installed here: /usr/share/locale/es/LC_MESSAGES/myprogram.mo What's wrong about the way I'm doing the localization process? Best regards!
Last edited by Musikolo on Sat Feb 19, 2011 4:10 pm, edited 1 time in total.
|
![]() KDE Developer ![]()
|
Do you have any static i18n string, like
or similar (like static class member) in your application?
Pino Toscano
|
![]() Registered Member ![]()
|
@pinotree:
You were absolutely right. I have a line like next globally defined:
After checking a bit the code, I found out that it was used many times, but just in one method, so I moved it inside the method and the warning message disappeared. So, thanks a lot for this. However, I still don't get my program to load the Spanish catalog I have made. I started it up like this:
I have installed the package kde-l10n-es which seems to be required for some KDE-defined literals. By doing the same thing with, e.g., Kate editor, it works great though! To make the catalog, I have used the next script to extract all literals http://pastebin.com/yc4dKRBW and used Lokalize to translate them into Spanish. After compiling all the literals, I have install it here: /usr/share/locale/es/LC_MESSAGES/myprogram.mo Just for the sake of testing something different, I have added unsuccessfully the next line to my main.cpp file:
What else could be wrong? |
![]() KDE Developer ![]()
|
Yes, that contains (also) the base kdelibs translations, which are mandatory for any KDE application (meaning that without those any application won't get translations at all).
For "compiling" I guess you mean "using msgfmt", no?
You shouldn't need the line above. The catalog name of your application is named exactly after the first parameter (i.e. the application name) in the KAboutData created in the main() or, if not NULL/empty, the second parameter. So, make sure the .mo file you copy in the system path has the right name.
Pino Toscano
|
![]() Registered Member ![]()
|
@pinotree:
Thanks mate, you mentioned the clue I needed:
I was using the capital letters in the first two parameters my of KAboutData object and this was my mistake. Thanks a million for your immense help! |
Registered users: bartoloni, Bing [Bot], Evergrowing, Google [Bot], ourcraft