How to add support for localization?

Hi, I tried to use tr(), including all the text it contains. But it does not work. No idea how to do it?

Looks like you've done all the necessary steps with regard to QML and rpm files.  But just to remind for those who come here looking for information, you must make your text in a qstring and tell re-translation function if changing language of the device, if the language or locale changed or if just on the regional settings of the interface changes user.

text: qsTr("I like turtles") + Retranslate + onLanguageChanged

Then you need to go into your folder of translations and open your .ts files.  You will see this:

    
        
        Close
        
    

You must add your translation so that the UI knows what it takes to replace the word with based on your .ts

    
        
        Close
        Cerrar
    

Now, just add a few things to your source code:

Add this to your UI.cpp application:

#include 

Add this in your Interface main Application in your PPC immediately after the opening bracket:

m_pTranslator = new QTranslator(this);
m_pLocaleHandler = new LocaleHandler(this);

Then make a connection to the translation function that you will create:

 if(!QObject::connect(m_pLocaleHandler,         SIGNAL(systemLanguageChanged()),
            this,
            SLOT(onSystemLanguageChanged()))) {
            // This is an abnormal situation! Something went wrong!
            // Add own code to recover here
            qWarning() << "Recovering from a failed connect()";
        }

            onSystemLanguageChanged();

create the function of translation:

void App::onSystemLanguageChanged()
{
    QCoreApplication::instance()->removeTranslator(m_pTranslator);
    // Initiate, load and install the application translation files.
    QString locale_string = QLocale().name();
    QString file_name = QString("persistentobjects_%1").arg(locale_string);
    if (m_pTranslator->load(file_name, "app/native/qm")) {
        QCoreApplication::instance()->installTranslator(m_pTranslator);
    }
}

now in your applicationui hpp add:

#include 

as well as:

namespace cascades {
class LocaleHandler;
class Application;

Q_INVOKABLE add under your stuff:

private slots:
       void onSystemLanguageChanged();

and add the translator:

QTranslator* m_pTranslator;
            bb::cascades::LocaleHandler* m_pLocaleHandler;

If there is already a translator (most likely) just put the m_pLocaleHandler of bb::cascades:LocaleHandler *; under it.

That should be all.  I don't know if this is the way of manuals to do, but this is what worked for me from watching other samples and read messages of support.

I hope it works!

Tags: BlackBerry Developers

Similar Questions

  • How to add support for Windows 7 64 bit id3v2.4

    ID3v2.4 support for windows 7 64 bit

    Hello

    I would like to ask if it is possible to add a support id3 - tag (version 2.4) to windows 7 Professional 64-bit.

    (and if so, how...)

    Thanks in advance

    Hello

    Explorer Windows and Windows Media Player can not handle ID3 version 2.4 tags in any version, until and including Windows 7/Windows Media Player 12. Windows can understand ID3 until and including version 2.3.

    For more details about tags ID3 in Windows 7refer for the links provided below:

    http://Windows.Microsoft.com/en-us/Windows7/media-information-in-Windows-Media-Player-frequently-asked-questions

    http://msdn.Microsoft.com/en-us/library/dd743220 (v = VS. 85) .aspx

    Thank you, and in what concerns:
    Naman R - Microsoft technical support.

    Visit our Microsoft answers feedback Forum and let us know what you think.

  • How to add support for storing player names and notes in the HTML5 app

    Dear team,

    I asked for one of my app to the frame of the designation of Blackberry.

    Currently in my application partitions are not saved when closing appliction.

    Also no support for player names.

    Can some one guide me how to store scores and player names when out application.

    If during the application again open, user can see latest scores and players etc.

    Hoping for a positive response soon.

    Thank you

    HB.

    http://developer.BlackBerry.com/HTML5/APIs/localStorage.html

    http://www.html5rocks.com/en/features/storage

  • application of newsstand, iOS add support for .folio files

    Hello!

    We have a kiosk iOS application to provide our customers with our problems, and we use a PDF reader.

    We want to add support for the .folio in the application files, by using a reader of folio in our application.

    Looking around, I only found the specifications for the .folio files and Adobe Content Viewer application.

    Is it possible to have more specific information on how we can do something like the Adobe Content Viewer application that we can integrate into our application?

    For example how could analyze the xml files, which controls views to use (for example. UIWebview?) etc.

    Thank you very much!

    It is really not possible to do. Keep in mind Adobe has devoted a team of engineers over the last three years to build the folio of the rendering of the DPS Viewer capabilities. Write one yourself to integrate into an existing application, it's only really only something a big company with their own market will do.

    If your application currently does that distribute magazines, it is best to spend to DPS and replacement of your existing application with a DPS one.

    Neil

  • BlackBerry Hub please add support for Hello!

    Please add support for Hello!

    Comeback! Thank you

    Please like this message if you do not want to see this feature added too

  • Passport system: Add support for scrolling through the physical keyboard

    Hi guys,.

    as you know peripheral Pasport is the new support feature: scrolling in the list view/Scroll through the physical keyboard. It seems that this function should work automatically, but it is not working at all in my application. It works only partially to control the display of Web pages and only on the pages of the subsites of my web content.
    Looks as the root cause of this issue is the list view must focus to handle keyboard events. OK, so the workaround can be call requestFocus() on the list view. It's a job but only until I do not touch the other control or scroll this list via the screen point of view! Or for example my app can show popup by clicking on list view and when this popup will be rejected the focus won't return to the display of the list...

    So my question is what good way to add support for this feature? Do I really need to play with requestFocus()? Or maybe there's a simple way to always keep the focus on the display of the list?
    I really need help.

    I've added a few features such as

    requestFocusForScrolling()

    then get the signal of this active tab has changed, you can call this function to get the new focus

    or on NavigationPane if returning to onPopTransitionEnded () calling the requestFocus on page function now on top

    In my Pages, I always have a few features added like connect(), disconnect() cleanUp() init() and now also at the request of focus. In a few pages, these functions are empty, but I can use them in the generic functions where I only got one Page

    ----

    not easy to touch OS oriented to add a key activated area outside the screen

    It always depends on the field with the development: think of an Image when you change the size of gestures touch on keyboard or take a look at sales-charts where you "scroll" in the months of keyboard

    Same pages may also have ScrollView and/or one or several ListView - it's do you stunts where is the update for keyboard gestures.

  • Cannot figure out how to "add-in" for the 2013 Outlook application... said the loading behavior is not loaded. How can I fix it?

    Cannot figure out how to "add-in" for the 2013 Outlook application... said the loading behavior is not loaded. How can I fix it?

    Hi amandab9126792,

    2013 Outlook does not work with Acrobat X because they are not compatible. Please check the compatibility to https://helpx.adobe.com/acrobat/kb/compatible-web-browsers-pdfmaker-applications.html.

    Kind regards

    Nicos

  • Add support for the iPhone in an application already published

    Hello

    Is it possible to add support for the iPhone to a multi-folio application which we have already published in iPad format.

    If so, what are the steps before you download a .ipa file revised to Apple for review?

    There are a few paragraphs on the update of the application in general on p58 here but nothing specific to add support for additional platforms to an existing application.

    Thanks in advance for your help.

    Ross

    You must do two things to make your application work on the iPad and the iPhone:

    1. create fact sheets for the iPhone.

    http://help.Adobe.com/en_US/digitalpubsuite/using/WS4cb2576c7954973c-70d16164136e6c7cfbc-8 000. HTML

    2. create and submit a new version of the viewer using DPS App Builder. Select iPhone and iPad. Use the same files mobileprovision and CERT.

    You also need to create some application icons and splash for iPhone screens.

  • [Consolidation-locked] Please add support for the Nikon D600 RAW to Lightroom as soon as possible!

    My Adobe lounge

    Please add support for the Nikon D600 RAW to Lightroom as soon as possible!

    ViewNX allows me to get images, but check back! I know that Lightroom and you, ViewNX, don't be no Lightroom.

    Yes, I see all other D600 support request. I am here to pray for her! Don't make me wait much longer!

    Title of the message was edited by: Brett N

    Title of the message was edited by: Brett N

    4.2 Lightroom was released, which supports the Nikon D600. In Lightroom, choose Help > check for updates to download.

    Please visit: http://forums.adobe.com/message/4785056

  • How to add users for ibots?

    I want to create IBOTs and send these ibot reports to users by e-mail.
    I don't know how to add users for this. If I add through the administration tool he just asks me the user name and the password (not mail electronic id)... .to go I can add in the e-mail ID so she ibot can pick up the same and send the report by e-mail.

    Thank you in advance.

    Kind regards
    Aarti

    Hello
    Create groups and users in RPD. Assign users to specific groups.
    Each user must log into their account and under settings-> my account-> slot delivery Options-> devices must add their email.

    Reference: http://download.oracle.com/docs/cd/E12096_01/books/AnyUser/AnyUser_Delivers.html
    Will solve many of your doubts on ibots :-)

    Award points for responses if helped

    Kind regards
    Srikanth

  • How you add cash for the new Portfolio Manager?

    How can you add cash for the new Portfolio Manager. It is not MSN Money application is simply Money Portfolio Manager.

    Hi Thirualluvar,

    Who is the manufacturer of the application of Portfolio Manager?

    Microsoft, the Portfolio Manager application is Microsoft Money 2008. If you use the same, you can contact Microsoft Money technical support for assistance.
    http://support.Microsoft.com/ph/870/en-us#TAB4

    Hope the helps of information. Please post back and we do know.

    Concerning
    Joel S
    Microsoft Answers Support Engineer
    Visit our Microsoft answers feedback Forum and let us know what you think.

  • Add support for the new html tag

    Most browsers have support for the < object / > tag.

    I want to integrate a video player on my site to play .mkv videos, but I can't use most because him are based on flash, which can play only .flv & .f4v.

    That's why I go to the < object / > tag

    But, if I wanted to integrate a tag with the name of < mkvvideo / >, a simple plugin that is associated with this tag would be usable or Basic programming of the firefox browser which deals?

    Thank you

    If you want to integrate MKV videos in a web page, see

  • How - to add options for application to the BlackBerry Options

    I generated the example "How - to add application options to the BlackBerry Options" of the knowledge base and run it on a Pearl Flip but I don't see any new added options. I could be looking in the wrong place, but I thought that the sample adds "Options Sample" to the list of options.

    No one knows where to look for the new option added by this example?

    I went back and Setup another entry point recompiled and still can't find where is the new option.

    Thanks Mark. That makes perfect sense as the mail app needs to retrieve incoming messages at any time.

    I've updated my code to close to the bottom of my library of applications by programming, I added a menu too. Is better to be sure that the library is closed and ready for the next event to use it.

  • How to add fields for older users?

    Nice day! I have OIM 11 g R1. I add a field custom reconciliation provisiong and Active Direcroty target resources. This field displays for new users, but old existing users did not have this attribute. How can add this attribute to the existing users?

    Hello

    You must run the CVF utility for this.

    With the help of the form Version control utility - 11g Release 1 (11.1.1)

    Concerning

    Suren

  • How to add listeners for the external loaded swf files?

    IAM loading external .swf file in the file main.swf.

    IAM dispatchEvent (new Event ("loaded")) of external .swf.

    How to add the listener for the event "loaded"?

    in your swf file main something like below:

    mcExt.addEventListener ("load", onCongratsClose);

    function onCongratsClose(e:Event):void {}
    Your code

    }

Maybe you are looking for