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

sk.js: Fix l10n issues (czechisms) #5408

Closed
tukusejssirs opened this issue Mar 12, 2020 · 16 comments
Closed

sk.js: Fix l10n issues (czechisms) #5408

tukusejssirs opened this issue Mar 12, 2020 · 16 comments

Comments

@tukusejssirs
Copy link

tukusejssirs commented Mar 12, 2020

Describe the bug

The preposition za in the sense of in in in a minute is a czechism (a word or usage borrowed from the Czech language), therefore the moment’s za pár sekúnd is correct in Czech, and incorrect in Slovak. In Slovak, the correct preposition is o in the phrase.

Expected behavior

For example: use o pár second instead of za pár sekúnd (meaning: in a few seconds).


Update: Another issue is the pred 3 dny which should be pred 3 dňami. Not an issue of moment, but of dayjs, my bad.

tukusejssirs pushed a commit to tukusejssirs/dayjs that referenced this issue Mar 13, 2020
@tukusejssirs tukusejssirs changed the title sk.js: Replace za %s with o %s sk.js: Fix l10n issues (czechisms) Mar 13, 2020
@marwahaha
Copy link
Member

@k2s thoughts?

@k2s
Copy link
Contributor

k2s commented May 13, 2020

  1. the statement in this ticket is not true, it is valid slovak language construct
  2. all was discussed here [locale] (sk) Fix preposition issue (fixes #5408) #5409 (comment)
  3. solution is .replace('za', 'o'), better solution in moment would be to provide context parameter to the translation

@tukusejssirs
Copy link
Author

tukusejssirs commented May 14, 2020

@k2s, although my statement in the OP is not entirely correct, it is partially correct. As the current implementation of the issue in Moment. And as the implementation is not entirely corrent, I think it should be fixed. I have no idea how, but IMHO the output should be always correct.

Your proposed solution (.replace('za', 'o')) is not even a workaround as it leaves the output partially correct, although reversed.

Based on the sources from your comment in #5409 (which are indeed valid) I have wrote the following in a comment:

  • za is used when we talk about a period during which something is done (like He cooked it in an hour.);
  • o is used when we talk about a point in time (like She’s back in a minute.).

Therefore, the current output not correct for o (but correct for za) and if one chooses to use to 'solution', they would get correct output for o, but not for za.

@k2s
Copy link
Contributor

k2s commented May 14, 2020

@tukusejssirs thank you that you try to implement and improve support for slovak language in libraries. in relation to moment library, you need to keep in mind that it is established library, used by many projects and to change something has most of all not break existing code.

name of this ticket says that the returned za value is grammatically wrong which would mean it is bug, it would need fix. that is not true.

to correctly return za or o additional context is required which is not needed for english and that, what I am aware of, is not supported by related moment functions

I understand your desire to have it perfect and the way to achieve it is to create moment plugin which will provide methods with context support.

@dakujem
Copy link
Contributor

dakujem commented Jul 15, 2020

Well, I tried to pass the same: #5206, which was reverted afterwards :-(
I don't believe there are so many Slovak users who would even notice za / o change anyway, so why they keep the incorrect version, I don't understand. Both are valid, though I'd guess that most users need the "in time in future" form, for which o preposition should be used. The form "it took time / it was done in", for which preposition za is used in Slovak, is a much less frequent case.

@tukusejssirs
Copy link
Author

@dakujem, thanks for your comment. It makes me feel I’m not alone in this. 😄

When I created this PR, I thought we should always use o instead of za, but @k2s proved me wrong (see this comment of mine) that both are correct, but not interchangable.

Therefore from my current point of view, if we use either za only or o only, both are equally wrong as both are not always true. I wish I could propose an algorithm (a function) that would deal with the cases when which preposition is to be used, but I am not that good at programming … maybe you can do it. 😃

@dakujem
Copy link
Contributor

dakujem commented Jul 15, 2020

Indeed, both are used. I would bet that o is more frequent though. But...

Unfortunatelly, I'm not a JS guy 🤷, my JS plugin would be bad 😆

@tukusejssirs
Copy link
Author

@dakujem, currently we don’t need the code, but the algorithm—how to check what preposition Moment should output?

@marwahaha
Copy link
Member

I don't know how we can distinguish between points in time and periods of time.
I guess I will not make any changes here.

The locales can always be overridden by individual users.
https://momentjs.com/docs/#/customization/

@tukusejssirs
Copy link
Author

That’s a great pity.

@marwahaha
Copy link
Member

Hm... Perhaps we can distinguish usage between durations and moments. I will leave it open for a little while longer.

@marwahaha marwahaha reopened this Sep 15, 2020
@tukusejssirs
Copy link
Author

It sounds good me.

Is there any way we could get this ‘metadata’ now? Or is it something you need to implement into Moment?

@marwahaha
Copy link
Member

I don't know what you mean.

for now:
If you are using durations, you can update the locale for o.
If you are using moments, it will already use za.

@tukusejssirs
Copy link
Author

I don't know what you mean.

for now:
If you are using durations, you can update the locale for o.
If you are using moments, it will already use za.

On a second thought, this won’t solve this issue, because in an hour means both o hodinu (like in I’ll be back in an hour., which uses o point in time, i.e now + 1 hour) and za hodinu (like in He cooked it in an hour., which talks about a duration of time).

If you still think it’ll solve this issue, please share with me some code snippets how I could distinguish between the two. Thanks.

@marwahaha
Copy link
Member

I read through this discussion again.

It sounds like the difference between za and o depends on the specific context of the sentence. Probably, there are some linguistic texts discussing this, but it sounds more specific than can be implemented in this library. For example, Moment.js cannot distinguish between "He cooked it in an hour" and "I'll be back in an hour".

It seems like the best strategy is to use one, and replace it outside of Moment.js when you need.

If you have other ideas, feel free to re-open. Best of luck!

@tukusejssirs
Copy link
Author

Moment.js cannot distinguish between "He cooked it in an hour" and "I'll be back in an hour".

@marwahaha, that was my impression, too. It is a pity, but it is true. It’s shame that most l10n tools are so English-concerned that they can’t be modified to fully support other locales. I wish Moment would be like Fluent.

Until then, I think that this is a dead end.

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

No branches or pull requests

4 participants