-
-
Notifications
You must be signed in to change notification settings - Fork 774
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
Jalali Calendar support #5895
base: edge
Are you sure you want to change the base?
Jalali Calendar support #5895
Conversation
calendar system switches from Gregorian to Jalali based on time zone
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, that looks cool!
@@ -84,7 +84,7 @@ | |||
html, body { | |||
background-color: var(--background-color-light); | |||
color: var(--font-color); | |||
font-family: "OpenSans", "Cantarell", "Helvetica", "Arial", "PingFang SC", "Microsoft YaHei", sans-serif; | |||
font-family: "Vazirmatn", "OpenSans", "Cantarell", "Helvetica", "Arial", "PingFang SC", "Microsoft YaHei", sans-serif; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The RTL files are automatically generated, so a processing directive would be better.
https://rtlcss.com/learn/getting-started/why-rtlcss/#Processing-Directives
Perhaps something like:
font-family: "Vazirmatn", "OpenSans", "Cantarell", "Helvetica", "Arial", "PingFang SC", "Microsoft YaHei", sans-serif; | |
font-family: "OpenSans", "Cantarell", "Helvetica", "Arial", "PingFang SC", "Microsoft YaHei", sans-serif /*rtl:prepend:"Vazirmatn", */; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Er, in the non-RTL file that is, don't apply these suggestions as is. ;-)
@@ -1,4 +1,5 @@ | |||
@charset "UTF-8"; | |||
@import url('https://fonts.googleapis.com/css2?family=Vazirmatn:wght@100;200;300;400;500;600;700;800;900&display=swap'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same, but with something like:
@import url('https://fonts.googleapis.com/css2?family=Vazirmatn:wght@100;200;300;400;500;600;700;800;900&display=swap'); | |
/*rtl:raw:@import url('https://fonts.googleapis.com/css2?family=Vazirmatn:wght@100;200;300;400;500;600;700;800;900&display=swap');*/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would rather avoid a query to a Google server if possible. Could this font be exported to be used locally?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes it could be used locally. But first i need to look into themes structure so i can implement it better...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
have a look into the CSS @font-face
.
Font files are stored in the directory /p/themes/fonts
For internal developers: We need to find out what to do with those fonts. We might not be able to satisfy all use cases with an identical declaration (cf. e.g. #5671). Maybe a menu to change the font independently of the theme, or a list of fonts that depends on the language... What do you think @math-GH @Frenzie ? |
It is very nice to see that FreshRSS is used around the globe. It is very important that the community gives input from their language/local needs. What could help me to understand the current situation better? @qasedak Could you please paste a screenshot here how it looks like before the PR without this specific font family? |
strict_types must be on the first line
@math-GH , the font family is no big deal it's just a more appealing font for Arabic, Persian, ... |
A UI language dependency sounds problematic to me. Even as a correlation that's quite weak. We should probably distinguish between fonts that might be installed on the OS (is there any harm?) and web fonts (better to avoid downloading them unnecessarily). But I would start to write it a bit differently, i.e. font-family:
/* generic */
Helvetica, Tex Gyre Pagella, blah blah,
/* Japanese */
Mac Japanese Font, Win Japanese font,
/* Persian */
etc.
Yes, ultimately that makes the most sense to me, though I'll point out this can also quite easily be done with the CustomCSS. |
app/Models/Entry.php
Outdated
if ($raw) { | ||
return $this->date; | ||
} else if ($userTimezone == 'Asia/Tehran' || $userTimezone == 'Asia/Kabul') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not knowledgeable enough. A few points for which I have doubts:
- are all users of this timezone using this calendar?
- isn't this calendar used in other timezones, for instance when people travel?
In other words, I believe we might need a new selector option in the UI
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
are all users of this timezone using this calendar?
Indeed, that goes both ways. It could make sense as a default but it's otherwise more or less identical to the font issue.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In Iran and Afghanistan it's the official calendar. Also I like to add Hijri calendar system which is common in Arab and Islamic countries. If we add an option (like regional format in windows) for users to select their preferred calendar system it would be a better way I think.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe picking another library then? https://packagist.org/?query=Jalali%20Hijri
https://github.com/fisharebest/ext-calendar seems to be quite popular and well maintained.
Could you check whether that could work for you?
*/ | ||
|
||
/* F */ | ||
function jdate($format, $timestamp = '', $none = '', $time_zone = 'Asia/Tehran', $tr_num = 'fa') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a version of this library (or equivalent) that exists on https://packagist.org so that we could depend on it through composer
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
E.g. one of https://packagist.org/?query=Jalali ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Alkarex I think this is the one:
https://packagist.org/packages/jalalidate/jdf
or
https://packagist.org/packages/alifti/jdf
Co-authored-by: Luc SANCHEZ <[email protected]>
Jalali is the official calendar in Iran and Afghanistan, so it would be nice to support jalali calendar for their time zones.
Changes proposed in this pull request: