We have moved to a new Sailfish OS Forum. Please start new discussions there.
8

Bug: QLocale::system() returns incorrect locale while run in debugger

asked 2014-01-06 12:27:27 +0200

QLocale::system().name() returns "C" instead of language selected by the device user when run in debug mode using remote device target.

Same code works as expected when application is run on device by launching it from application menu.

edit retag flag offensive close delete

Comments

Maybe because like at harmattan(n9) it uses different user for development and not nemo(main user AFAIK)

ZogG ( 2014-01-06 23:15:01 +0200 )edit

No, the development user is still 'nemo'.

kaltsi ( 2014-01-09 09:46:59 +0200 )edit

3 Answers

Sort by » oldest newest most voted
2

answered 2016-12-19 00:00:34 +0200

updated 2016-12-19 00:01:06 +0200

I know this is a thread necromancy, but this issue is still present, and I needed to spend some time to figure out a workaround. Having an answer here might save some time for someone in the future.

  • Go to the projects menu on the left bar.
  • Select run
  • Add a LANG variable to the Run environment

image description

edit flag offensive delete publish link more

Comments

there is also handy button called "Fetch Device Environment"

coderus ( 2016-12-19 09:36:59 +0200 )edit

Ah, thanks man!

martonmiklos ( 2016-12-19 09:46:13 +0200 )edit

Oh man, @martonmiklos, thanks a lot, that saved a lot of time!

micuintus ( 2017-01-24 01:57:10 +0200 )edit
1

answered 2014-01-09 12:16:34 +0200

kaltsi gravatar image

The root cause for the problem is a hack we had to do to get application output to Qt Creator.

The version of qtbase (qt5) we have on the device/emulator currently does logging to console only if it has a tty, otherwise logs are redirected to journald. In order to get application logs to Qt Creator the logs need to be written to console.

We made a hack to Qt Creator to create a fake tty for the application by running the app using the 'script' command. Looks like a side effect of this is that LANG environment is not set anymore, which is why you only see the default 'C' instead of the correct LANG.

There's a fix to the console logging in qtbase already. Once the fix ends up on the device, we also need an update for the Qt Creator in the SDK to remove the aforementioned hack.

edit flag offensive delete publish link more

Comments

Since this still doesn't seem to work (QLocale::system().name() gives "C", getenv("LANG") gives nothing), is there any workaround available?

ToniR ( 2014-10-12 20:25:11 +0200 )edit
0

answered 2014-01-09 09:48:59 +0200

kaltsi gravatar image

Hi, just for clarity and so that I can reproduce this, can you explain how do you run your application in debug mode?

Thanks for the bug report, we'll look into this.

edit flag offensive delete publish link more

Comments

I have configured "Build & Run" kit in SDK for SailfishOS-armv7hl target and my phone as a device.

I run it by selecting Build/Run from SDK, so "debug mode" is a wrong word, sorry about that. Name() return value is printed to SDK console from main() with:

qDebug() << QLocale::system().name()
iiska ( 2014-01-09 10:01:37 +0200 )edit
Login/Signup to Answer

Question tools

Follow
3 followers

Stats

Asked: 2014-01-06 12:27:27 +0200

Seen: 1,450 times

Last updated: Dec 19 '16