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

Jalali Calendar support #5895

Open
wants to merge 6 commits into
base: edge
Choose a base branch
from
Open

Jalali Calendar support #5895

wants to merge 6 commits into from

Conversation

qasedak
Copy link

@qasedak qasedak commented Nov 20, 2023

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:

  • Jalali calendar for Asia/Tehran and Asia/Kabul time-zones
  • suitable date format for Persian and Pashto languages
  • use of Vazirmant font in RTL for default theme

@qasedak
Copy link
Author

qasedak commented Nov 20, 2023

here is FreshRSS Displaying Jalali dates
Screenshot 2023-11-20 at 14-48-15 (44) جریان اصلی · FreshRSS

Copy link
Member

@Frenzie Frenzie left a 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;
Copy link
Member

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:

Suggested change
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", */;

Copy link
Member

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');
Copy link
Member

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:

Suggested change
@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');*/

Copy link
Member

@Alkarex Alkarex Nov 20, 2023

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?

Copy link
Author

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...

Copy link
Contributor

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

@Alkarex Alkarex added this to the 1.23.0 milestone Nov 20, 2023
@Alkarex Alkarex added the I18n 🌍 Translations label Nov 20, 2023
@Alkarex
Copy link
Member

Alkarex commented Nov 20, 2023

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 ?

@math-GH
Copy link
Contributor

math-GH commented Nov 20, 2023

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
@qasedak
Copy link
Author

qasedak commented Nov 21, 2023

@math-GH , the font family is no big deal it's just a more appealing font for Arabic, Persian, ...
here is the screenshot:
Screenshot 2023-11-21 at 09-35-54 جریان اصلی · FreshRSS

@Frenzie
Copy link
Member

Frenzie commented Nov 21, 2023

or a list of fonts that depends on the language

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.

Maybe a menu to change the font independently of the theme

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 Show resolved Hide resolved
app/Models/Entry.php Outdated Show resolved Hide resolved
if ($raw) {
return $this->date;
} else if ($userTimezone == 'Asia/Tehran' || $userTimezone == 'Asia/Kabul') {
Copy link
Member

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

Copy link
Member

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.

Copy link
Author

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.

Copy link
Member

@Alkarex Alkarex Nov 24, 2023

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') {
Copy link
Member

@Alkarex Alkarex Nov 21, 2023

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?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Author

@qasedak qasedak Nov 24, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Alkarex Alkarex modified the milestones: 1.23.0, 1.24.0 Nov 24, 2023
@Alkarex Alkarex modified the milestones: 1.24.0, 1.25.0 Feb 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
I18n 🌍 Translations
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants