WayfireWM / wf-config

A library for managing configuration files, written for wayfire
https://wayfire.org/
MIT License
18 stars 19 forks source link

Config file saved with wrong locale #46

Closed timgott closed 1 year ago

timgott commented 3 years ago

Options are parsed with the correct US locale, but written to the config file using the system locale.

In the de_DE.UTF-8 locale, all double values are written with a comma instead of a period as decimal separator. For some reason, double options can be changed during a session, but wayfire cannot read the option on next start and they will be reset to default.

It looks like a simple way to fix this would be to set the correct locale in all option_type::to_string methods.

ammen99 commented 3 years ago

Options are parsed with the correct US locale, but written to the config file using the system locale.

In the de_DE.UTF-8 locale, all double values are written with a comma instead of a period as decimal separator. For some reason, double options can be changed during a session, but wayfire cannot read the option on next start and they will be reset to default.

It looks like a simple way to fix this would be to set the correct locale in all option_type::to_string methods.

Sounds like a good solution to me. We should only need this for doubles, and then we should make other option types rely on the double parsing functions (if they don't already), so that we don't have to repeat the fix.

timgott commented 3 years ago

This is not a problem anymore for me, because now wcm ignores the system locale for some reason (I rebuilt it in the meantime).

Previously it used commas as decimal separator in the UI (e.g. "0,100") but now it shows "0.100". It saves the config file with the same format as in the UI, which is now valid.

LANG=de_DE.UTF-8 wcm or LC_ALL=de_DE.UTF-8 wcm doesn't change the number format the UI uses for me anymore. Other Gtk apps still use the , format.

Has anything been changed about this, I didn't see any relevant commits?