| 1 |
% Language definition file (part of polyglossia v2.10 -- 2026/04/18) |
| 2 |
% |
| 3 |
\ProvidesFile{gloss-japanese.ldf}[polyglossia: module for Japanese] |
| 4 |
|
| 5 |
\PolyglossiaSetup{japanese}{ |
| 6 |
bcp47=ja, |
| 7 |
bcp47-language=ja, |
| 8 |
bcp47-region=JP, |
| 9 |
bcp47-script=Hrkt, |
| 10 |
script=CJK, |
| 11 |
scripttag=kana, |
| 12 |
language=Japanese, |
| 13 |
langtag=JAN, |
| 14 |
hyphennames={nohyphenation}, |
| 15 |
frenchspacing=false, |
| 16 |
localnumeral=japanesenumerals, |
| 17 |
Localnumeral=japanesenumerals |
| 18 |
} |
| 19 |
|
| 20 |
% BCP-47 compliant aliases |
| 21 |
\setlanguagealias*{japanese}{ja} |
| 22 |
|
| 23 |
\providecommand*\presection{} |
| 24 |
\providecommand*\presubsection{} |
| 25 |
\providecommand*\presubsubsection{} |
| 26 |
\providecommand*\postsection{} |
| 27 |
\providecommand*\postsubsection{} |
| 28 |
\providecommand*\postsubsubsection{} |
| 29 |
\let\xpg@save@presection\presection |
| 30 |
\let\xpg@save@presubsection\presubsection |
| 31 |
\let\xpg@save@presubsubsection\presubsubsection |
| 32 |
\let\xpg@save@postsection\postsection |
| 33 |
\let\xpg@save@postsubsection\postsubsection |
| 34 |
\let\xpg@save@postsubsubsection\postsubsubsection |
| 35 |
\let\xpg@save@seccntformat\@seccntformat |
| 36 |
|
| 37 |
\def\japanese@capsformat{% |
| 38 |
\def\@seccntformat##1{% |
| 39 |
\csname pre##1\endcsname% |
| 40 |
\csname the##1\endcsname% |
| 41 |
\csname post##1\endcsname% |
| 42 |
}% |
| 43 |
\def\postsection{節\space}% |
| 44 |
\def\postsubsection{節\space}% |
| 45 |
\def\postsubsubsection{節\space}% |
| 46 |
\def\presection{第}% |
| 47 |
\def\presubsection{第}% |
| 48 |
\def\presubsubsection{第}% |
| 49 |
} |
| 50 |
|
| 51 |
\def\nojapanese@capsformat{% |
| 52 |
\let\presection\xpg@save@presection% |
| 53 |
\let\presubsection\xpg@save@presubsection% |
| 54 |
\let\presubsubsection\xpg@save@presubsubsection% |
| 55 |
\let\postsection\xpg@save@postsection% |
| 56 |
\let\postsubsection\xpg@save@postsubsection% |
| 57 |
\let\postsubsubsection\xpg@save@postsubsubsection% |
| 58 |
\let\@seccntformat\xpg@save@seccntformat% |
| 59 |
} |
| 60 |
|
| 61 |
\def\captionsjapanese{% |
| 62 |
\def\refname{参考文献}% |
| 63 |
\def\abstractname{概要}% |
| 64 |
\def\bibname{文献目録}% |
| 65 |
\def\prefacename{端書き}% |
| 66 |
\def\chaptername##1##2{第##1##2 章}% |
| 67 |
\def\appendixname{付録}% |
| 68 |
\def\contentsname{目次}% |
| 69 |
\def\listfigurename{図目次}% |
| 70 |
\def\listtablename{表目次}% |
| 71 |
\def\indexname{索引}% |
| 72 |
\def\figurename{図}% |
| 73 |
\def\tablename{表}% |
| 74 |
\def\partname##1##2{第##1##2 部}% |
| 75 |
\def\pagename##1##2{第##1##2 頁}% |
| 76 |
\def\seename{参照}% |
| 77 |
\def\alsoname{参照}% |
| 78 |
\def\enclname{添付}% |
| 79 |
\def\ccname{同報}% |
| 80 |
\def\headtoname{宛先}% |
| 81 |
\def\proofname{証明}% |
| 82 |
\def\glossaryname{用語集}% |
| 83 |
} |
| 84 |
|
| 85 |
\newif\if@WameiReki \@WameiRekifalse% |
| 86 |
\newif\if@WameiTosi \@WameiTosifalse% |
| 87 |
\newif\if@WameiTuki \@WameiTukifalse% |
| 88 |
\newif\if@WameiHi \@WameiHifalse% |
| 89 |
\newif\if@IzumoTuki \@IzumoTukifalse% |
| 90 |
\newcount\c@TempJNum% |
| 91 |
|
| 92 |
\def\@JapaneseDigit#1{% |
| 93 |
\ifcase#1\or 一\or 二\or 三\or 四\or 五\or% |
| 94 |
六\or 七\or 八\or 九\or 十\or% |
| 95 |
十一\or 十二\or 十三\or 十四\or 十五\or% |
| 96 |
十六\or 十七\or 十八\or 十九\or 廿\or% |
| 97 |
廿一\or 廿二\or 廿三\or 廿四\or 廿五\or% |
| 98 |
廿六\or 廿七\or 廿八\or 廿九\or 丗\or% |
| 99 |
丗一\or 丗二\or 丗三\or 丗四\or 丗五\or% |
| 100 |
丗六\or 丗七\or 丗八\or 丗九\or 四十\or% |
| 101 |
四十一\or 四十二\or 四十三\or 四十四\or 四十五\or% |
| 102 |
四十六\or 四十七\or 四十八\or 四十九\or 五十\or% |
| 103 |
五十一\or 五十二\or 五十三\or 五十四\or 五十五\or% |
| 104 |
五十六\or 五十七\or 五十八\or 五十九\or 六十\or% |
| 105 |
六十一\or 六十二\or 六十三\or 六十四\or 六十五\or% |
| 106 |
六十六\or 六十七\or 六十八\or 六十九\or 七十\or% |
| 107 |
七十一\or 七十二\or 七十三\or 七十四\or 七十五\or% |
| 108 |
七十六\or 七十七\or 七十八\or 七十九\or 八十\or% |
| 109 |
八十一\or 八十二\or 八十三\or 八十四\or 八十五\or% |
| 110 |
八十六\or 八十七\or 八十八\or 八十九\or 九十\or% |
| 111 |
九十一\or 九十二\or 九十三\or 九十四\or 九十五\or% |
| 112 |
九十六\or 九十七\or 九十八\or 九十九% |
| 113 |
\else |
| 114 |
\@ctrerr% |
| 115 |
\fi\relax% |
| 116 |
} |
| 117 |
|
| 118 |
\def\@JapaneseNum#1{% |
| 119 |
\c@TempJNum=#1\divide\c@TempJNum by 1000\relax% |
| 120 |
\ifnum\c@TempJNum=\z@\c@TempJNum=#1% |
| 121 |
\divide\c@TempJNum by 100\relax% |
| 122 |
\ifnum\c@TempJNum=\z@\@JapaneseDigit{#1}\relax% |
| 123 |
\else |
| 124 |
\ifcase\c@TempJNum\or 百\or 二百\or 三百\or 四百\or 五百\or |
| 125 |
六百\or 七百\or 八百\or 九百% |
| 126 |
\fi |
| 127 |
\c@TempJNum=#1\divide\c@TempJNum by 100\multiply\c@TempJNum by -100\advance\c@TempJNum#1\@JapaneseDigit\c@TempJNum\relax% |
| 128 |
\fi% |
| 129 |
\else |
| 130 |
\ifcase\c@TempJNum\or 千\or 二千\or 三千\or 四千\or 五千\or |
| 131 |
六千\or 七千\or 八千\or 九千% |
| 132 |
\fi |
| 133 |
\c@TempJNum=#1\divide\c@TempJNum by 1000\multiply\c@TempJNum by -1000\advance\c@TempJNum#1\divide\c@TempJNum by 100\relax% |
| 134 |
\ifnum\c@TempJNum=\z@\c@TempJNum=#1% |
| 135 |
\divide\c@TempJNum by 100\multiply\c@TempJNum by -100\advance\c@TempJNum#1\@JapaneseDigit\c@TempJNum\relax% |
| 136 |
\else |
| 137 |
\ifcase\c@TempJNum\or 百\or 二百\or 三百\or 四百\or 五百\or |
| 138 |
六百\or 七百\or 八百\or 九百% |
| 139 |
\fi |
| 140 |
\c@TempJNum=#1\divide\c@TempJNum by 100\multiply\c@TempJNum by -100\advance\c@TempJNum#1\@JapaneseDigit\c@TempJNum\relax% |
| 141 |
\fi |
| 142 |
\fi |
| 143 |
} |
| 144 |
|
| 145 |
\def\@japanesenumber#1{% |
| 146 |
\@tempcnta=#1% |
| 147 |
\ifnum\@tempcnta=\z@{〇}% |
| 148 |
\else |
| 149 |
\ifnum\@tempcnta<\z@{負}% |
| 150 |
\multiply\@tempcnta by -1% |
| 151 |
\fi |
| 152 |
\@tempcntb=\@tempcnta\divide\@tempcntb by 10000\relax% |
| 153 |
\ifnum\@tempcntb=\z@\@JapaneseNum% |
| 154 |
\@tempcnta% |
| 155 |
\else |
| 156 |
\@tempcntb=\@tempcnta\divide\@tempcntb by 100000000\relax% |
| 157 |
\ifnum\@tempcntb=\z@\@tempcntb=\@tempcnta% |
| 158 |
\divide\@tempcntb by 10000% |
| 159 |
\@JapaneseNum\@tempcntb{万}\@tempcntb=\@tempcnta% |
| 160 |
\divide\@tempcntb by 10000\multiply\@tempcntb by -10000% |
| 161 |
\advance\@tempcntb\@tempcnta\relax\@JapaneseNum\@tempcntb% |
| 162 |
\else |
| 163 |
\@JapaneseNum\@tempcntb{億}\@tempcntb=\@tempcnta% |
| 164 |
\divide\@tempcntb by 100000000\multiply\@tempcntb by -100000000% |
| 165 |
\advance\@tempcntb\@tempcnta\divide\@tempcntb by 10000\relax% |
| 166 |
\ifnum\@tempcntb=\z@% |
| 167 |
\else |
| 168 |
\@JapaneseNum\@tempcntb{万}% |
| 169 |
\fi |
| 170 |
\@tempcntb=\@tempcnta\divide\@tempcntb by 10000% |
| 171 |
\multiply\@tempcntb by -10000\advance\@tempcntb\@tempcnta% |
| 172 |
\@JapaneseNum\@tempcntb% |
| 173 |
\fi |
| 174 |
\fi |
| 175 |
\fi |
| 176 |
} |
| 177 |
|
| 178 |
\def\japanesenumber#1{% |
| 179 |
\expandafter\@japanesenumber\csname c@#1\endcsname% |
| 180 |
} |
| 181 |
|
| 182 |
\newcommand{\japanesenumerals}[2]{\@japanesenumber{#2}} |
| 183 |
|
| 184 |
\def\datejapanese{% |
| 185 |
{% |
| 186 |
\ifnum\year<1868% |
| 187 |
\xdef\the@WarekiCur{}% |
| 188 |
\else |
| 189 |
\ifnum\year<1912% |
| 190 |
\xdef\the@WarekiCur{明治}\advance\year-1867\relax% |
| 191 |
\else |
| 192 |
\ifnum\year<1926% |
| 193 |
\xdef\the@WarekiCur{大正}\advance\year-1911\relax% |
| 194 |
\else |
| 195 |
\ifnum\year<1989% |
| 196 |
\xdef\the@WarekiCur{昭和}\advance\year-1925\relax% |
| 197 |
\else |
| 198 |
\xdef\the@WarekiCur{平成}\advance\year-1988\relax% |
| 199 |
\fi |
| 200 |
\fi |
| 201 |
\fi |
| 202 |
\fi |
| 203 |
\xdef\the@WameiTosi{\the\year}% |
| 204 |
}% |
| 205 |
\def\西暦{\@WameiRekifalse \@WameiTukifalse \@WameiHifalse}% |
| 206 |
\def\和暦{\@WameiRekitrue \@WameiTosifalse \@WameiTukifalse \@WameiHifalse}% |
| 207 |
\def\和名暦{\@WameiTositrue \@WameiTukitrue \@WameiHitrue}% |
| 208 |
\def\数字暦{\@WameiTosifalse \@WameiTukifalse \@WameiHifalse}% |
| 209 |
\def\出雲月{\@IzumoTukitrue}% |
| 210 |
\def\大和月{\@IzumoTukifalse}% |
| 211 |
\def\today{% |
| 212 |
\if@WameiReki% |
| 213 |
\the@WarekiCur% |
| 214 |
\if@WameiTosi% |
| 215 |
\@JapaneseNum\the@WameiTosi% |
| 216 |
\else |
| 217 |
\,\the@WameiTosi% |
| 218 |
\fi |
| 219 |
\else |
| 220 |
\number\year\,% |
| 221 |
\fi |
| 222 |
{年}% |
| 223 |
\if@WameiTuki% |
| 224 |
\ifcase\month\or 睦月\or 如月\or 弥生\or 卯月\or 皐月\or |
| 225 |
水無月\or 文月\or 葉月\or 長月\or |
| 226 |
\if@IzumoTuki 神在月\else 神無月\fi |
| 227 |
\or 霜月\or 師走% |
| 228 |
\fi |
| 229 |
\else |
| 230 |
\,\number\month\,% |
| 231 |
{月}% |
| 232 |
\fi |
| 233 |
\if@WameiHi% |
| 234 |
\@JapaneseNum\day% |
| 235 |
\else |
| 236 |
\,\number\day\,% |
| 237 |
\fi |
| 238 |
{日}% |
| 239 |
}% |
| 240 |
} |
| 241 |
|
| 242 |
\ifluatex |
| 243 |
\@ifundefined{xpg@attr@cjkspacing}{\newattribute\xpg@attr@cjkspacing}{} |
| 244 |
\directlua{ require"polyglossia-cjk-spacing" } |
| 245 |
\def\japanese@spacing{\xpg@attr@cjkspacing=\@ne} |
| 246 |
\def\nojapanese@spacing{\unsetattribute\xpg@attr@cjkspacing} |
| 247 |
\else |
| 248 |
\@ifundefined{xpg@orig@XeTeXlinebreakskip}{\newskip\xpg@orig@XeTeXlinebreakskip}{} |
| 249 |
\xpg@orig@XeTeXlinebreakskip=\XeTeXlinebreakskip |
| 250 |
\def\japanese@spacing{% |
| 251 |
\XeTeXlinebreaklocale "ja"% |
| 252 |
\XeTeXlinebreakskip = 0pt plus 0.1em minus 0.01em% |
| 253 |
} |
| 254 |
\def\nojapanese@spacing{% |
| 255 |
\XeTeXlinebreakskip=\xpg@orig@XeTeXlinebreakskip% |
| 256 |
\XeTeXlinebreaklocale ""% |
| 257 |
} |
| 258 |
\fi |
| 259 |
|
| 260 |
\def\noextras@japanese{% |
| 261 |
\nojapanese@capsformat% |
| 262 |
\nojapanese@spacing% |
| 263 |
} |
| 264 |
|
| 265 |
\def\blockextras@japanese{% |
| 266 |
\japanese@capsformat% |
| 267 |
\japanese@spacing% |
| 268 |
} |
| 269 |
|
| 270 |
\def\inlineextras@japanese{% |
| 271 |
\japanese@capsformat% |
| 272 |
\japanese@spacing% |
| 273 |
} |
| 274 |
|
| 275 |
\ifxetex |
| 276 |
% \XeTeXlinebreaklocale is global, |
| 277 |
% so we need to reset after nested language got closed |
| 278 |
\def\nestedextras@japanese{% |
| 279 |
\japanese@spacing% |
| 280 |
} |
| 281 |
\fi |
| 282 |
|
| 283 |
% Based on contributions of Toru Inagaki, Norio Iwase, François Charette |
| 284 |
|