Skip to content
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

Set 24h format based on language #84

Closed

Conversation

meisenzahl
Copy link
Member

@meisenzahl meisenzahl commented Jun 25, 2020

I'm working on a solution to resolve #70

I still have to find a way to change the GLib.Settings for another user.

@danirabbit danirabbit requested a review from tintou July 7, 2020 18:58
@danirabbit
Copy link
Member

I guess it's probably a shorter list of locales that want 12 hrs than 24 hrs right?

And I think it's probably more highly correlated to physical location than language. For example for Spanish it appears that Spain would use 24hr but Mexico would use 12hr. From Wikipedia it looks like the list of 12-hr using countries are:

  • The UK
  • Ireland
  • The US
  • Canada (but not Quebec)
  • Australia
  • New Zealand
  • India
  • Pakistan
  • Bangladesh
  • Malaysia
  • Malta
  • Egypt
  • Mexico
  • Philippines

@meisenzahl
Copy link
Member Author

The location is currently not configurable. Is this a design decision?

Is the time zone set based on the current location (libgeoclue)?

The time format could then be set automatically using the same logic.

@danirabbit
Copy link
Member

No, it's just a missing feature. I agree we could have a screen to set the timezone and format and on this screen we could use GeoClue to try to guess defaults, but that depends on having working internet. so maybe we also need a screen to select a wireless network if internet is not already connected

@meisenzahl
Copy link
Member Author

I added a screen to set the timezone. @danrabbit what's your opinion on setting the clock format based on timezone?

@meisenzahl
Copy link
Member Author

List of countries using 12 hour format

@danrabbit I didn't find the link to the wikipedia article you mentioned. Could you provide the link for reference?

@tintou
Copy link
Member

tintou commented Sep 18, 2020

You don't need to hardcode the list of countries to get the 12h/24h, you can check if the current locale is using 12h by default by checking if Posix.nl_langinfo (Posix.NLItem.T_FMT) contains %r or %l or %I.

@meisenzahl
Copy link
Member Author

meisenzahl commented Sep 19, 2020

@tintou thanks for your feedback. This allowed me to simplify the code.

Do you know if it is possible to change the GLib.Settings for another user?

@danirabbit
Copy link
Member

@meisenzahl I guess what we probably want to do is write to accounts service and use the settings daemon to keep things in sync like we do with keyboard input methods

@meisenzahl
Copy link
Member Author

set_timezone (), set_clock_format () and set_keyboard_layout () in MainWindow should all be implemented as async methods. @danrabbit is there a common way in Vala to chain async methods?

@cassidyjames
Copy link
Contributor

@meisenzahl could you resolve conflicts here?

@meisenzahl
Copy link
Member Author

@cassidyjames done 🙂️

@marbetschar
Copy link
Member

@meisenzahl any chance you got some time you resolve the conflicts here ... again? 😅

@meisenzahl
Copy link
Member Author

@marbetschar done ✔️

@marbetschar
Copy link
Member

@meisenzahl can you clarify how this can be tested? I compiled and started the freshly compiled app from a logged in user with 24h clock running sudo io.elementary.initial-setup. Then I selected US / New York during the initial setup as location. After the test user was added, I logged out and logged in again using the test user - but the clock is still set to 24h format.

@meisenzahl
Copy link
Member Author

@marbetschar this only works in conjunction with elementary/settings-daemon#10

But I have not tested this for a long time. It might be broken...

@jeremypw
Copy link
Collaborator

set_timezone (), set_clock_format () and set_keyboard_layout () in MainWindow should all be implemented as async methods. @danrabbit is there a common way in Vala to chain async methods?

You can chain async methods by using the yield keyword.

@danirabbit
Copy link
Member

@meisenzahl apologies for asking you to resolve conflicts here yet again 😅 Now that we have the network view merged this should be unblocked

@meisenzahl
Copy link
Member Author

@danrabbit done ✔️

@danirabbit
Copy link
Member

Pushed to a branch on the project so it's easier to collab: #142

@danirabbit danirabbit closed this Apr 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Status: Done
Development

Successfully merging this pull request may close these issues.

German user accounts should use 24h time by default
7 participants