Skip to content

Commit

Permalink
Load calendars based on [date.<calendar>].
Browse files Browse the repository at this point in the history
  • Loading branch information
Javier committed Jun 2, 2022
1 parent 0dfd679 commit 81d8585
Show file tree
Hide file tree
Showing 8 changed files with 43 additions and 31 deletions.
2 changes: 1 addition & 1 deletion README.md
@@ -1,4 +1,4 @@
## Babel 3.75.2755
## Babel 3.75.2756

*(Development)*

Expand Down
57 changes: 36 additions & 21 deletions babel.dtx
Expand Up @@ -32,7 +32,7 @@
%
% \iffalse
%<*filedriver>
\ProvidesFile{babel.dtx}[2022/06/01 v3.75.2755 The Babel package]
\ProvidesFile{babel.dtx}[2022/06/02 v3.75.2756 The Babel package]
\documentclass{ltxdoc}
\GetFileInfo{babel.dtx}
\usepackage{fontspec}
Expand Down Expand Up @@ -2850,7 +2850,7 @@ date corresponding to the Gregorian calendar and other lunisolar systems
with the following command.

\Describe{\localedate}{\oarg{calendar=.., variant=..}%
{\marg{year}\m{month}\m{day}}}
{\marg{year}\marg{month}\marg{day}}}

By default the calendar is the Gregorian, but an |ini| file may define
strings for other calendars (currently |ar|, |ar-|*, |he|, |fa|, |hi|).
Expand All @@ -2863,6 +2863,20 @@ Even with a certain calendar there may be variants. In Kurmanji the
default variant prints something like \textit{30. Çileya Pêşîn 2019},
but with |variant=izafa| it prints \textit{31’ê Çileya Pêşînê 2019}.

\Describe{\babelcalendar}{\oarg{date}%
\marg{calendar}\marg{year-macro}\m{month-macro}\m{day-macro}}

\New{3.76} Although calendars aren’t the primary concern of \babel, the
package should be able to, at least, generate correctly the current
date in the way users would expect in their own culture. Currently,
|\localedate| can print dates in a few calendars (provided the
\textsf{ini} locale file has been imported), but year, month and day
had to be entered by hand, which is very inconvenient. With this macro,
the current date is converted and stored in the three last arguments,
which must be macros. The optional argument converts the given date, in
the form ‘\m{year}-\m{month}-\m{day}’. Please, refer to the page on the
news for 3.76 in the \babel{} site for further details.

\subsection{Accessing language info}

\Describe{\languagename}{}
Expand Down Expand Up @@ -5143,8 +5157,8 @@ help from Bernd Raichle, for which I am grateful.
% \section{Tools}
%
% \begin{macrocode}
%<<version=3.75.2755>>
%<<date=2022/06/01>>
%<<version=3.75.2756>>
%<<date=2022/06/02>>
% \end{macrocode}
%
% \textbf{Do not use the following macros in \texttt{ldf} files. They
Expand Down Expand Up @@ -9682,6 +9696,7 @@ help from Bernd Raichle, for which I am grateful.
\let\bbl@KVP@Alph\@nil
\let\bbl@KVP@labels\@nil
\bbl@csarg\let{KVP@labels*}\@nil
\let\bbl@calendars\@empty
\global\let\bbl@inidata\@empty
\global\let\bbl@extend@ini\@gobble
\gdef\bbl@key@list{;}%
Expand Down Expand Up @@ -10018,17 +10033,14 @@ help from Bernd Raichle, for which I am grateful.
\let\atcatcode\relax
\global\bbl@csarg\let{rqtex@\languagename}\relax
\fi}%
\bbl@ifunset{bbl@rqcal@\languagename}{}%
{\edef\bbl@tempa{\bbl@cs{rqcal@\languagename}}%
\bbl@replace\bbl@tempa{ }{,}%
\bbl@foreach\bbl@tempa{%
\bbl@ifunset{bbl@ca@##1}{%
\chardef\atcatcode=\catcode`\@
\catcode`\@=11\relax
\InputIfFileExists{babel-ca-##1.tex}{}{}%
\catcode`\@=\atcatcode
\let\atcatcode\relax}%
{}}}%
\bbl@foreach\bbl@calendars{%
\bbl@ifunset{bbl@ca@##1}{%
\chardef\atcatcode=\catcode`\@
\catcode`\@=11\relax
\InputIfFileExists{babel-ca-##1.tex}{}{}%
\catcode`\@=\atcatcode
\let\atcatcode\relax}%
{}}%
\fi
% == frenchspacing ==
\ifcase\bbl@howloaded\in@true\else\in@false\fi
Expand Down Expand Up @@ -10292,7 +10304,9 @@ help from Bernd Raichle, for which I am grateful.
\def\bbl@section{##1}%
\in@{=date.}{=##1}% Find a better place
\ifin@
\bbl@ini@calendar{##1}%
\bbl@ifunset{bbl@inikv@##1}%
{\bbl@ini@calendar{##1}}%
{}%
\fi
\in@{=identification/extension.}{=##1/##2}%
\ifin@
Expand Down Expand Up @@ -10336,7 +10350,7 @@ help from Bernd Raichle, for which I am grateful.
\bbl@endcommands}
% \end{macrocode}
%
% A somewhat hackish tool to handle calendar sections. To be improved.
% A somewhat hackish tool to handle calendar sections. TODO. To be improved.
%
% \begin{macrocode}
\def\bbl@ini@calendar#1{%
Expand All @@ -10353,6 +10367,9 @@ help from Bernd Raichle, for which I am grateful.
\fi
\ifx\bbl@tempa\relax\else
\bbl@replace\bbl@tempa{=}{}%
\ifx\bbl@tempa\@empty\else
\xdef\bbl@calendars{,\bbl@tempa}%
\fi
\bbl@exp{%
\def\<bbl@inikv@#1>####1####2{%
\\\bbl@inidate####1...\relax{####2}{\bbl@tempa}}}%
Expand Down Expand Up @@ -10471,7 +10488,6 @@ help from Bernd Raichle, for which I am grateful.
\bbl@exportkey{dgnat}{numbers.digits.native}{}%
\ifnum#1=\tw@ % only (re)new
\bbl@exportkey{rqtex}{identification.require.babel}{}%
\bbl@exportkey{rqcal}{identification.require.calendars}{}%
\bbl@toglobal\bbl@savetoday
\bbl@toglobal\bbl@savedate
\bbl@savestrings
Expand Down Expand Up @@ -22750,9 +22766,8 @@ Babel.cjk_breaks = {
\edef#7{\fp_eval:n{ \bbl@tempa - \bbl@cs@isltojd{#5}{#6}{1} + 1} }}
% \end{macrocode}
%
% The Umm al-Qura calendar, used mainly in Saudi Arabia. Based on
% \texttt{islamdate\_today.js} on |https://webspace.science.uu.nl/|.
% Copyright 1999-2002 by Ray Stott. Free to use if credited.
% The Umm al-Qura calendar, used mainly in Saudi Arabia, is based
% on \textsf{moment-hijri}, by Abdullah Alsigar (license MIT).
%
% Since the main aim is to provide a suitable |\today|, and maybe some
% close dates, data just covers Hijri $\sim$1435/$\sim$1460 (Gregorian
Expand Down
2 changes: 1 addition & 1 deletion babel.ins
Expand Up @@ -26,7 +26,7 @@
%% and covered by LPPL is defined by the unpacking scripts (with
%% extension .ins) which are part of the distribution.
%%
\def\filedate{2022/06/01}
\def\filedate{2022/06/02}
\def\batchfile{babel.ins}
\input docstrip.tex

Expand Down
Binary file modified babel.pdf
Binary file not shown.
2 changes: 1 addition & 1 deletion bbcompat.dtx
Expand Up @@ -30,7 +30,7 @@
%
% \iffalse
%<*dtx>
\ProvidesFile{bbcompat.dtx}[2022/06/01 v3.75.2755]
\ProvidesFile{bbcompat.dtx}[2022/06/02 v3.75.2756]
%</dtx>
%
%% File 'bbcompat.dtx'
Expand Down
5 changes: 2 additions & 3 deletions locale/ar/babel-ar.ini
Expand Up @@ -11,8 +11,8 @@

[identification]
charset = utf8
version = 1.15
date = 2022-05-25
version = 1.14
date = 2022-05-15
name.local = العربية
name.english = Arabic
name.babel = arabic
Expand All @@ -26,7 +26,6 @@ script.tag.opentype = arab
level = 1
encodings = LAE
derivate = no
require.calendars = islamic

[captions]
preface = مدخل
Expand Down
5 changes: 2 additions & 3 deletions locale/fa/babel-fa.ini
Expand Up @@ -11,8 +11,8 @@

[identification]
charset = utf8
version = 1.9
date = 2022-06-01
version = 1.8
date = 2021-05-16
name.local = فارسی
name.english = Persian
name.babel = persian
Expand All @@ -27,7 +27,6 @@ script.tag.opentype = arab
level = 1
encodings =
derivate = no
require.calendars = persian

[captions]
preface = پیشگفتار
Expand Down
1 change: 0 additions & 1 deletion locale/he/babel-he.ini
Expand Up @@ -27,7 +27,6 @@ script.tag.opentype = hebr
level = 1
encodings =
derivate = no
require.calendars = hebrew

[captions]
preface = מבוא
Expand Down

0 comments on commit 81d8585

Please sign in to comment.