Skip to content

Default temperature unit to Fahrenheit for US locales (fixes #11)#12

Open
sholsinger wants to merge 1 commit into
freakified:masterfrom
sholsinger:locale-temp-unit-default
Open

Default temperature unit to Fahrenheit for US locales (fixes #11)#12
sholsinger wants to merge 1 commit into
freakified:masterfrom
sholsinger:locale-temp-unit-default

Conversation

@sholsinger

Copy link
Copy Markdown

Summary

  • Currently, SETTING_TEMP_UNIT defaults to Celsius for everyone. US users see Celsius on first install and, unless they discover the setting hidden in the config page, they never get Fahrenheit.
  • This PR seeds the default from navigator.language so users on en-US / es-US get Fahrenheit + MPH + inches out of the box. Everyone else is unchanged.

Changes

  • config-page/src/utils/defaultSettings.ts — locale-aware default so the settings UI shows the correct pre-selection.
  • src/pkjs/index.js — locale-aware fallback in sendDataToWatch() for the case where the user hasn't opened the config page yet (settings.SETTING_TEMP_UNIT === undefined). Any explicitly saved value still wins.

Kept the locale list narrow (US only) because this setting bundles temp + wind + rain, so a misdefault degrades three fields at once. Happy to broaden it (Bahamas, Belize, Cayman, Liberia, etc.) if you'd prefer.

Test plan

  • Fresh install with phone locale en-US: verify temp shows in °F and wind in MPH before opening config.
  • Fresh install with phone locale en-GB / de-DE / etc.: verify temp shows in °C and wind in KM/H (no regression).
  • Open the config page as a US user with no saved settings: verify the Weather Units dropdown pre-selects "Imperial".
  • User who has explicitly saved Metric on a US phone: verify their choice is respected (no regression).

Fixes #11

The temperature unit setting previously defaulted to Celsius for all
users, even those whose phone locale is en-US or es-US. Since the user
has to open the config page to change it, US users see Celsius on first
run and never learn the setting exists.

Seed SETTING_TEMP_UNIT from navigator.language in two places:
- config-page/src/utils/defaultSettings.ts — so the settings UI shows
  the correct default selection.
- src/pkjs/index.js — so weather displays in the right unit even before
  the user has opened the config page.

Kept narrow (US only) since the setting flips the whole imperial bundle
(temp + wind + rain), and Fahrenheit-preferring locales outside the US
are rare enough that a misdefault is worse than the current behavior.

Fixes freakified#11
@sholsinger

Copy link
Copy Markdown
Author

I admit, after having Claude help out with this, I realized this isn't really necessary.

I think what happened was that after switching to another watchface, all my settings were lost and I couldn't find the unit setting again. 🤦🏼‍♂️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Respect locale when displaying temperature

1 participant