Skip to content

Jalali Calendar support - #5895

Closed
qasedak wants to merge 7 commits into
FreshRSS:edgefrom
Skilledup:Jalali
Closed

qasedak wants to merge 7 commits into
FreshRSS:edgefrom
Skilledup:Jalali

Conversation

@qasedak

@qasedak qasedak commented Nov 20, 2023

Copy link
Copy Markdown

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

qasedak commented Nov 20, 2023

Copy link
Copy Markdown
Author

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

@Frenzie Frenzie left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks, that looks cool!

Comment thread p/themes/Origine/origine.rtl.css Outdated
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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');*/

@Alkarex Alkarex Nov 20, 2023 •

Copy link
Copy Markdown
Member

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
Copy Markdown
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
Copy Markdown
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

Alkarex commented Nov 20, 2023 •

Copy link
Copy Markdown
Member

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

math-GH commented Nov 20, 2023

Copy link
Copy Markdown
Contributor

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

qasedak commented Nov 21, 2023

Copy link
Copy Markdown
Author

@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

Frenzie commented Nov 21, 2023

Copy link
Copy Markdown
Member

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.

Comment thread app/Models/Entry.php Resolved
Comment thread app/Models/Entry.php Resolved
Comment thread app/Models/Entry.php Outdated
$userLanguage = FreshRSS_Context::$user_conf->language;
if ($raw) {
return $this->date;
} else if ($userTimezone == 'Asia/Tehran' || $userTimezone == 'Asia/Kabul') {

Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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.

@Alkarex Alkarex Nov 24, 2023 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

*/

/* F */
function jdate($format, $timestamp = '', $none = '', $time_zone = 'Asia/Tehran', $tr_num = 'fa') {

@Alkarex Alkarex Nov 21, 2023 •

Copy link
Copy Markdown
Member

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
Copy Markdown
Member

Choose a reason for hiding this comment

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

@qasedak qasedak Nov 24, 2023 •

Copy link
Copy Markdown
Author

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
@math-GH math-GH added the BLOCKED ❌ merge conflict or failing tests that block the PR label Jun 15, 2024
@Alkarex Alkarex modified the milestones: 1.25.0, 1.26.0 Nov 30, 2024
@Skilledup Skilledup closed this by deleting the head repository Feb 2, 2025
@Alkarex Alkarex linked an issue Dec 31, 2025 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

BLOCKED ❌ merge conflict or failing tests that block the PR help wanted I18n 🌍 Translations

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature] Persian (jalali) calendar

6 participants