本文へ移動

Hikidashi引き出し

和暦と漢数字の相互変換、活用した語の辞書形、漢字への読みの割り当て、貼り付けた文からの単語の抽出、文の難しさ。日本語のテキストを扱う小さな道具を集めた引き出しです。

「引き出し」という名前は、道具が一つずつしまってあり、必要なときに取り出して使える、という意味です。 名前について(英語)

目次

リファレンス · 和暦

JAPANESE_ERAS定数

リファレンスの説明と例は英語です。見出しと目次は日本語です。

The five modern eras, oldest first: 明治, 大正, 昭和, 平成 and 令和.

明治 is dated from 23 October 1868, when the name was proclaimed; its years are counted as if it began with 1868, so 明治1 is 1868 and 明治45 is 1912. Each later era begins the day the emperor before it died, which is also the day the year number starts again from 元年.

インポート

import { JAPANESE_ERAS } from "@johnmorrisdotca/hikidashi/wareki";

ほかのエクスポート元: @johnmorrisdotca/hikidashi

定義

const JAPANESE_ERAS: readonly JapaneseEra[] = [
    { kanji: "明治", romaji: "Meiji", reading: "めいじ", startYear: 1868, lastYear: 45, startDate: "1868-10-23", endDate: "1912-07-29", spellings: ["meiji"] },
    { kanji: "大正", romaji: "Taisho", reading: "たいしょう", startYear: 1912, lastYear: 15, startDate: "1912-07-30", endDate: "1926-12-24", spellings: ["taisho", "taishou", "taishō"] },
    { kanji: "昭和", romaji: "Showa", reading: "しょうわ", startYear: 1926, lastYear: 64, startDate: "1926-12-25", endDate: "1989-01-07", spellings: ["showa", "shouwa", "shōwa"] },
    { kanji: "平成", romaji: "Heisei", reading: "へいせい", startYear: 1989, lastYear: 31, startDate: "1989-01-08", endDate: "2019-04-30", spellings: ["heisei"] },
    { kanji: "令和", romaji: "Reiwa", reading: "れいわ", startYear: 2019, lastYear: null, startDate: "2019-05-01", endDate: null, spellings: ["reiwa"] },
]

例

import { JAPANESE_ERAS } from "@johnmorrisdotca/hikidashi/wareki";

for (const era of JAPANESE_ERAS) console.log(`${era.kanji} ${era.romaji}: ${era.startDate} to ${era.endDate ?? "still running"}`);
明治 Meiji: 1868-10-23 to 1912-07-29
大正 Taisho: 1912-07-30 to 1926-12-24
昭和 Showa: 1926-12-25 to 1989-01-07
平成 Heisei: 1989-01-08 to 2019-04-30
令和 Reiwa: 2019-05-01 to still running

出力(このページを作ったときに実行した結果)

ソースを見るGitHub で編集@johnmorrisdotca/hikidashi 1.1.0 のソースから作成しました。

この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。