package DateTime::Format::Japanese::Era;
use strict;
use DateTime::Calendar::Japanese::Era;
use Encode();
our $VERSION = 0.01;
our %ERA_NAME2ID;
our %ERA_ID2NAME;

# we go through this interface to automatically detect duplicates
sub register_era
{
    my($jp, $id) = @_;

    my $utf8 = Encode::is_utf8($jp) ? $jp : Encode::decode('euc-jp', $jp);

    if (exists $ERA_NAME2ID{$utf8}) {
        Carp::croak("Era name '$jp' already exists. Cowardly refusing to proceed");
    }
    if (exists $ERA_ID2NAME{$id}) {
        Carp::croak("Era id '$id' already exists. Cowardly refusing to proceed");
    }
    $ERA_NAME2ID{$utf8} = $id;
    $ERA_ID2NAME{$id} = $utf8;
}

sub lookup_by_name
{
    my $era_name = shift;
    return
        DateTime::Calendar::Japanese::Era->lookup_by_id(id => $ERA_NAME2ID{ $era_name});
}

sub lookup_name_by_id
{
    my $era_id = shift;
    return $ERA_ID2NAME{ $era_id };
}

BEGIN
{

    register_era("Âç²½", DateTime::Calendar::Japanese::Era::TAIKA());
    register_era("Çòðµ", DateTime::Calendar::Japanese::Era::HAKUCHI());
    register_era("¼ëÄ»", DateTime::Calendar::Japanese::Era::SHUCHOU());
    register_era("ÂçÊõ", DateTime::Calendar::Japanese::Era::TAIHOU());
    register_era("·Ä±À", DateTime::Calendar::Japanese::Era::KEIUN());
    register_era("ÏÂÆ¼", DateTime::Calendar::Japanese::Era::WADOU());
    register_era("Îîµµ", DateTime::Calendar::Japanese::Era::REIKI());
    register_era("ÍÜÏ·", DateTime::Calendar::Japanese::Era::YOUROU());
    register_era("¿Àµµ", DateTime::Calendar::Japanese::Era::JINKI());
    register_era("Å·Ê¿", DateTime::Calendar::Japanese::Era::TENPYOU());
    register_era("Å·Ê¿´¶Êõ", DateTime::Calendar::Japanese::Era::TENPYOUKANPOU());
    register_era("Å·Ê¿¾¡Êõ", DateTime::Calendar::Japanese::Era::TENPYOUSHOUHOU());
    register_era("Å·Ê¿Êõ»ú", DateTime::Calendar::Japanese::Era::TENPYOUJOUJI());
    register_era("Å·Ê¿¿À¸î", DateTime::Calendar::Japanese::Era::TENPYOUJINGO());
    register_era("¿À¸î·Ê±À", DateTime::Calendar::Japanese::Era::JINGOKEIUN());
    register_era("Êõµµ", DateTime::Calendar::Japanese::Era::HOUKI());
    register_era("Å·±þ", DateTime::Calendar::Japanese::Era::TENNOU());
    register_era("±äÎñ", DateTime::Calendar::Japanese::Era::ENRYAKU());
    register_era("ÂçÆ±", DateTime::Calendar::Japanese::Era::DAIDOU());
    register_era("¹°¿Î", DateTime::Calendar::Japanese::Era::KOUNIN());
    register_era("Å·Ä¹", DateTime::Calendar::Japanese::Era::TENCHOU());
    register_era("¾µÏÂ", DateTime::Calendar::Japanese::Era::JOUWA1());
    register_era("²Å¾Í", DateTime::Calendar::Japanese::Era::KASHOU());
    register_era("¿Î¼÷", DateTime::Calendar::Japanese::Era::NINJU());
    register_era("ÀÆ¹Õ", DateTime::Calendar::Japanese::Era::SAIKOU());
    register_era("Å·°Â", DateTime::Calendar::Japanese::Era::TENNAN());
    register_era("Äç´Ñ", DateTime::Calendar::Japanese::Era::JOUGAN());
    register_era("¸µ·Ä", DateTime::Calendar::Japanese::Era::GANGYOU());
    register_era("¿ÎÏÂ", DateTime::Calendar::Japanese::Era::NINNA());
    register_era("´²Ê¿", DateTime::Calendar::Japanese::Era::KANPYOU());
    register_era("¾»ÂÙ", DateTime::Calendar::Japanese::Era::SHOUTAI());
    register_era("±ä´î", DateTime::Calendar::Japanese::Era::ENGI());
    register_era("±äÄ¹", DateTime::Calendar::Japanese::Era::ENCHOU());
    register_era("¾µÊ¿", DateTime::Calendar::Japanese::Era::JOUHEI());
    register_era("Å··Ä", DateTime::Calendar::Japanese::Era::TENGYOU());
    register_era("Å·Îñ", DateTime::Calendar::Japanese::Era::TENRYAKU());
    register_era("Å·ÆÁ", DateTime::Calendar::Japanese::Era::TENTOKU());
    register_era("±þÏÂ", DateTime::Calendar::Japanese::Era::OUWA());
    register_era("¹¯ÊÝ", DateTime::Calendar::Japanese::Era::KOUHOU());
    register_era("°ÂÏÂ", DateTime::Calendar::Japanese::Era::ANNA());
    register_era("Å·Ï½", DateTime::Calendar::Japanese::Era::TENROKU());
    register_era("Å·±ä", DateTime::Calendar::Japanese::Era::TENNEN());
    register_era("Äç¸µ", DateTime::Calendar::Japanese::Era::JOUGEN1());
    register_era("Å·¸µ", DateTime::Calendar::Japanese::Era::TENGEN());
    register_era("±Ê´Ñ", DateTime::Calendar::Japanese::Era::EIKAN());
    register_era("´²ÏÂ", DateTime::Calendar::Japanese::Era::KANNA());
    register_era("±Ê±ä", DateTime::Calendar::Japanese::Era::EIEN());
    register_era("±Êã¯", DateTime::Calendar::Japanese::Era::EISO());
    register_era("ÀµÎñ", DateTime::Calendar::Japanese::Era::SHOURYAKU());
    register_era("Ä¹ÆÁ", DateTime::Calendar::Japanese::Era::CHOUTOKU());
    register_era("Ä¹ÊÝ", DateTime::Calendar::Japanese::Era::CHOUHOU());
    register_era("´²¹°", DateTime::Calendar::Japanese::Era::KANKOU());
    register_era("Ä¹ÏÂ", DateTime::Calendar::Japanese::Era::CHOUWA());
    register_era("´²¿Î", DateTime::Calendar::Japanese::Era::KANNIN());
    register_era("¼£°Â", DateTime::Calendar::Japanese::Era::JIAN());
    register_era("Ëü¼÷", DateTime::Calendar::Japanese::Era::MANJU());
    register_era("Ä¹¸µ", DateTime::Calendar::Japanese::Era::CHOUGEN());
    register_era("Ä¹Îñ", DateTime::Calendar::Japanese::Era::CHOURYAKU());
    register_era("Ä¹µ×", DateTime::Calendar::Japanese::Era::CHOUKYU());
    register_era("´²ÆÁ", DateTime::Calendar::Japanese::Era::KANTOKU());
    register_era("±Ê¾µ", DateTime::Calendar::Japanese::Era::EISHOU1());
    register_era("Å·´î", DateTime::Calendar::Japanese::Era::TENGI());
    register_era("¹¯Ê¿", DateTime::Calendar::Japanese::Era::KOUHEI());
    register_era("¼£Îñ", DateTime::Calendar::Japanese::Era::JIRYAKU());
    register_era("±äµ×", DateTime::Calendar::Japanese::Era::ENKYUU());
    register_era("¾µÊÝ", DateTime::Calendar::Japanese::Era::JOUHOU());
    register_era("¾µÎñ", DateTime::Calendar::Japanese::Era::JOURYAKU());
    register_era("±ÊÊÝ", DateTime::Calendar::Japanese::Era::EIHOU());
    register_era("±þÆÁ", DateTime::Calendar::Japanese::Era::OUTOKU());
    register_era("´²¼£", DateTime::Calendar::Japanese::Era::KANJI());
    register_era("²ÅÊÝ", DateTime::Calendar::Japanese::Era::KAHOU());
    register_era("±ÊÄ¹", DateTime::Calendar::Japanese::Era::EICHOU());
    register_era("¾µÆÁ", DateTime::Calendar::Japanese::Era::JOUTOKU());
    register_era("¹¯ÏÂ", DateTime::Calendar::Japanese::Era::KOUWA());
    register_era("Ä¹¼£", DateTime::Calendar::Japanese::Era::CHOUJI());
    register_era("²Å¾µ", DateTime::Calendar::Japanese::Era::KAJOU());
    register_era("Å·¿Î", DateTime::Calendar::Japanese::Era::TENNIN());
    register_era("Å·±Ê", DateTime::Calendar::Japanese::Era::TENNEI());
    register_era("±Êµ×", DateTime::Calendar::Japanese::Era::EIKYU());
    register_era("¸µ±Ê", DateTime::Calendar::Japanese::Era::GENNEI());
    register_era("ÊÝ°Â", DateTime::Calendar::Japanese::Era::HOUAN());
    register_era("Å·¼£", DateTime::Calendar::Japanese::Era::TENJI());
    register_era("Âç¼£", DateTime::Calendar::Japanese::Era::DAIJI());
    register_era("Å·¾µ", DateTime::Calendar::Japanese::Era::TENSHOU1());
    register_era("Ä¹¾µ", DateTime::Calendar::Japanese::Era::CHOUSHOU());
    register_era("ÊÝ±ä", DateTime::Calendar::Japanese::Era::HOUEN());
    register_era("±Ê¼£", DateTime::Calendar::Japanese::Era::EIJI());
    register_era("¹¯¼£", DateTime::Calendar::Japanese::Era::KOUJI1());
    register_era("Å·ÍÜ", DateTime::Calendar::Japanese::Era::TENNYOU());
    register_era("µ×°Â", DateTime::Calendar::Japanese::Era::KYUAN());
    register_era("¿ÎÊ¿", DateTime::Calendar::Japanese::Era::NINPEI());
    register_era("µ×¼÷", DateTime::Calendar::Japanese::Era::KYUJU());
    register_era("ÊÝ¸µ", DateTime::Calendar::Japanese::Era::HOUGEN());
    register_era("Ê¿¼£", DateTime::Calendar::Japanese::Era::HEIJI());
    register_era("±ÊÎñ", DateTime::Calendar::Japanese::Era::EIRYAKU());
    register_era("±þÊÝ", DateTime::Calendar::Japanese::Era::OUHOU());
    register_era("Ä¹´²", DateTime::Calendar::Japanese::Era::CHOUKAN());
    register_era("±ÊËü", DateTime::Calendar::Japanese::Era::EIMAN());
    register_era("¿Î°Â", DateTime::Calendar::Japanese::Era::NINNAN());
    register_era("²Å±þ", DateTime::Calendar::Japanese::Era::KAOU());
    register_era("¾µ°Â", DateTime::Calendar::Japanese::Era::SHOUAN1());
    register_era("°Â¸µ", DateTime::Calendar::Japanese::Era::ANGEN());
    register_era("¼£¾µ", DateTime::Calendar::Japanese::Era::JISHOU());
    register_era("ÍÜÏÂ", DateTime::Calendar::Japanese::Era::YOUWA());
    register_era("¼÷±Ê", DateTime::Calendar::Japanese::Era::JUEI());
    register_era("¸µÎñ", DateTime::Calendar::Japanese::Era::GENRYAKU());
    register_era("Ê¸¼£", DateTime::Calendar::Japanese::Era::BUNJI());
    register_era("·úµ×", DateTime::Calendar::Japanese::Era::KENKYU());
    register_era("Àµ¼£", DateTime::Calendar::Japanese::Era::SHOUJI());
    register_era("·ú¿Î", DateTime::Calendar::Japanese::Era::KENNIN());
    register_era("¸µµ×", DateTime::Calendar::Japanese::Era::GENKYU());
    register_era("·ú±Ê", DateTime::Calendar::Japanese::Era::KENNEI());
    register_era("¾µ¸µ", DateTime::Calendar::Japanese::Era::JOUGEN2());
    register_era("·úÎñ", DateTime::Calendar::Japanese::Era::KENRYAKU());
    register_era("·úÊÝ", DateTime::Calendar::Japanese::Era::KENPOU());
    register_era("¾µµ×", DateTime::Calendar::Japanese::Era::JOUKYU());
    register_era("Äç±þ", DateTime::Calendar::Japanese::Era::JOUOU1());
    register_era("¸µ¿Î", DateTime::Calendar::Japanese::Era::GENNIN());
    register_era("²ÅÏ½", DateTime::Calendar::Japanese::Era::KAROKU());
    register_era("°ÂÄç", DateTime::Calendar::Japanese::Era::ANTEI());
    register_era("´²´î", DateTime::Calendar::Japanese::Era::KANKI());
    register_era("Äç±Ê", DateTime::Calendar::Japanese::Era::JOUEI());
    register_era("Å·Ê¡", DateTime::Calendar::Japanese::Era::TENPUKU());
    register_era("Ê¸Îñ", DateTime::Calendar::Japanese::Era::BUNRYAKU());
    register_era("²ÅÄ÷", DateTime::Calendar::Japanese::Era::KATEI());
    register_era("Îñ¿Î", DateTime::Calendar::Japanese::Era::RYAKUNIN());
    register_era("±ä±þ", DateTime::Calendar::Japanese::Era::ENNOU());
    register_era("¿Î¼£", DateTime::Calendar::Japanese::Era::NINJI());
    register_era("´²¸µ", DateTime::Calendar::Japanese::Era::KANGEN());
    register_era("Êõ¼£", DateTime::Calendar::Japanese::Era::HOUJI());
    register_era("·úÄ¹", DateTime::Calendar::Japanese::Era::KENCHOU());
    register_era("¹¯¸µ", DateTime::Calendar::Japanese::Era::KOUGEN());
    register_era("Àµ²Å", DateTime::Calendar::Japanese::Era::SHOUKA());
    register_era("Àµ¸µ", DateTime::Calendar::Japanese::Era::SHOUGEN());
    register_era("Ê¸±þ", DateTime::Calendar::Japanese::Era::BUNNOU());
    register_era("¹°Ä¹", DateTime::Calendar::Japanese::Era::KOUCHOU());
    register_era("Ê¸±Ê", DateTime::Calendar::Japanese::Era::BUNNEI());
    register_era("·ò¼£", DateTime::Calendar::Japanese::Era::KENJI());
    register_era("¹°°Â", DateTime::Calendar::Japanese::Era::KOUAN1());
    register_era("Àµ±þ", DateTime::Calendar::Japanese::Era::SHOUOU());
    register_era("±Ê¿Î", DateTime::Calendar::Japanese::Era::EININ());
    register_era("Àµ°Â", DateTime::Calendar::Japanese::Era::SHOUAN2());
    register_era("´¥¸µ", DateTime::Calendar::Japanese::Era::KENGEN());
    register_era("²Å¸µ", DateTime::Calendar::Japanese::Era::KAGEN());
    register_era("ÆÁ¼£", DateTime::Calendar::Japanese::Era::TOKUJI());
    register_era("±ä·Ä", DateTime::Calendar::Japanese::Era::ENKYOU1());
    register_era("±þÄ¹", DateTime::Calendar::Japanese::Era::OUCHOU());
    register_era("ÀµÏÂ", DateTime::Calendar::Japanese::Era::SHOUWA1());
    register_era("Ê¸ÊÝ", DateTime::Calendar::Japanese::Era::BUNPOU());
    register_era("¸µ±þ", DateTime::Calendar::Japanese::Era::GENNOU());
    register_era("¸µµü", DateTime::Calendar::Japanese::Era::GENKOU());
    register_era("ÀµÃæ", DateTime::Calendar::Japanese::Era::SHOUCHU());
    register_era("²ÅÎñ", DateTime::Calendar::Japanese::Era::KARYAKU());
    register_era("¸µÆÁ", DateTime::Calendar::Japanese::Era::GENTOKU());
    register_era("Àµ·Ä", DateTime::Calendar::Japanese::Era::SHOUKEI());
    register_era("Îñ±þ", DateTime::Calendar::Japanese::Era::RYAKUOU());
    register_era("¹¯±Ê", DateTime::Calendar::Japanese::Era::KOUEI());
    register_era("ÄçÏÂ", DateTime::Calendar::Japanese::Era::JOUWA2());
    register_era("´Ñ±þ", DateTime::Calendar::Japanese::Era::KANNOU());
    register_era("Ê¸ÏÂ", DateTime::Calendar::Japanese::Era::BUNNNA());
    register_era("±äÊ¸", DateTime::Calendar::Japanese::Era::ENBUN());
    register_era("¹¯°Â", DateTime::Calendar::Japanese::Era::KOUAN2());
    register_era("Äç¼£", DateTime::Calendar::Japanese::Era::JOUJI());
    register_era("±þ°Â", DateTime::Calendar::Japanese::Era::OUAN());
    register_era("±ÊÏÂ", DateTime::Calendar::Japanese::Era::EIWA());
    register_era("¹¯Îñ", DateTime::Calendar::Japanese::Era::KOURYAKU());
    register_era("±ÊÆÁ", DateTime::Calendar::Japanese::Era::EITOKU());
    register_era("»êÆÁ", DateTime::Calendar::Japanese::Era::SHITOKU());
    register_era("²Å·Ä", DateTime::Calendar::Japanese::Era::KAKEI());
    register_era("¹¯±þ", DateTime::Calendar::Japanese::Era::KOUOU());
    register_era("ÌÀÆÁ", DateTime::Calendar::Japanese::Era::MEITOKU());
    register_era("±þ±Ê", DateTime::Calendar::Japanese::Era::OUEI());
    register_era("ÀµÄ¹", DateTime::Calendar::Japanese::Era::SHOUCHOU());
    register_era("±Êµý", DateTime::Calendar::Japanese::Era::EIKYOU());
    register_era("²ÅµÈ", DateTime::Calendar::Japanese::Era::KAKITSU());
    register_era("Ê¸°Â", DateTime::Calendar::Japanese::Era::BUNNAN());
    register_era("ÊõÆÁ", DateTime::Calendar::Japanese::Era::HOUTOKU());
    register_era("µýÆÁ", DateTime::Calendar::Japanese::Era::KYOUTOKU());
    register_era("¹¯Àµ", DateTime::Calendar::Japanese::Era::KOUSHOU());
    register_era("Ä¹Ï½", DateTime::Calendar::Japanese::Era::CHOUROKU());
    register_era("´²Àµ", DateTime::Calendar::Japanese::Era::KANSHOU());
    register_era("Ê¸Àµ", DateTime::Calendar::Japanese::Era::BUNSHOU());
    register_era("±þ¿Î", DateTime::Calendar::Japanese::Era::OUNIN());
    register_era("Ê¸ÌÀ", DateTime::Calendar::Japanese::Era::BUNMEI());
    register_era("Ä¹µý", DateTime::Calendar::Japanese::Era::CHOUKYOU());
    register_era("±äÆÁ", DateTime::Calendar::Japanese::Era::ENTOKU());
    register_era("ÌÀ±þ", DateTime::Calendar::Japanese::Era::MEIOU());
    register_era("Ê¸µµ", DateTime::Calendar::Japanese::Era::BUNKI());
    register_era("±ÊÀµ", DateTime::Calendar::Japanese::Era::EISHOU2());
    register_era("Âç±Ê", DateTime::Calendar::Japanese::Era::DAIEI());
    register_era("µýÏ½", DateTime::Calendar::Japanese::Era::KYOUROKU());
    register_era("Å·Ê¸", DateTime::Calendar::Japanese::Era::TENBUN());
    register_era("¹°¼£", DateTime::Calendar::Japanese::Era::KOUJI2());
    register_era("±ÊÏ½", DateTime::Calendar::Japanese::Era::EIROKU());
    register_era("¸µµµ", DateTime::Calendar::Japanese::Era::GENKI());
    register_era("Å·Àµ", DateTime::Calendar::Japanese::Era::TENSHOU2());
    register_era("Ê¸Ï½", DateTime::Calendar::Japanese::Era::BUNROKU());
    register_era("·ÄÄ¹", DateTime::Calendar::Japanese::Era::KEICHOU());
    register_era("¸µÏÂ", DateTime::Calendar::Japanese::Era::GENNA());
    register_era("´²±Ê", DateTime::Calendar::Japanese::Era::KANNEI());
    register_era("ÀµÊÝ", DateTime::Calendar::Japanese::Era::SHOUHOU());
    register_era("·Ä°Â", DateTime::Calendar::Japanese::Era::KEIAN());
    register_era("¾µ±þ", DateTime::Calendar::Japanese::Era::JOUOU2());
    register_era("ÌÀÎñ", DateTime::Calendar::Japanese::Era::MEIREKI());
    register_era("Ëü¼£", DateTime::Calendar::Japanese::Era::MANJI());
    register_era("´²Ê¸", DateTime::Calendar::Japanese::Era::KANBUN());
    register_era("±äÊõ", DateTime::Calendar::Japanese::Era::ENPOU());
    register_era("Å·ÏÂ", DateTime::Calendar::Japanese::Era::TENNA());
    register_era("Äçµý", DateTime::Calendar::Japanese::Era::JOUKYOU());
    register_era("¸µÏ½", DateTime::Calendar::Japanese::Era::GENROKU());
    register_era("Êõ±Ê", DateTime::Calendar::Japanese::Era::HOUEI());
    register_era("ÀµÆÁ", DateTime::Calendar::Japanese::Era::SHOUTOKU());
    register_era("µýÊÝ", DateTime::Calendar::Japanese::Era::KYOUHO());
    register_era("¸µÊ¸", DateTime::Calendar::Japanese::Era::GENBUN());
    register_era("´²ÊÝ", DateTime::Calendar::Japanese::Era::KANPOU());
    register_era("±äµý", DateTime::Calendar::Japanese::Era::ENKYOU2());
    register_era("´²±ä", DateTime::Calendar::Japanese::Era::KANNEN());
    register_era("ÊõÎñ", DateTime::Calendar::Japanese::Era::HOUREKI());
    register_era("ÌÀÏÂ", DateTime::Calendar::Japanese::Era::MEIWA());
    register_era("°Â±Ê", DateTime::Calendar::Japanese::Era::ANNEI());
    register_era("Å·ÌÀ", DateTime::Calendar::Japanese::Era::TENMEI());
    register_era("´²À¯", DateTime::Calendar::Japanese::Era::KANSEI());
    register_era("µýÏÂ", DateTime::Calendar::Japanese::Era::KYOUWA());
    register_era("Ê¸²½", DateTime::Calendar::Japanese::Era::BUNKA());
    register_era("Ê¸À¯", DateTime::Calendar::Japanese::Era::BUNSEI());
    register_era("Å·ÊÝ", DateTime::Calendar::Japanese::Era::TENPOU());
    register_era("¹°²½", DateTime::Calendar::Japanese::Era::KOUKA());
    register_era("²Å±Ê", DateTime::Calendar::Japanese::Era::KAEI());
    register_era("°ÂÀ¯", DateTime::Calendar::Japanese::Era::ANSEI());
    register_era("Ëü±ä", DateTime::Calendar::Japanese::Era::MANNEI());
    register_era("Ê¸µ×", DateTime::Calendar::Japanese::Era::BUNKYU());
    register_era("¸µ¼£", DateTime::Calendar::Japanese::Era::GENJI());
    register_era("·Ä±þ", DateTime::Calendar::Japanese::Era::KEIOU());
    register_era("ÌÀ¼£", DateTime::Calendar::Japanese::Era::MEIJI());
    register_era("ÂçÀµ", DateTime::Calendar::Japanese::Era::TAISHO());
    register_era("¾¼ÏÂ", DateTime::Calendar::Japanese::Era::SHOUWA2());
    register_era("Ê¿À®", DateTime::Calendar::Japanese::Era::HEISEI());
}

1;
