Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Reply
Contributor
nico411
Posts: 34
Registered: ‎12-20-2010
My Device: DevAlpha Beta 2
My Carrier: Orange

Localization keys not generated

Hello,

 

I'm quite confused about the localization on BalckBerry 10 cascade projects.

I've created several BalckBerry 10 cascade projets with the preivous bêtas of the SDK and everything worked great.

But my last projet was created with the Gold SDK (I don't know it this is important but that the only thing that changed) and the translation keys are not generated anymore.

To be more precise, the qml keys are generated but not the ones from C++.

In my main.cpp I have :

 

    // localization support

    QTranslator translator;

    QString locale_string = QLocale().name();

    QString filename = QString( "ProjectName_%1" ).arg( locale_string );

    if (translator.load(filename, "app/native/qm")) {

        app.installTranslator( &translator );

    }

 

I use tr("text", "") to translate my texts in C++ files.

 

In my config.pri, I have :

 

include(config.pri)

 

lupdate_inclusion {

    SOURCES += \

        $$BASEDIR/../assets/qml/*.qml

        $$BASEDIR/../src/ProjectName.cpp

}

 

Thus, all the keys from my qml files are generated but not the ones from ProjectName.cpp

I also tried to compare with my old projects to check the differences but I couldn't find the problem.

 

What am I missing there ?

 

Thank you!

Please use plain text.
Developer
javoid
Posts: 194
Registered: ‎11-24-2012
My Device: Dev Alpha B, Bold 9700
My Carrier: NA

Re: Localization keys not generated

As per my thread here:

http://supportforums.blackberry.com/t5/Cascades-Development/Concerned-about-translations/td-p/208137...

 

You need to place:

lupdate_inclusion {
    SOURCES += \
        $$BASEDIR/../assets/qml/*.qml
        $$BASEDIR/../src/ProjectName.cpp
}

In your (AppName).pro file.

Please use plain text.