Open mrstegeman opened 3 years ago
This is definitely a pretty obvious miss, doesn't make any sense for it to default to Celsius for US. Furthermore, I don't see an option to change this anywhere unless I'm blind.
EDIT: @mrstegeman I just managed to fix mine by changing my settings > Personal Info > Locale from English (United States) to just "English" and then for good measure English (Europe) and English (World) before changing it back to English (United States). When I went back to the dashboard things now show properly as Fahrenheit.
This is obviously just a workaround and the upgrade to 20 clearly isn't properly seeing this setting initially.
The issue seems to be that weather_status is looking for the user's locale in the oc_preferences table.
In your personal 'preferences' page, the locale shown by default is determined by NC based on your browser settings, and is probably correct.
Changing the locale preference to something else, then changing it back to the same value that was displayed when you started, creates an entry for your user account in oc_preferences. Once this entry exists, weather_status uses the appropriate temperature indicator for your locale.
All of the users on my server show "English (United States)" in the personal locale page, but the account I reset using the above process is the only one that displays the temperature in Fahrenheit, and is the only one with a 'locale' entry in oc_preferences.
# mysql nextcloud -e "select * from oc_preferences where configkey = 'locale';"
+---------+-------+-----------+-------------+
| userid | appid | configkey | configvalue |
+---------+-------+-----------+-------------+
| mmccarn | core | locale | en_US |
+---------+-------+-----------+-------------+
Ah, that did the trick! Thank you.
I just updated my server to v20.0.8 and this issue is still present. Your suggested workaround was successful, however, it would be nice if this worked as intended without such a manual intervention.
Is this Issue still valid in NC21.0.2? If not, please close this issue. Thanks! :)
Yes, this issues is still present in 21.0.2. I just got around to dealing with it on newish install. and like dohlin mentioned changing my settings > Personal Info > Locale from English (United States) to English (Europe) and English (World) and then back to English (United States), things now show properly as Fahrenheit.
Has to be done for each user of course.
cc @eneiluj
This issue is still present in 22.2.3.
A little bash and mysql helps fix this.
MYSQL="mysql -u [USER] -h [HOST] -pPASS [DBNAME] -BNe "
for USER in $($MYSQL 'select distinct(userid) from oc_preferences'); do
echo Adding locale to $USER;
$MYSQL 'insert into oc_preferences set userid="'$USER'",appid="core",configkey="locale",configvalue="en_US"' ;
done
It'll show a duplicate key error if it already exists.
At least you can automate fixing it now.
Still an issue on 23.0.3 i have to go to locate English (United States) is already select and still show in C then I click on somthing else under the locate and select English (United States) again and shows in F anyway
24.0.5 and it is still present
Hi, please update to 24.0.9 or better 25.0.3 and report back if it fixes the issue. Thank you!
My goal is to add a label like e.g. 25-feedback to this ticket of an up-to-date major Nextcloud version where the bug could be reproduced. However this is not going to work without your help. So thanks for all your effort!
If you don't manage to reproduce the issue in time and the issue gets closed but you can reproduce the issue afterwards, feel free to create a new bug report with up-to-date information by following this link: https://github.com/nextcloud/server/issues/new?assignees=&labels=bug%2C0.+Needs+triage&template=BUG_REPORT.yml&title=%5BBug%5D%3A+
@szaimen, I've updated my instance to 25.0.3 and still see Celsius even though I'm in the United States.
and like dohlin mentioned changing my settings > Personal Info > Locale from English (United States) to English (Europe) and English (World) and then back to English (United States), things now show properly as Fahrenheit.
Does this work?
Yes, changing my locale from English (United States)
to English (Canada)
and then back again results in the temperature being correctly displayed in Fahrenheit.
This is still an issue in 27.0.0
This is not an area of NC I'm very familiar with, but I poked around a bit.
This app relies on getLocale()
from nextcloud-I10n
:
And I think it's returning the default of en
when not populated otherwise:
Which never matches anything here that is designated here to be in Fahrenheit:
There's a lot more logic on the server-side, but I'm not sure how much - if at all - nextcloud-I10n
draws on it - e.g.
I wonder if setting default_locale
in config.php
to en_US
would work for some people?
Also, for some use cases in the comments above, force_locale
might be another option.
The Personal settings local is populated here:
But I don't have time or inclination to dig much deeper today.
I actually took the approach joshtrichards suggested. I guess this is only relevant if you do not have international users but I threw this in at the bottom of config.php:
'default_locale' => 'en_US', 'force_locale' => 'en_US',
Logged in as a new user and added a location and it was F instead of C. I'm not sure if the force_locale is necessary and I didn't test it with just default_locale on its own. Maybe someone else can give that a go?
New install on Archlinux, nextcloud 27.0.2 and the issue is still present. (Apache/2.4.57 (Unix) OpenSSL/3.1.2 mod_fcgid/2.3.9 PHP/8.1.23 if it matters) The Locale was set to English (United States) but the weather app displayed in deg C. This must be an issue where the weather isn't getting initialized based on the initial Locale and is only getting the update when the Locale is changed (similar to an on-change event or whatever it uses).
This isn't a show-stopper, but rather a frustrating annoyance for new users. The reason being that the interface should make it dead-bang-simple to choose deg C or deg F based on user preference and not have some magic buried in a Locale setting forcing the user to take whatever it attached to the Locale setting. The long and short of not having a simple setting for new users is users are left to search the web to find out how to change a simple temperature reading -- that they are presented with as a first-impression of Nextcloud.
From the first-impression standpoint it may merit a fix to make the first use a straight-forward as possible.
... The Locale was set to English (United States)...
The problem is that the locale is not actually set to "English (United States)" as you would expect from the display on the "Personal Info" page.
Instead, the locale was detected as "English (United States)" (en_US) by Nextcloud, but is being detected by the weather app as "en".
There is no way to tell from the Personal Info page whether the user's locale was detected or set.
Is your feature request related to a problem? Please describe. The weather widget on the dashboard shows the temperature in Celsius, regardless of the locale. In the US, for example, I would expect it to show degrees Fahrenheit by default.
Describe the solution you'd like Default to degrees Fahrenheit when the locale is
en-US
, or allow user to select their desired units.