Skip to content

Simplify all times shown to not use any words, just exact numbers #184

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

Merged
merged 2 commits into from
Oct 31, 2024

Conversation

rosa
Copy link
Member

@rosa rosa commented Oct 30, 2024

So everything is hardcoded to English, and we don't need to set a locale or have mixed-language phrases all over the place. Arguably, having the more "human-friendly" times such as "10 minutes ago" was not that useful in the end, when you're trying to get the exact time a job was enqueued to compare it with another time and so on. I found myself hovering over these times super often, so in this way, we just simplify the whole thing.

This would fix the issue described in #156 and would avoid having to mess up with locales.

@rosa rosa force-pushed the times-without-words branch from 5a219c5 to 514e2b5 Compare October 30, 2024 19:34
rosa added 2 commits October 30, 2024 20:50
So everything is hardcoded to English and we don't need to set a locale
or having mixed-language phrases all over the place.
We don't need that anymore now that everything has been hardcoded to
English.
@rosa rosa force-pushed the times-without-words branch from 56a4223 to 9d3d85a Compare October 30, 2024 19:50
@rosa rosa merged commit 9152169 into main Oct 31, 2024
10 checks passed
@rosa rosa deleted the times-without-words branch October 31, 2024 10:50
@matthewbjones
Copy link

@rosa, are you open to this being a config option? We actually found the English words a lot more useful than what it is now currently doing. When looking at "In Progress jobs", now there are just a bunch of date/times in UTC, and you no longer can easily see how long a job as been running for.

Also we now find that the "Recurring tasks" tab is less helpful, as it is just displaying date/times in UTC, and now it is not easy to determine "how long ago" a job ran, and how long until it'll run again, etc.

We actually liked that you could hover over the words and see the date/time if you needed.

@rosa
Copy link
Member Author

rosa commented Nov 15, 2024

@matthewbjones yeah, that's a good point; we've been using this for a bit now in production, and I find myself also missing the words 😅 The problem is the annoyance with the locale, having to set it to English and then having to do ugly stuff to avoid crashing when English is not available 😅 I didn't like that code at all.

I basically want a way to use the words helpers but force them to be in English without even bothering to check the locale 😆 This doesn't seem possible in Rails right now... but maybe we can do something around it... I think a config option for this is too heavy... let me think about it a bit more.

@matthewbjones
Copy link

matthewbjones commented Nov 15, 2024

@rosa I can try to work on this. FWIW, I forked and reverted 514e2b5 without reverting 56a4223, and the UI still works in English, and the full test suite passes.

I'll play around with things in my fork. I agree, ideally, it would "just work" without any config options.

@matthewbjones
Copy link

matthewbjones commented Nov 15, 2024

@rosa Rails can be configured to fallback to another locale when translations are missing: https://guides.rubyonrails.org/v5.2.0/configuring.html#configuring-i18n

So without forcing a locale (aka, reverting 56a4223), you can run Mission Control in a Rails app with non-English locale set as the default, and have the usual "Translation missing: de.datetime.distance_in_words.x_days ago" message, but if in the Rails app you do config.i18n.fallbacks = [:en], (or within Mission Control the code does I18n.fallbacks = [:en], then Mission Control still shows English time words.

I'm just now trying to play around with the idea of the fallbacks support with I18n and see if there is an around_action of sorts that can take advantage. I'm guessing setting I18n.fallbacks = [:en] could have unintended side effects in the Rails app (if Mission Control did that itself)

@matthewbjones
Copy link

@rosa Unfortunately, I wasn't able to come up with a simple/elegant solution

@rosa
Copy link
Member Author

rosa commented Nov 18, 2024

No worries @matthewbjones, and sorry I missed your last comment!

So without forcing a locale (aka, reverting 56a4223), you can run Mission Control in a Rails app with non-English locale set as the default

Yes! That was the first problem we had, because the UI would show mixed languages, English for the hardcoded parts, and whatever locale was set for the texts added by Rails when using the time helpers 😅 #136 . The example there was "enqueued 5 minuten ago". The solution for that was to set English as the locale for Mission Control, but then, that caused trouble for people who don't have English in their locale list: #156 😅

This is why I don't want to mess up with locales, what I'd like here is that the Rails time helpers would use always English words, like hours, minutes, seconds, etc. and not, say, horas, minutos, segundos, which would be all mixed with English words. I haven't spent enough time investigating if there's a way to do this. I had a quick look last week and it doesn't seem so.

@rosa
Copy link
Member Author

rosa commented Dec 2, 2024

@matthewbjones, I think I finally came up with a good way to handle this and go back to the relative, in-words times: #217

@matthewbjones
Copy link

@rosa amazing! Very exciting.

@rosa rosa mentioned this pull request Dec 5, 2024
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.

2 participants