-
-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Fix: Language parameter of the citation plugin for non en-US settings #2075
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
base: v4
Are you sure you want to change the base?
Conversation
Per default the rehype-citation project only supports en-US, as explained here: timlrx/rehype-citation#12 For other languages one can provide a locale-file either by passing its path or providing an URL. The following repository contains locale files for multiple languages. So, these are used, in case a non en-US language is used in quarzt. But this optimistically assumes there is indeed an according locale file. In summary this solves the problem only partially, since there are still some languages which will not work properly.
built with Refined Cloudflare Pages Action⚡ Cloudflare Pages Deployment
|
| ctx.cfg.configuration.locale !== null && | ||
| ctx.cfg.configuration.locale !== undefined && |
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.
Due to the default assignment on line 32, these will never be true.
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 sure if I am missing something. But the assignment on line 32 shouldn't influence the content of ctx.cfg.configuration.locale, or am I wrong?
Edit: I just checked it once more and it works as I would expect. But still I may be missing something.
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.
What I mean is that due to the default assignment, if the user does not configure any locale, it will still not be null nor be undefined. Therefore those two checks can be removed from the if-statement.
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.
Ah I see. I missed how exactly the !== (and ===) operator works in Typescript. I will fix and commit the changes.
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.
Yeah TypeScript/Javascript has a lot of weird quirks. These are mostly due to historical reasons and the aim for nearly boundless backwards-compatibility due to being a web-focused language.
For the most extreme of this quirks, see this website: https://jsisweird.com/
|
Heyho, since I got no further response / hint regarding required fixes / improvments: Is anything still required, before the PR can be merged? |
Apologies for the delayed response. Thanks for addressing the requested changes. I'll pass this to the other maintainers to do a final check before merging. |
|
@aarnphm do we need to make additional changes to comply with this? https://github.com/citation-style-language/locales?tab=readme-ov-file#licensing |
|
No problem, and thanks for your quick reply! :) |
Within the citation plugin currently the languages is set using the language from the quartz-configuration:
But, per default the rehype-citation project only supports
en-US, as explained here: timlrx/rehype-citation#12For other languages one can provide a locale-file either by passing its path or providing an URL. The following repository contains locale files for multiple languages:
https://github.com/citation-style-language/locales
These are used, in case a non
en-USlanguage is used in quartz. But this optimistically assumes there is indeed an according locale file.In the end this solves the problem only partially, since there are still some languages which will not work properly.
P.S. since I am not proficient in typescript / javascript: if there is something wrong / missing, just let me know