-
-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add options to override locale and number group sep. #7337
Conversation
Can you add a screenshot? |
I think it's quite obscure to know what happens without in-depth knowledge of locales. I'd be in favour of
|
The preview is actually a good idea, I was going to make it. |
So how would one get to the desired result of no separators but local date representation? |
AFAIK: no way |
... unless you change the settings at the OS level |
Maybe it's worth a try to overwrite |
Is that supported on not-unix? |
I've got no idea, that's why I wrote "test it for portability". Options that I can see at the moment
|
Just thinking... I like the direction this is going in general, but for attribute formatting my preference would probably be:
What's everyone elses thoughts? |
I don't really mind if it is enabled by default or not as long as it's possible to enable it. Thousands grouping increase readability and it is an important feature for visually impaired and older people. |
I'm still afraid Germans (just an example) with a preference for |
I for one never missed the thousands separator - and now that it's there I find it annoying - not as much as I would hate mm.dd.yyyy - but close ;) Adding a option to get rid of it is nice. Thanks. BTW I use ISO yyyy-mm-dd where I can (as it sorts well lexically), then dd.mm.yyyy, which is at least still in reversed order, but no idea why anyone would ever consider m/d/yyyy a preferable order. |
Ok, I don't think the situation is too bad now:
|
Hi @elpaso - thanks for looking into this and working on it! In Switzerland, we have the problem that both the "." and the "," can be used as decimal separator. However, the system locale "de_CH" forces one into using the ",". Something that the majority of the Swiss QGIS users probably don't like. We had the "." as decimal point for almost two decades now, and suddenly everything switches to the ",". Very annoying for us. Can we make also the decimal separator configurable? See https://en.wikipedia.org/wiki/Decimal_separator where you can see that some provinces in Switzerland use the "." and some the ",". |
@andreasneumann the decimal point is configurable: just choose a locale which uses a dot as decimal point (such as EN_us for |
@elpaso - ok that's what we'll have to do. Hope it doesn't have any other side effects. |
@andreasneumann there shouldn't be any side-effect, but you can check it right now in you 3.2 installation: just run this code right after launching QGIS:
this is in effect immediately but you'll need to re-open the attribute table of the forms to get them updated. |
... the translations available in QGIS.
@@ -1142,9 +1142,18 @@ int main( int argc, char *argv[] ) | |||
/* Translation file for QGIS. | |||
*/ | |||
QString i18nPath = QgsApplication::i18nPath(); | |||
QString myUserLocale = mySettings.value( QStringLiteral( "locale/userLocale" ), "" ).toString(); | |||
QString myUserTranslation = mySettings.value( QStringLiteral( "locale/userLocale" ), "" ).toString(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we drop the outdated "my" prefix here?
src/app/main.cpp
Outdated
QLocale currentLocale; | ||
if ( myShowGroupSeparatorFlag ) | ||
{ | ||
currentLocale.setNumberOptions( currentLocale.numberOptions() &= !QLocale::NumberOption::OmitGroupSeparator ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this be ~QLocale::NumberOption::OmitGroupSeparator
?
src/app/qgsoptions.cpp
Outdated
@@ -96,6 +96,8 @@ QgsOptions::QgsOptions( QWidget *parent, Qt::WindowFlags fl, const QList<QgsOpti | |||
connect( mCustomVariablesChkBx, &QCheckBox::toggled, this, &QgsOptions::mCustomVariablesChkBx_toggled ); | |||
connect( mCurrentVariablesQGISChxBx, &QCheckBox::toggled, this, &QgsOptions::mCurrentVariablesQGISChxBx_toggled ); | |||
connect( buttonBox, &QDialogButtonBox::helpRequested, this, &QgsOptions::showHelp ); | |||
connect( cboGlobalLocale, static_cast<void ( QComboBox::* )( int )>( &QComboBox::currentIndexChanged ), [ = ]( int ) { updateSampleLocaleText( ); } ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI (not a blocker) you can use qgis::overload< int >::of( &QComboBox::currentIndexChanged )
instead - it's a bit more compact than the static_cast version
src/app/qgsoptions.cpp
Outdated
QLocale locale( cboGlobalLocale->currentData( ).toString() ); | ||
if ( cbShowGroupSeparator->isChecked( ) ) | ||
{ | ||
locale.setNumberOptions( locale.numberOptions() &= ! QLocale::NumberOption::OmitGroupSeparator ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Again - should be ~, not !
I realize this is an old thread, but I got here via search engine and seems to have the most relevant discussion (I'm not sure if I should open a new issue). I experience a bit of a bugger issue with I do appreciate the translation and respecting system locale. I also like the idea being able to set program locale independently of the system locale (i.e. I'd set it into Finnish on a company machine that's English). It appears to be the internal reprsentation isn't in some invariant form and things go wrong. I don't know enough to tell where's the problem (calling command line software?). I have produced the geotiff raster data set using
< edit: It appears I was too hasty. QGIS crashed and now that I've restarted with |
@veikkoeeva please file and issue and attach a sample project we can use to reproduce the issue. |
@m-kuhn would you like to give this a try?