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

Separate messages for the day before yesterday and the day after tomorrow #756

Closed
Menelion opened this issue Apr 29, 2013 · 16 comments
Closed

Comments

@Menelion
Copy link

Creating this issue for discussion as suggested by @ichernev.
In many languages there are separate words for the day before yesterday and for the day after tomorrow:

  • Ukrainian: Позавчора, післязавтра
  • Russian: позавчера, послезавтра
  • French: Avant-hier, après-demain
  • Spanish: Anteayer, Pasado mañana
  • Swedish: Förrgår, Övermorgon
  • German: Vorgestern, Übermorgen

So do we need this in Moment.js?
If the answer is "yes", I can code this out as well as modify corresponding languages and unit tests :).

@ichernev
Copy link
Contributor

This is just for days, not for months, hours etc, right?
So adding 2 new, non mandatory formats in calendar would do the trick.

@timrwood what do you think. We added a bunch of stuff just for strange looking Nepalese numbers, so adding a few lines in moment that calls the new format for 2 day diff makes sense to me.

@Menelion
Copy link
Author

@ichernev, no-no, only for days)
However, the question is: what happens if these messages are not defined for, say, Arabic or Nepalese (these are languages I've got no clue about)? I will do translations for languages I know or barely have an image about but what about the remaining ones?

@ichernev
Copy link
Contributor

Google translate or some other online dictionary maybe. It guessed the day after tomorrow for Bulgarian, and for Estonian it picked a single word, that was different than the word for tomorrow, so I guess quite a few languages have specific words.

I'm just thinking how good is it to use those words instead of the day of week, because their use is not that common and you have to think more to decipher it :)

@Menelion
Copy link
Author

@ichernev, hm :-). Speaking about days of the week brings us to another issue I'd already opened one day: #573.
Here, at least, if you want to say "On Sunday, April 28th", you'd say "On the day before yesterday". If you say "Last Sunday" you would be asked what you meant. This is because in general "Last Sunday" (if today is Tuesday) would mean April the 21st.

@timrwood
Copy link
Member

@ichernev, I imagine it wouldn't be that hard to add in, but "The day before yesterday" seems a lot more verbose than "Sunday". If we do add it, I think it should only be for languages that have a specific word for two days from today and two days before today.

On a side note, I know "last Sunday" is confusing, but what about "last week Sunday" instead? Rather than confusing the first sunday before now and the sunday of the week before today, we can just use the sunday of the week before today.

Also, now that I think about it though, this method should probably be updated to use the localized start of week data. So in locales that start the week on Sunday, it would be "this week Sunday", and in locales that start the week on Monday it would be "last week Sunday"?

@Menelion
Copy link
Author

@timrwood, I planned to render this as "Two days ago" :-).

@ichernev
Copy link
Contributor

ichernev commented May 9, 2013

At least to me "last Saturday" means going back in time the first day that's Saturday. I'm not a native English speaker, so that might not apply for everybody.

About the 2 days ago/from now -- I think it will be useful, only put it for languages that you're sure the phrase is used extensively (for Bulgarian I wouldn't suggest that).

@Menelion
Copy link
Author

Menelion commented May 9, 2013

@ichernev, so if implementing this, should I override calendar function for some languages or...?)

@ichernev
Copy link
Contributor

Just add an additional keys inTwoDays and twoDaysAgo in the needing languages. Then the code should check -- 2 days from/ago, and the key exists -- use it. Otherwise business as usual :)

@Menelion
Copy link
Author

thanks @ichernev, will implement it)

@yo-less
Copy link

yo-less commented Aug 30, 2016

Sorry to reopen the discussion, but has this been somehow implemented in the meantime?

'moment.js' is running as part of the MagicMirror project and in the calendar module it's weird to see that for events that occur tomorrow it gives the German word for tomorrow and in the events that occur the day after tomorrow, it gives the German phrase for "in a day". Now, this is really confusing, because in German "in a day" and "tomorrow" are basically the same thing and the day after tomorrow would be "in two days".

Ideally, instead of "in a day" it would give the German "übermorgen" (and also "vorgestern" for "the day before yesterday" but since the calendar module only shows events that are coming up, it doesn't really bother me at this stage 😄). I'm not familiar with the moment.js framework, but is there a quick fix I could code into my local files?

@maggiepint
Copy link
Member

I think this can be done by extending calendar. See #3175

@ichernev
Copy link
Contributor

@yo-less you also wanted to change the german locale? Either use locale inheritance or provide a pr for that #2774

@yo-less
Copy link

yo-less commented Aug 30, 2016

Wow, you guys are fast!

@maggiepint which calendar.js file would I be editing? The one in /src/lib/locale or the one in /src/lib/moment?

Well, thanks to both of you. I have tried playing around with the moment.js package but I need to find out first how I can make any adjustments that filter through the node.js installation they're using because as of now, changing each and every translation in the 'de.js' file doesn't change anything on my screen.

@maggiepint
Copy link
Member

@yo-less you shouldn't need to edit anything in our source. Use the extensibility that I put in there to define moment.calendarFormat in your source code. Then override the 'de' locale with any additional options you need.

@yo-less
Copy link

yo-less commented Aug 30, 2016

@maggiepint Excellent, that's even nicer than I had anticipated, thanks. Will start experimenting with that. And, again, thanks for the great response time, you guys are awesome ^^

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

No branches or pull requests

5 participants