本文へ移動

Hikidashi引き出し

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

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

目次

リファレンス · 和暦

JapaneseEra型

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

An era, as it is written, said and counted: one row of JAPANESE_ERAS.

インポート

import type { JapaneseEra } from "@johnmorrisdotca/hikidashi/wareki";

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

定義

type JapaneseEra = {
    kanji: string;
    romaji: string;
    reading: string;
    startYear: number;
    lastYear: number | null;
    startDate: string;
    endDate: string | null;
    spellings: readonly string[];
};

メンバー

名前型説明
kanjistring

The name in kanji, which is how a date is written.

romajistring

The Latin name, capitalised as English writes it.

readingstring

The reading in hiragana, for anyone meeting the kanji for the first time.

startYearnumber

The Western year the era's first year falls in.

lastYearnumber | null

The highest year the era reached, or null while it is still running.

昭和 ran to 64 and 平成 to 31, so 昭和65 is not a date and answering with 1990 would be a wrong answer rather than a missing one.

startDatestring

The era's first day, as YYYY-MM-DD: the day the emperor's reign, or for 明治 the name itself, began.

endDatestring | null

The era's last day, as YYYY-MM-DD: the day before the next era began. Null while it is still running.

spellingsreadonly string[]

Every spelling the name is written with in Latin letters, in lower case.

The long vowels are the reason there is a list rather than one string: 昭和 is Showa, Shouwa and Shōwa depending on whose romanization somebody learned, and all three are the same era.

例

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

const heisei: JapaneseEra = JAPANESE_ERAS[3]!;
console.log(heisei.kanji, heisei.romaji, heisei.reading, heisei.startDate, heisei.endDate, heisei.lastYear);
平成 Heisei へいせい 1989-01-08 2019-04-30 31

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

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

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