Zakelijke Week Dag

AI-generated summary

The discussion, titled “Business Week Day” under the Translations category, revolves around the localization of the start of the business week in Discourse. SafaAlfulaij highlights a hardcoded string “start_of_next_busniess_week” that assumes Monday as the start, which is problematic for countries where the week starts on Sunday or another day. sam notes that several countries, including Israel and the UAE, begin their week on Sunday. martin proposes using Moment.js to dynamically determine the start of the week based on the user’s locale, which already handles localization. gerhard suggests making the start day a user-level setting, as language doesn’t always align with the local week start, and not all sites use user locale settings. martin agrees and plans to implement a user option with a default similar to timezone settings. SafaAlfulaij adds that language and locale are distinct, affecting date, time, and number formats, and will open a separate topic to explore broader localization needs.

While translating I found out in the bookmarks reminders this string: “start_of_next_busniess_week”
https://github.com/discourse/discourse/blob/master/app/assets/javascripts/discourse/app/controllers/bookmark.js#L264

This can’t work for every country in the world as many countries have Sunday as the start, or any other day.
As per @gerhard suggestion, I’m opening this topic to discuss possible solutions.
The proper solution would be to have a configuration option per user to define the start of the business week, and can have a default of Monday. (And then we would change “Monday” to “Start of Business Week” with a link to the configuration option that appears upon selecting that option).

I though also if the site admin will configure this, but thought that many forums are not country-bound.

Any other thoughts?

5 likes

Understood, this is a tricky issue for all the countries that start the week on a Sunday. Israel, UAE, Nepal, Malaysia, Saudi and Iran fall in this bucket.

I guess we should consider some sort of setting for “first day of the week”. @martin any ideas of how we should approach this?

Simplest would be just to have a simple way of removing the option, not sure.

3 likes

Not sure why I didn’t look into this properly when I did this; there is an easy way to get the beginning day of the week in moment.js:

moment().startOf('week').day()

Since we already localize moment, this works great. Just tested it and with my site language set to Hebrew the start of week comes up as 0 (Sunday), whereas if I set it back to English it goes back to 1 (Monday). Should be fairly simple to get this running next week.

If we really wanted to we could have a site-level setting for “start day of week”, not sure if we would want something like that for calendar? Though this probably won’t be desirable when users can set their own locale.

3 likes

I think it should be a user option. Detecting it by language might not be enough as the start of the week varies by county. Furthermore, not every site enables the user locale setting. Maybe use momentjs to preselect the value like we do with timezone?

4 likes

Fair enough; I will make it a user option with sane default selection same as timezone!

3 likes

Great.

And as a side note, language is different than locale as I might be in UK but use the site in Arabic.
This is also something systems take into consideration as they have separate options for locale and UI language.

This mainly affects date, time and numbers, which I’ll open another topic to discuss and see if there is a real need to change it (as it affects many many parts of Discourse).

4 likes