biblatex icon indicating copy to clipboard operation
biblatex copied to clipboard

feat: adds Persian localization file

Open ziaenezhad opened this issue 11 months ago • 4 comments

ziaenezhad avatar Jan 07 '25 08:01 ziaenezhad

@moewew - I think we will need a more complete .lbx for persian? This only has a few strings in there? There is a related PR for biblatex-apa which reasonably suggests a localisation for & but I'm not sure the and bibstring is suitable as this defaults to the string "and" in English. I wonder if we need another bibstring ("andsymbol" ...) for this?

plk avatar Jan 09 '25 19:01 plk

@ziaenezhad Thank you very much for contributing persian.lbx. I think I agree with @plk here. If we want to include this into core biblatex we will want to make sure that biblatex supports Persian more fully. Last time I looked into this, it was extremely tricky to get RTL typesetting right (https://github.com/plk/biblatex/issues/1139, https://github.com/plk/biblatex/issues/1252 and linked issues) and since I have no experience there, we really need some more help with that.

moewew avatar Jan 09 '25 20:01 moewew

Yes, it works right. let's see some code examples:

% ./references.bib
@article{ref1,
  author = {علی علی‌پور, and ممد ممدپور},
  title = {مقایسه تطبیقی نقش مسواک و جاروبرقی در رشد نهال انگور},
  journal = {مجله نمونه},
  year = {1402},
  volume = {10},
  number = {2},
  pages = {1-10},
}

@book{ref2,
  author = {علی علی‌پور, and ممد ممدپورو, and رضا رضاپور},
  title = {تاثیر بوی کباب در افزایش نرخ بهروری کارگران کارخانه شورآباد},
  year = {1390},
  volume = {1},
  pages = {34-45},
}

using biblatex beside of xeperisa:

\documentclass{article}
\usepackage[backend=biber,style=apa]{biblatex}
\addbibresource{references.bib}

\usepackage{xepersian}
\settextfont{Yas}
\setlatintextfont{Times New Roman}

\begin{document}
	
	\section{مقدمه}	
	این یک نمونه متن است که در آن به منبعی با دو نویسنده
	\parencite{ref1}
	اشاره شده است.
	این یک نمونه متن دیگری است که در آن به منبعی با سه نویسنده
	\parencite{ref2}
	اشاره شده است.
	
	\printbibliography
	
\end{document}

Here is the output. @moewew as you see there is no issue regarding RTL typesetting. the only problem is the bib strings. now let's add the persian.lbx next to our main .tex file, and load it this way:

\usepackage[backend=biber, style=apa, language=persian]{biblatex}

You can check the output. As expected the English strings are replaced. @plk the only issue that remains is the & issue. let's place the fixed files (apa-dev.bbx & apa-dev.cbx) next to the main .tex file and try:

\usepackage[backend=biber, style=apa-dev, language=persian]{biblatex}

Now it's the final output as you see all issues are fixed and it looks fine :)

ziaenezhad avatar Jan 15 '25 01:01 ziaenezhad

Ah. Interesting. I thought this was much harder and previous attempts always got stuck somewhere. Do things also look right with a numeric style? (Unfortunately, I cannot judge whether there are issues or things look alright, since I don't read Persian.) In any case date features would still need to be added (suppose you have urldate = {2025-02-05}, or eventdate = {2025-02-05/2025-02-08} somewhere).

moewew avatar Feb 05 '25 08:02 moewew