PROBLEM: getting the translations of Cascades library

I have problems to get translations from my library to application project project

Thanks to Isaac Gordetzky, the library model was a great starting point and I got some more tips from him

So in the meantime, I've solved some taks:

1 library Project creates translation files

I had to add a skeleton bar - descriptor.xml for the library project and add my local it

2. get a tr() work in C++

I had to replace

TR ("...")

with
QT_TRANSLATE_NOOP("My::namespace::MyClass","...")

3. use of QRC

In my .pro I inserted

RESOURCES += baasParseLibrary.qrc

where baasParseLibrary is my name of the library

This is the content of baasParseLibrary.qrc:




translations/baasParseLibrary_de.ts
translations/baasParseLibrary_en.ts


4 initialize the QRC in my application

In main.cpp, I inserted before the Application has been created

Q_INIT_RESOURCE (baasParseLibrary);

5. provide the translator of my library code

Add a method to the API from my library:

void MyLibApp::updateTranslations() {
static QTranslator * m_pTranslator = new QTranslator(
        QCoreApplication::instance());
QString locale_string = QLocale().name();
QString file_name = QString(":/baasParseLibrary/translations/baasParseLibrary_%1").arg(locale_string);
if (m_pTranslator->load(file_name, "app/native/qm")) {
    QCoreApplication::instance()->installTranslator(m_pTranslator);
} else {
    qDebug() << "cannot load " << file_name;
}
}

Then, my app, I'll call updateTranslations()

PROBLEM:

the file updateTranslations() cannot be loaded into the translator.

so there must be something wrong.

Question: the prefix and file in the correct QRC file?

prefix /baasParseLibrary is the name of the library project in the workspace - not the physical location on disk

in updateTranslations() I am the same way by referring

Or am I missing something else?

I never hepatitis did something with the QRC or translations of libraries before.

all other things work - getting active such as the images in the library

Thanks for the tips

Hi Isaac,.

Thanks for your tip. You're right, I should use the *.qm files in the file of the QRC. because they have been compiled in the process of generation of library before .qm.

Then I got the libraray of loaded files. (Both: APP and LIB)

But still has no translations.

tried many variations and then found the reason. We changed all the

tr("..")

in

QT_TRANSLATE_NOOP("ekkescorner::parse::ParseREST","...")

Let the libraray compile without error

It does not work as I discovered today.

But I remembered that you mentioned a second notation that might help.

And YES: now we'll find translations if you use

::ekkescorner::parse::ParseREST::tr("...")

curious: the two create exactly the same content in the *.ts files, but only the last works.

... will blog about all this later when to publish my Libraray Parse.com for waterfalls on Github.

--------

Finally, I want to check my code is correct to add the two translators.

Here are the usual stuff generated by the waterfalls inside the APP project model:

void ApplicationUI::onSystemLanguageChanged() {
    QCoreApplication::instance()->removeTranslator(m_pTranslator);
    // Initiate, load and install the application translation files.
    QString locale_string = QLocale().name();
    QString file_name = QString("baasParseTest_%1").arg(locale_string);
    if (m_pTranslator->load(file_name, "app/native/qm")) {
        QCoreApplication::instance()->installTranslator(m_pTranslator);
        qDebug() << "load translator file from APP: " << file_name;
    } else {
        qDebug() << "cannot load " << file_name;
    }
    mServer->updateTranslations();
}

as you see after the first initialization of the app translator, I call the library:

void ParseREST::updateTranslations() {
    static QTranslator * m_pTranslator = new QTranslator(
            QCoreApplication::instance());
    QCoreApplication::instance()->removeTranslator(m_pTranslator);
    QString locale_string = QLocale().name();
    QString file_name = QString(":/baasParseLibrary/translations/baasParseLibrary_%1").arg(locale_string);
    if (m_pTranslator->load(file_name)) {
        QCoreApplication::instance()->installTranslator(m_pTranslator);
        qDebug() << "load translator file from LIB : " << file_name;
    } else {
        qDebug() << "cannot load " << file_name;
    }
}

and the debug, I see:

INFO load the APP translator file: 'baasParseTest_de_DE. '

INFO load file of the translator of LIB: ': / baasParseLibrary/translations/baasParseLibrary_de_DE.

and translations of C++ and QML are now working.

I wonder about the removeTranslator() - the call of methods and thought, that the second he would remove the first. but it seems that you are right and I have to remove always.

... Thanks again... next step done using waterfalls providing libraries not only C++ code but also translations and assets such as images

Tags: BlackBerry Developers

Similar Questions

  • When booting I get the Visual C++ runtime library error message. This application has requested the execution in an unusual way. Any ideas how to fix?

    When booting I get the Visual C++ runtime library error message

    Hi ToddLynch,

    (1) since when are you facing this problem?

    (2) remember to make changes?

    It is sufficient to indicate the complete error message you receive.

    Put the computer to boot and then check if the problem persists

    Follow step 1 in the link below,

    How to troubleshoot a problem by performing a clean boot in Windows Vista or in Windows 7

    If everything works well after a clean boot, you can deduce that some third-party services are at the origin of the problem.

    Continue with the remaining steps to pin-point on the third party service.

    After find you the program that is causing the problem, you will have to perhaps to update or install a newer version of the program, if you rarely use that you should consider uninstalling the software.

    Important: n ' forget not to put the computer to a normal startup follow step 7 in the link.

  • How to get the dynamics of Cascades/Native license key

    Hello

    After spending all day reading on the generation of license keys with the usual confusion that comes from the documentation of the RIM I can now implement a dynamics in Java licensing system.

    The problem is my apps in C + c++ / Cascades.

    According to the documentation its on the device in a key peeler accessed by the CoreModule.

    In Java, you would do this after initialization the CoreModule;

    String lc = group.getProperty ("RIM_APP_WORLD_LICENSE_KEY");

    How to recover using native?

    If this is not possible then second best how can I get the device id?

    OK, so it turns out that it is not possible that RIM have apparently abandoned dynamic licenses for BB10,.

    Of course you can get a PIN and a license key, starting with 'test... '. ', to your package when you are debugging, but any hash code that you write using these will work not in release, there are two options, either;

    1. develop your own system of license (as long as the question of whether it will be necessary, watch a few months after BB10 piracy release pending)

    2. use the application by buying APIs.

    Full discussion on this are in the forum of stunts with a link to a response from the RIM.

    http://supportforums.BlackBerry.com/T5/Cascades-development/how-to-get-dynamic-licence-key-from-CASC...

  • Problem: getting the return code 7 downloading image

    Hello everyone. I get the response from the server in the return Code: 7 when downloading images to my server. Can someone help me? What does this return code?

    Thanks in advance.

    I have it. Its because my memory server was full. Thank you.

  • Problem get the handle to the module using CodeModuleGroup

    I need to get the object moduleHandle of some modules that I don't know the name of the runtime so I use CodeModuleGroupManager.loadAll () then a loop in the list of the modules that it returns.
    From there I need to obtain the handles of some modules based on information module, but it does not work.
    By using the following code I get 0 or a number that appears to be no valid for a moduleHandle object.
    I use this api incorrectly? I tried to get the handle based on the name and friendlyName properties. This maybe isn't the way to do it, but I couldn't figure a way deparaments.
    Thus, using the information returned by the loadAll() method, I would like to know the right way to get the Handle to the module.
    Any help is appreciated. Thank you.

    modules = CodeModuleGroupManager.loadAll ();

    for (i = 0; i numModules; i ++) {}

    String fname = modules [i] .getFriendlyName ();
    String name = modules [i] .getName ();

    / * 3 following below almost always return 0. Why? */
    moduleHandle int = CodeModuleManager.getModuleHandle (fname);
    moduleHandle = CodeModuleManager.getModuleHandle (name);
    handle = int [i] modules .getHandle ();
    }

    CodeModuleGroupManager.loadAll returns a returns an array of CodeModuleGroups, not CodeModules.  You try to use the name of a CodeModuleGroup to get the handle of a CodeModule.

    If you want the CodeModule handle, call first getModules() on your variable modules and the loop through this enumeration.  If you want that the handle of the CodeModuleGroup call getHandle on your variable modules.

  • I have a problem getting the semi-transparent icons to appear...

    I can't get the semi-transparent icons to appear (those that show if an image has been previously published, collections or cropped Rapids). I was hoping someone could point me in the right direction on how to reset or reapply.

    Thank you, Perry

    If you are talking about those in the vignettes in the film strip, you have resized the film until they are too small to display. Try mousing over the top border, and drag it larger to see if they reappear.

  • Skype Sync problem, get the Notifications but not full messages! [cellular data only]

    Hey guys, I had problems with Skype on my iPhone for a long time. And this happens only when I'm NOT on WIFI.

    Whenver someone present me a message, the message will be displayed on my phone as a notification. I always get these any problem. But when I click on the notification to read it in Skype, the message does not appear. Only when I connect to WIFI, it will download messages in Skype.

    I still have my PC on 24/7, with Skype running, so all messages also delivered there.

    I had this problem on my iPhone 4, 5 and 6 now. With iOS, 7, and 8.

    Sometimes when Skype is open in the background on my phone, or when it is closed. I have always received the notifications correctly. But when I load Skype, shows nothing.

    Very frustrating when I know I have a message, but I can not just play them!

    Push notification TURNED on in App Notifications are turned on. Under notifications Skype iOS, everything is turned on. And Skype is activated as a background App application update. And I use the cell data for active Skype.

    Yet once again, this ONLY happens when I'm on a cell/3-4 connection (G) Wi - Fi I constantly receive full messages delivered in the Skype application.

    How can I fix it?

    Yes, I thought about her. It's your carier mobile which is limiting traffic to Skype on your phone.

    I'm with Vodafone. Upgrade to a more expensive plan with Vodafone fixed this problem.

  • Problem with the translation into Chinese of msgrte.txt

    With the help of LabWindows/CVI 2012 SP1.

    I am trying to create a Chinese version of one of our applications. I have a msgrte.txt that has been translated into Chinese, and I ran countmsg.exe on update magic numbers. Countmsg.exe reports of success, and the numbers are changed.

    I replaced the following files with the new msgrte.txt for testing purposes:

    C:\Windows\SYSWOW64\cvirte\bin\msgrte.txt

    C:\Windows\SYSWOW64\cvirte\bin\msgrt4.txt

    C:\Windows\System32\cvirte\bin\msgrte.txt

    When I run the application, it blocks (unrecoverable error) whenever I do anything that requires the text in this file, for example a FileSelectPopup.

    If I use the standard version of English to msgrte.txt, the application works OK (though of course the standard popup panels have English text).

    An inspection of the eyeball of the msgrte.txt translated shows anything special on the file.

    Locale system is set to Chinese (simplified, China).

    Anyone has any ideas to identify the problem?

    I promised to report when a solution is found, so here it is:

    It turns out the format of at least some of the messages in msgrte.txt is critical and will result in the application crash if it is not correct. In my case, the message:

    1331 ' __All files (*.) " *)... »

    has been translated with a missing space character, that is to say (the Chinese equivalent of):

    1331 «files __All...»

    This message appears to be used as a filter in FileSelectPopup (and FileSelectPopupEx) specifier, so the space between the description and the designation of generic character is important.

    So if you translate msgrte.txt, be careful! If, like me, you find it translated by a third party in a language you don't understand, be doubly careful

  • Problems getting The Witcher Enhanced edition launch.

    Tells me when I try to run the game I need to be a time the first administrator that I launch the program and I have enough athority. I am an administrator, I'm the only person who uses my computer and profile on it is mine, then I must be the administrator. How I can get this to work, or is this just a problem of Windows 7?

    It is not a problem, it's a feature lol. Never thought I'd hear myself say that.

    In any case, what you need to do is find the game (the shortcut or the EXE itself) and right click it and then click Run as administrator. This should fix it.

    Good luck.

  • 32 Vista BSOD problem getting the error '1000008e.

    Hello

    I'm using windows vista 32 bit on my system

    But recently, he begins to bsod at random like once a day

    Signature of the problem:
    Problem event name: BlueScreen
    OS version: 6.0.6002.2.2.0.256.6
    Locale ID: 17417

    More information about the problem:
    BCCode: 1000008e
    BCP1: C0000005
    BCP2: 938A69D1
    BCP3: AB7FCAE0
    BCP4: 00000000
    OS version: 6_0_6002
    Service Pack: 2_0
    Product: 256_1

    Files helping to describe the problem:
    C:\Windows\Minidump\Mini112515-01.dmp
    C:\Users\Admin\AppData\Local\Temp\WER-73055-0.SysData.XML
    C:\Users\Admin\AppData\Local\Temp\WER4F86.tmp.version.txt

    Anyone know how to fix this? It gets annoying because it happens even when I do nothing

    I suspect that this computer has been upgraded since almost 20 years, as it has drivers on it since 1996.  I have not simply tools that will examine these drivers.

    giveio.sys 03/04/1996 21:33:25
    PEAuth.sys 10/23/2006 03:55:32

    I would start by upgrading these two drivers or going out.

  • Starting problems, get the error "there is no disk in the drive. Please insert a disk into drive \Device\Harddisk1\DR1.

    1st problem: yesterday I started getting a popp window with the text following formulation - "there is no disk in the drive. Please insert a disk into drive \Device\Harddisk1\DR1' I have no idea what this introduced him or how stop it.  Any suggestions?

    2nd problem: whenever I restart my computer or shut it down and then power up the white bar that moves from left to right only moving to halfway through and then stops. I then have to hold the power button in until the computer turns off again and then rehit the power button. When it starts to power back up the white bar is always in the Middle, but then begins to finally complete the passage to the far right of the box. This problem started when I loaded the software for my printer Canon MX870 new that I bought and installed in October 2010 and has been done since then. I removed and reloaded the software of the printer on three different occasions but the problem persists.

    Hi frankb911,

    Please see the thread with a similar problem and fix possible:

    http://answers.Microsoft.com/en-us/Windows/Forum/windows_vista-performance/there-is-no-disk-in-the-drive-please-insert-a-disk/b9a130b2-4261-4385-a51f-28005f209a1d

    I hope this helps!

  • Problems with the updated images licensed library

    Images of Adobe are not updated in the library when a license always naked and the watermarks, unless it is downloaded to the desktop. When will this problem be resolved?

    It's slow the flow of work and extremely frustrating when the seamless integration was an important reason regarding, reason why we bought this package.

    Everyone knows about this problem?

    Go to Adobe Stock

    Hello

    Please see Stock troubleshooting: FAQ: how to solve problems with images of Stock?

    Hope that helps!

    Kind regards

    Sheena

  • Serial number of my camera problem getting the software.

    I have a Canon Powershot SX110 IS digital camera that was given to me by a photographer. It doesn't have the serial number for her, and niether is it on the camera as it should be. It is unreadable and I want the Zoombrowser Canon offers free of charge, but to get it for free, I have to enter the serial number. Is it possible that I can get this essential software without a serial number or necessary?

    Hi Matthew,

    I recommend you contact Canon support & see if they can provide you with the serial number of your camera:

    http://USA.Canon.com/Cusa/consumer/standard_display/contact_us_consumer

    Hope the helps of information.

  • My Windows 7 task scheduler has problems getting the error 'Planner services is not available.

    When I opened my task scheduler, it says "selected task (0) no longer exists", said then "Scheduler service is not available" and it can then reconnect, what I'll do. can anyone help. PLEASE, I BEG YOU!

    Hi Abuh_986,

    Because you are always faced with the question, try to perform a repair installation (upgrade on-site) to solve the problem.

    When you perform an upgrade on the spot, it takes the same amount of time to do the upgrade as to reinstall the operating system. In addition, some of your custom Windows settings may be lost through this process.

    Run a repair installation will restore the current installation of Windows to the version of the installation DVD. It also requires the installation of all the updates that are not included on the installation DVD.

    Note: a repair installation will not damage files and applications that are currently installed on your computer. However, you can take a backup of the data.

    You can check the article to perform a repair installation after you close all running applications:

    How to perform an upgrade on the spot on Windows Vista, Windows 7, Windows Server 2008 & Windows Server 2008 R2

  • Problem getting the pageFlowScope number parameter in backing bean

    Hi, I use a taskflow with parameters of type oracle.jbo.domain.Number.

    I want to replace a method in my grain of support in order to take the value of the parameters pageflowscope.

    (inMarkNbr, inColorNbr)

    But I take as the result the following error:

    Error: oracle.jbo.domain.Number cannot be cast to impossible

    Error type: class java.lang.ClassCastException

    StackTrace:

    view.backing.pages.AutoProfile8.doApply(AutoProfile8.java:17)

    Could you help me please?

    //Some Imports
    import java.sql.SQLException;
    import java.util.Map;
    import javax.faces.event.ActionEvent;
    import oracle.adf.model.OperationBinding;
    import oracle.adf.view.rich.context.AdfFacesContext;
    import oracle.adf.share.logging.ADFLogger;
    import oracle.jbo.domain.Number;
    
    public class AutoProfile8 extends Auto{
    
        private static ADFLogger logger = ADFLogger.createADFLogger(AutoProfile8.class);
    
        public AutoProfile8() {
            super();
        }
        // here is the line of error
        @Override
        public void doApply(ActionEvent actionEvent) {
         
            Map<String, Object> map = AdfFacesContext.getCurrentInstance().getPageFlowScope();
            Object markObj = map.get("inMarkNbr");
            Object colorObj = map.get("inColorNbr");
         
            Number mark;
            Number color;
         
            try {
                mark = new Number(markObj);
            } catch (SQLException e) {
                logger.severe("Unable to find mark Number", e);
            }
         
            try {
                color = new Number(colorObj);
            } catch (SQLException e) {
                logger.severe("Unable to find color Number", e);
            }
         
    
            System.out.println(mark.getValue() + " "+color.getValue());
         
            if(mark != null)
            {
                OperationBinding oper1 = (OperationBinding) ADFUtils.findOperation("CallMethodFromAplModule");
                oper1.getParamsMap().put("markNbr", mark.getValue());
                oper1.getParamsMap().put("colorNbr", color.getValue());
                oper1.execute();
            }
         
            super.doApply(actionEvent);
        }
    }
    
    

    paste here shoot to screen with your definition of parameters TF and tell us, what exactly is the line

    view.backing.pages.AutoProfile8.doApply(AutoProfile8.java:23)

    ClassCastException occurs?

    I suspect that you are a parameter defined as impossible. The exact type of the parameter must be oracle.jbo.domain.Number, exactly that.

    In addition, a color as a set mark

    Mark oracle.jbo.domain.Number;

    color oracle.jbo.domain.Number;

    mark = new oracle.jbo.domain.Number (markObj);

    ...

Maybe you are looking for

  • Question: smart album with no keywords

    Hello I keep my pictures organized by keywords. When organizing my library in iPhoto, I used a smart album named any keyword with condition 'keyword is not. Is there a way to do this in Photos? It seems there is no option to 'none '. Thank you

  • HP pavilion 15-n019TU: bluetooth, wifi, wireless driver button does not

    Hello Bluetooth, wifi and wireless button drivers do not work on my pc for 64-bit windows 8.1 single language. I could not find the following hardware ID PCI\VEN_FF42 & CC_0D1100PCI\VEN_FF42 & CC_0D11PCI\VEN_FF42PCI\CC_0D1100PCI\CC_0D11 USB\VID_0E8D

  • Accidentally uninstalled EDT Ware Touchpad Support

    Hello! I have an Acer laptop V3 - 772 G-9820. I accidentally uninstalled the EDT Ware support for my touchpad, and now I can't use my touchpad correctly. I can't drag the side or use two fingers down a Web page. I attempted to try and re - download,

  • SUPERANTISPYWARE & BSOD VISTA ULTIMATE X 86

    The installation or operation of SuperAntispyware Free Edition still cause a BSOD? I have not tried to install it almost a year. Thanks in advance for any help. It is the responsibility and the duty of everyone to help deserving disadvantaged and unf

  • How to change an existing in ASDM VPN tunnel?

    I currently have a VPN tunnel together upwards, but to change some of the configurations as making ikev2, replacing the SHA512 hash and change it in the DH group 14. I intend to do this in ASDM. I already created a group of tunnel ikev2 that I put th