summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/polyglossia/gloss-welsh.ldf
blob: 1908554cc2d376b76826a7ef12e5c7f60a759490 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
\ProvidesFile{gloss-welsh.ldf}[polyglossia: module for welsh]

\PolyglossiaSetup{welsh}{
  hyphennames={welsh},
  hyphenmins={2,3},
  fontsetup=true,
}

\providebool{welsh@formaldate}

% TODO (maybe) Interface to change that mid-document
\define@key{welsh}{date}{%
  \ifstrequal{#1}{long}{%
    \welsh@formaldatetrue
  }% Anything else gives \welsh@formaldatefalse
}

\def\captionswelsh{%
  \def\refname{Cyfeiriadau}%
  \def\abstractname{Crynodeb}%
  \def\bibname{Llyfryddiaeth}%
  \def\prefacename{Rhagair}%
  \def\chaptername{Pennod}%
  \def\appendixname{Atodiad}%
  \def\contentsname{Cynnwys}%
  \def\listfigurename{Rhestr Ddarluniau}%
  \def\listtablename{Rhestr Dablau}%
  \def\indexname{Mynegai}%
  \def\figurename{Darlun}%
  \def\tablename{Taflen}%
  %\def\thepart{}%
  \def\partname{Rhan}%
  \def\pagename{tudalen}%
  \def\seename{gweler}%
  \def\alsoname{gweler hefyd}%
  \def\enclname{amgaeëdig}%
  \def\ccname{copïau}%
  \def\headtoname{At}% ‘at’ on letters meaning ‘to (a person)’;
                     % ‘to (a place)’ is ‘i’ in Welsh
  \def\proofname{Prawf}%
  \def\glossaryname{Rhestr termau}%
  }

\newif\ifwelsh@first
\def\welsh@article#1{\welsh@firsttrue y\expandafter\welsh@article@do#1}
\def\welsh@article@do#1{\ifwelsh@first\welsh@isvowel#1\ifwelsh@vowel r\space\welsh@vowelfalse\else\space\fi#1\welsh@firstfalse\fi}
\newif\ifwelsh@vowel
\def\welsh@isvowel#1{\show#1\ifx#1a\welsh@voweltrue\else\ifx#1u\welsh@voweltrue\else\ifx#1w\welsh@voweltrue\fi\fi\fi}% FIXME Add the other vowels, just for good measure

\def\welsh@ordinal@long#1{%
  \ifcase#1\or cyntaf\or ail\or trydydd\or pedwerydd\or
  pumed\or chweched\or seithfed\or wythfed\or nawfed\or degfed\or unfed ar ddeg\or deuddegfed\or trydydd ar ddeg\or pedwerydd ar ddeg\or pymthegfed\or unfed ar bymtheg\or ail ar bymtheg\or deunawfed\or pedwerydd ar bymtheg\or ugeinfed\else\expandafter\welsh@ordinalplusxx@long#1\fi}

\def\welsh@ordinalplusxx@long#1{%
  \let\dday=#1\advance\dday by -20\relax\welsh@ordinal@long\dday\space ar hugain%
}

\def\datewelsh{%   
  \def\today{\ifwelsh@formaldate\formaltoday\else\standardtoday\fi}
  \def\standardtoday{%
    \ifcase\day\or 1af\or 2ail\or 3ydd\or 4ydd\or 5ed\or 6ed%
    \or 7fed\or 8fed\or 9fed\or 10fed\or 11eg\or 12fed\or 13eg\or
    14eg\or 15fed\or 16eg\or 17eg\or 18fed\or 19eg\or
    20fed\else\number\day ain\fi\space\ifcase\month\or
    Ionawr\or Chwefror\or Mawrth\or Ebrill\or
    Mai\or Mehefin\or Gorffennaf\or Awst\or
    Medi\or Hydref\or Tachwedd\or Rhagfyr\fi%
    \space\number\year}%

  \def\formaltoday{%
    \expandafter\welsh@article\welsh@ordinal@long\day\space o\space\ifcase\month\or Ionawr\or Chwefror\or Fawrth\or Ebrill\or Fai\or Fehefin\or Orffenaf\or Awst\or Fedi\or Hydref\or Dachwedd\or Ragfyr\fi
    \space\number\year}%
  }

\endinput