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
New Contributor
rashmisharma2008
Posts: 5
Registered: ‎06-28-2013
My Device: z10

problem in localization

While making Locale files 1) Some of the Locale files are not found in (bar-descriptor.xml file->Localization). so how to add tr files for the below mentioned locales. zh-TW · fr-BE · dE-CH · en-SG · es-AR · es-MX · es-US · id-id · en-ZA, As I analysed the localization code, For fr-BE it is picking data from the fr-FR file, similar ways it will pick de-DE values for de-CH locales. 2) My second query is locale- de-AT is not found in Simulator settings as well as device language settings. 3)My third query is * Pt-br is coming in language code only , so it will not take care of region. While retrieving the locale name from method name (QLocale().Name()), it will give the pt-BR. Please provide us the sample code, for localization, in which localization i implemented fully

Retired
robbieDubya
Posts: 418
Registered: ‎07-18-2012
My Device: Q10

Re: problem in localization

Hi,

 

For language/region combinations not supported in the dropdown - you should be able to manually add new languages in the source view. It's just a comma separated list.

 

To deal with QLocale not returning what's expected (which i expect to be fixed in a future release), you can use the bps/region API to extract more accurate information - to build a better name to open your translation files with...

 

Hope this helps!

 

 

--
Rob is no longer associated with BlackBerry.
New Contributor
rashmisharma2008
Posts: 5
Registered: ‎06-28-2013
My Device: z10

Re: problem in localization

Is the localization works only on the language code 

For example : if fr_ca file is added through bar.xml , still it picks values from the fr-fr 

New Contributor
rashmisharma2008
Posts: 5
Registered: ‎06-28-2013
My Device: z10

Re: problem in localization

Can you give piece of sample code
Retired
robbieDubya
Posts: 418
Registered: ‎07-18-2012
My Device: Q10

Re: problem in localization

[ Edited ]

Make sure there aren't any autogenerated QLocale references changing the language;

 

try code like this; keeping in mind that it is incomplete. a. bps left initialized, b. doesn't consider region/language change events, c. ignores error codes (BAD!!!)...

 

Q_DECL_EXPORT int main(int argc, char **argv)
{
    QString loadLocale;
    char * language = 0;
    char * country = 0;

    bps_initialize();

    locale_get(&language,&country);
    qDebug() << "Locale:" << language << country;

    loadLocale += language;
    loadLocale += "_";

    bps_free(language);
    bps_free(country);

    region_get(&language,&country);
    qDebug() << "Region:" << language << country;

    loadLocale += country;

    bps_free(language);
    bps_free(country);

    Application app(argc, argv);

    QTranslator translator;

    if (translator.load("GetRegion_" + loadLocale, "app/native/qm")) {
        app.installTranslator(&translator);
        qDebug() << "Should have loaded"<< loadLocale;
    } else {
        qDebug() << "Did not work!";
    }

    . . .
    . . .

 

--
Rob is no longer associated with BlackBerry.