jalaali / moment-jalaali

A Jalaali (Jalali, Persian, Khorshidi, Shamsi) calendar system plugin for moment.js.
MIT License
924 stars 157 forks source link

Modern persian support #101

Closed siavashkavousi closed 6 years ago

siavashkavousi commented 6 years ago

Hi,

There is a typo here امرداد -> مرداد امر -> مرد

Thanks.

alitaheri commented 6 years ago

See: #12, #39 and #16. The correct word is the one used by this library. But correctness is only relative. If enough people agree with convention over correctness. I'll change the code.

My opinion: convention is much more important because we use language to convey meaning. And language is not what's in the dictionaries and old scripts. It's what's spoken by people. I strongly agree with this change. The original author doesn't.

I think this should be a community decision.

We'll give it some time before we decide. 👍 If you agree and 👎 If you disagree With the following changes:

امرداد -> مرداد Mordaad <- Amordaad امر -> مرد Mor <- Amo آدینه -> جمعه آ -> ج

cc @behrang @pajooh @UKbed990 @mehrdaad @amiraliakbari @MehdyKarimpour @miladkdz @hramezani @arastu @mvalipour

behrang commented 6 years ago

We don't change our writing, although we might change speaking and reading. Here are some more examples: خواهر خواندن خواستن - که با خاستن معنای متفاوتی دارد گذار و گزار که معنای متفاوتی دارند

siavashkavousi commented 6 years ago

I didn't know that and maybe I use it in my future applications, But there are situations that I'm not the one who makes decisions or customers disagree with it or you have to use what is common.

In my opinion you can provide a way to change these things and keep these defaults.

alitaheri commented 6 years ago

I've never seen امرداد or آدینه being used in our everyday calendars or in any website. I understand that these are correct but unfortunately they aren't convenient. And most of us are building software for the common folk, not for The Ministry of Culture and Higher Education. I'm afraid a huge portion of our population doesn't know about this. And the ones that know will also understand مرداد. In other words, مرداد will be understood by every Iranian whereas, امرداد will only be understood by a very few.

Productivity > Perfectionism

I say it again, I won't do a thing unless I see more 👍s than 👎 s

mvalipour commented 6 years ago

It was a close call for me, but I went 👎 on it. Because at the end of the day, there must be a source of truth for this and it sounds like it has to be the original form.

However I DO also feel the need on the consumers side. They are building a product for which they need to be able to design whatever language is best suitable.

Plus bear in mind, Iran is not the only country in which Jalaali calendar is used in, so can't just say one is more correct than the other one just because it's the acceptable language in Iran.

From this point on, IMO this would be the discussion of supporting dialects.

💡 Idea: why not let people extend on that?

// something like
jMoment.loadPersian({ useModernDialect: true })

or alternatively leaving some sort of extension point in there and make it possible for someone to build moment-jalaali-blahblah?

Final thought: Just like any other language/framework, I think there should be a defined set of standards for this to avoid confusion. Maybe some sort of blueprint in jalaali/blueprint?

alitaheri commented 6 years ago

@mvalipour I like the idea of having different dialects for different cases.

jMoment.loadPersian({ dialect: '...' });

Where dialect can be: 'persian' | 'modern-persian' | 'afghan' | 'azeri' | 'pashto' | 'kurdish'

It will default to 'persian' for backward-compatibility ( what it is right now )

'modern-persian' will use the conventions. And the other dialects will cover other countries and accents that have Jalaali calendar system.

ref: https://fa.wikipedia.org/wiki/گاه‌شماری_هجری_خورشیدی

@behrang How is that?

behrang commented 6 years ago

It's OK for persian and modern-persian, but I'm not sure about afghan, azari, pashto and kurdish. I'm sure month names are different, but I'm not sure about calendar calculations.

In Jalaali and the algorithm behind it, 12PM of Tehran is important. I'm not sure afghan, kurdish and others follow it or not.

Also, I think persian-modern is better than modern-persian.

alitaheri commented 6 years ago

@behrang I didn't know about that 😅 😅 Let's just stick to what we know. I'll add persian and persian-modern for now. Should others need other dialects, let them investigate and implement it themselves.

mvalipour commented 6 years ago

I would say add dialect/*.js files and dynamically load the dialect settings in loadPersian method and merge with the default options.

That would make it super easy to extend in the future.

alitaheri commented 6 years ago

@mvalipour A switch case will do the job. dynamic imports aren't very bundler-friendly 😅

mehdipourfar commented 6 years ago

وقتی یه نفر از شما میپرسه توی چه ماهی هستیم هیچوقت نمیگین امرداد. بذارین کنار این آریایی بازی ها رو توی جامعه اوپن سورس. کاری کنین کتابخونه تون قابل استفاده باشه.

mrmashal commented 6 years ago

I wonder why you haven't yet implemented the "dialect" thing or even better, an extensibility point for custom strings to be used in date-formatting functions. I think there's no need to wait for the votes!

alitaheri commented 6 years ago

@mrmashal The decision is made. But I don't have a lot of free time to implement it. I'll do it when I get the chance. PRs are welcome if this is a priority for you 👍

alitaheri commented 6 years ago

Fixed by #104

I'll publish as soon as I can.