OSDN Git Service

[Refactor] #37353 コメント整理 / Refactor comments.
[hengband/hengband.git] / src / autopick.c
index ac5a415..4842360 100644 (file)
@@ -1,13 +1,14 @@
-/* File: autopick.c */
-
-/* Purpose: Object Auto-picker/Destroyer */
-
-/*
- * Copyright (c) 2002  Mogami
- *
- * This software may be copied and distributed for educational, research, and
- * not for profit purposes provided that this copyright and statement are
- * included in all such copies.
+/*!
+ * @file autopick.c
+ * @brief 自動拾い機能の実装 / Object Auto-picker/Destroyer
+ * @date 2014/01/02
+ * @author
+ * Copyright (c) 2002  Mogami\n
+ *\n
+ * This software may be copied and distributed for educational, research, and\n
+ * not for profit purposes provided that this copyright and statement are\n
+ * included in all such copies.\n
+ * 2014 Deskull rearranged comment for Doxygen.\n
  */
 
 #include "angband.h"
 
 #ifdef JP
 
-static char KEY_ALL[] = "¤¹¤Ù¤Æ¤Î";
-static char KEY_UNAWARE[] = "̤ȽÌÀ¤Î";
-static char KEY_UNIDENTIFIED[] = "̤´ÕÄê¤Î";
-static char KEY_IDENTIFIED[] = "´ÕÄêºÑ¤ß¤Î";
-static char KEY_STAR_IDENTIFIED[] = "*´ÕÄê*ºÑ¤ß¤Î";
-static char KEY_COLLECTING[] = "¼ý½¸Ãæ¤Î";
-static char KEY_ARTIFACT[] = "¥¢¡¼¥Æ¥£¥Õ¥¡¥¯¥È";
-static char KEY_EGO[] = "¥¨¥´";
-static char KEY_GOOD[] = "¾å¼Á¤Î";
-static char KEY_NAMELESS[] = "̵ÌäÎ";
-static char KEY_AVERAGE[] = "ʤÎ";
-static char KEY_WORTHLESS[] = "̵²ÁÃͤÎ";
-static char KEY_RARE[] = "¥ì¥¢¤Ê";
-static char KEY_COMMON[] = "¤¢¤ê¤Õ¤ì¤¿";
-static char KEY_BOOSTED[] = "¥À¥¤¥¹Ìܤΰ㤦";
-static char KEY_MORE_THAN[] =  "¥À¥¤¥¹ÌÜ";
-static char KEY_DICE[] =  "°Ê¾å¤Î";
-static char KEY_MORE_BONUS[] =  "½¤ÀµÃÍ";
-static char KEY_MORE_BONUS2[] =  "°Ê¾å¤Î";
-static char KEY_WANTED[] = "¾Þ¶â¼ó¤Î";
-static char KEY_UNIQUE[] = "¥æ¥Ë¡¼¥¯¡¦¥â¥ó¥¹¥¿¡¼¤Î";
-static char KEY_HUMAN[] = "¿Í´Ö¤Î";
-static char KEY_UNREADABLE[] = "Æɤá¤Ê¤¤";
-static char KEY_REALM1[] = "Âè°ìÎΰè¤Î";
-static char KEY_REALM2[] = "ÂèÆóÎΰè¤Î";
-static char KEY_FIRST[] = "1ºýÌܤÎ";
-static char KEY_SECOND[] = "2ºýÌܤÎ";
-static char KEY_THIRD[] = "3ºýÌܤÎ";
-static char KEY_FOURTH[] = "4ºýÌܤÎ";
-static char KEY_ITEMS[] = "¥¢¥¤¥Æ¥à";
-static char KEY_WEAPONS[] = "Éð´ï";
-static char KEY_FAVORITE_WEAPONS[] = "ÆÀ°ÕÉð´ï";
-static char KEY_ARMORS[] = "Ëɶñ";
-static char KEY_MISSILES[] = "Ìð";
-static char KEY_DEVICES[] = "ËâË¡¥¢¥¤¥Æ¥à";
-static char KEY_LIGHTS[] = "¸÷¸»";
-static char KEY_JUNKS[] = "¤¬¤é¤¯¤¿";
-static char KEY_CORPSES[] = "»àÂΤä¹ü";
-static char KEY_SPELLBOOKS[] = "ËâË¡½ñ";
-static char KEY_HAFTED[] = "Æß´ï";
-static char KEY_SHIELDS[] = "½â";
-static char KEY_BOWS[] = "µÝ";
-static char KEY_RINGS[] = "»ØÎØ";
-static char KEY_AMULETS[] = "¥¢¥ß¥å¥ì¥Ã¥È";
-static char KEY_SUITS[] = "³»";
-static char KEY_CLOAKS[] = "¥¯¥í¡¼¥¯";
-static char KEY_HELMS[] = "³õ";
-static char KEY_GLOVES[] = "äƼê";
-static char KEY_BOOTS[] = "·¤";
+static char KEY_ALL[] = "すべての";
+static char KEY_UNAWARE[] = "未判明の";
+static char KEY_UNIDENTIFIED[] = "未鑑定の";
+static char KEY_IDENTIFIED[] = "鑑定済みの";
+static char KEY_STAR_IDENTIFIED[] = "*鑑定*済みの";
+static char KEY_COLLECTING[] = "収集中の";
+static char KEY_ARTIFACT[] = "アーティファクト";
+static char KEY_EGO[] = "ã\82¨ã\82´";
+static char KEY_GOOD[] = "上質の";
+static char KEY_NAMELESS[] = "無銘の";
+static char KEY_AVERAGE[] = "並の";
+static char KEY_WORTHLESS[] = "無価値の";
+static char KEY_RARE[] = "レアな";
+static char KEY_COMMON[] = "ありふれた";
+static char KEY_BOOSTED[] = "ダイス目の違う";
+static char KEY_MORE_THAN[] =  "ダイス目";
+static char KEY_DICE[] =  "以上の";
+static char KEY_MORE_BONUS[] =  "修正値";
+static char KEY_MORE_BONUS2[] =  "以上の";
+static char KEY_WANTED[] = "賞金首の";
+static char KEY_UNIQUE[] = "ユニーク・モンスターの";
+static char KEY_HUMAN[] = "人間の";
+static char KEY_UNREADABLE[] = "読めない";
+static char KEY_REALM1[] = "第一領域の";
+static char KEY_REALM2[] = "第二領域の";
+static char KEY_FIRST[] = "1冊目の";
+static char KEY_SECOND[] = "2冊目の";
+static char KEY_THIRD[] = "3冊目の";
+static char KEY_FOURTH[] = "4冊目の";
+static char KEY_ITEMS[] = "アイテム";
+static char KEY_WEAPONS[] = "武器";
+static char KEY_FAVORITE_WEAPONS[] = "得意武器";
+static char KEY_ARMORS[] = "防具";
+static char KEY_MISSILES[] = "";
+static char KEY_DEVICES[] = "魔法アイテム";
+static char KEY_LIGHTS[] = "光源";
+static char KEY_JUNKS[] = "がらくた";
+static char KEY_CORPSES[] = "死体や骨";
+static char KEY_SPELLBOOKS[] = "魔法書";
+static char KEY_HAFTED[] = "鈍器";
+static char KEY_SHIELDS[] = "";
+static char KEY_BOWS[] = "";
+static char KEY_RINGS[] = "指輪";
+static char KEY_AMULETS[] = "アミュレット";
+static char KEY_SUITS[] = "";
+static char KEY_CLOAKS[] = "ã\82¯ã\83­ã\83¼ã\82¯";
+static char KEY_HELMS[] = "";
+static char KEY_GLOVES[] = "籠手";
+static char KEY_BOOTS[] = "";
 
 #else 
 
@@ -194,7 +195,7 @@ static char KEY_BOOTS[] = "boots";
 #define IS_FLG(FLG) (entry->flag[FLG / 32] & (1L << (FLG % 32)))
 
 #ifdef JP
-       static char kanji_colon[] = "¡§";
+       static char kanji_colon[] = "";
 #endif
 
 
@@ -210,7 +211,7 @@ static bool autopick_new_entry(autopick_type *entry, cptr str, bool allow_defaul
        cptr prev_ptr, ptr, old_ptr;
        int prev_flg;
 
-       if (str[1] == ':') switch (str[0])
+       if (str[0] && str[1] == ':') switch (str[0])
        {
        case '?': case '%':
        case 'A': case 'P': case 'C':
@@ -219,6 +220,7 @@ static bool autopick_new_entry(autopick_type *entry, cptr str, bool allow_defaul
 
        entry->flag[0] = entry->flag[1] = 0L;
        entry->dice = 0;
+       entry->bonus = 0;
 
        act = DO_AUTOPICK | DO_DISPLAY;
        while (TRUE)
@@ -271,7 +273,7 @@ static bool autopick_new_entry(autopick_type *entry, cptr str, bool allow_defaul
                        break;
                }
 
-               if (isupper(c)) c = tolower(c);
+               if (isupper(c)) c = (char)tolower(c);
 
                buf[i] = c;
        }
@@ -444,7 +446,7 @@ static void autopick_entry_from_object(autopick_type *entry, object_type *o_ptr)
        bool name = TRUE;
 
 #ifdef JP
-       /* ¥¨¥´Ì䬼ÙË⤫¤â¤·¤ì¤Ê¤¤¤Î¤Ç¡¢¥Ç¥Õ¥©¥ë¥È¤Ç¡Ö^¡×¤ÏÉÕ¤±¤Ê¤¤ */
+       /* エゴ銘が邪魔かもしれないので、デフォルトで「^」は付けない */
        bool bol_mark = FALSE;
 #else
        /* We can always use the ^ mark in English */
@@ -520,7 +522,6 @@ static void autopick_entry_from_object(autopick_type *entry, object_type *o_ptr)
        {
                /* Ego objects */
                if (object_is_ego(o_ptr))
-                   
                {
                        if (object_is_weapon_armour_ammo(o_ptr))
                        {
@@ -531,7 +532,7 @@ static void autopick_entry_from_object(autopick_type *entry, object_type *o_ptr)
                                 */
                                ego_item_type *e_ptr = &e_info[o_ptr->name2];
 #ifdef JP
-                               /* ¥¨¥´ÌäˤϡÖ^¡×¥Þ¡¼¥¯¤¬»È¤¨¤ë */
+                               /* エゴ銘には「^」マークが使える */
                                sprintf(name_str, "^%s", e_name + e_ptr->name);
 #else
                                /* We ommit the basename and cannot use the ^ mark */
@@ -541,11 +542,8 @@ static void autopick_entry_from_object(autopick_type *entry, object_type *o_ptr)
                                /* Don't use the object description */
                                name = FALSE;
 
-                               if (object_is_weapon_armour_ammo(o_ptr))
-                               {
-                                       /* Restrict to 'common' equipments */
-                                       if (!object_is_rare(o_ptr)) ADD_FLG(FLG_COMMON);
-                               }
+                               /* Restrict to 'common' equipments */
+                               if (!object_is_rare(o_ptr)) ADD_FLG(FLG_COMMON);
                        }
 
                        ADD_FLG(FLG_EGO);
@@ -692,6 +690,8 @@ static void autopick_free_entry(autopick_type *entry)
 {
        string_free(entry->name);
        string_free(entry->insc);
+       entry->name = NULL;
+       entry->insc = NULL;
 }
 
 
@@ -733,11 +733,7 @@ static void init_autopick(void)
  */
 static cptr pickpref_filename(int filename_mode)
 {
-#ifdef JP
-       static const char namebase[] = "picktype";
-#else
-       static const char namebase[] = "pickpref";
-#endif
+       static const char namebase[] = _("picktype", "pickpref");
 
        switch (filename_mode)
        {
@@ -745,7 +741,7 @@ static cptr pickpref_filename(int filename_mode)
                return format("%s.prf", namebase);
 
        case PT_WITH_PNAME:
-               return format("%s-%s.prf", namebase, player_name);
+               return format("%s-%s.prf", namebase, player_base);
 
        default:
                return NULL;
@@ -773,11 +769,7 @@ void autopick_load_pref(bool disp_mes)
        if (err == 0 && disp_mes)
        {
                /* Success */
-#ifdef JP
-               msg_format("%s¤òÆɤ߹þ¤ß¤Þ¤·¤¿¡£", buf);
-#else
-               msg_format("Loaded '%s'.", buf);
-#endif
+               msg_format(_("%sを読み込みました。", "Loaded '%s'."), buf);
        }
 
        /* No file found */
@@ -792,22 +784,14 @@ void autopick_load_pref(bool disp_mes)
                if (err == 0 && disp_mes)
                {
                        /* Success */
-#ifdef JP
-                       msg_format("%s¤òÆɤ߹þ¤ß¤Þ¤·¤¿¡£", buf);
-#else
-                       msg_format("Loaded '%s'.", buf);
-#endif
+                       msg_format(_("%sを読み込みました。", "Loaded '%s'."), buf);
                }
        }
 
        if (err && disp_mes)
        {
                /* Failed */
-#ifdef JP
-               msg_print("¼«Æ°½¦¤¤ÀßÄê¥Õ¥¡¥¤¥ë¤ÎÆɤ߹þ¤ß¤Ë¼ºÇÔ¤·¤Þ¤·¤¿¡£");
-#else
-               msg_print("Failed to reload autopick preference.");
-#endif
+               msg_print(_("自動拾い設定ファイルの読み込みに失敗しました。", "Failed to reload autopick preference."));
        }
 }
 
@@ -830,10 +814,10 @@ static void add_autopick_list(autopick_type *entry)
                C_MAKE(autopick_list, max_max_autopick, autopick_type);
 
                /* Copy from old list to new list */
-               C_COPY(autopick_list, old_autopick_list, old_max_max_autopick, autopick_type);
+               (void)C_COPY(autopick_list, old_autopick_list, old_max_max_autopick, autopick_type);
 
                /* Kill old list */
-               C_FREE(old_autopick_list, old_max_max_autopick, autopick_type);
+               C_KILL(old_autopick_list, old_max_max_autopick, autopick_type);
        }
 
        /* Add one line */
@@ -861,7 +845,7 @@ errr process_autopick_file_command(char *buf)
                        continue;
                }
 #endif
-               if (isspace(buf[i]) && buf[i] != ' ')
+               if (iswspace(buf[i]) && buf[i] != ' ')
                        break;
        }
        buf[i] = 0;
@@ -874,7 +858,11 @@ errr process_autopick_file_command(char *buf)
                   && entry->flag[0] == autopick_list[i].flag[0]
                   && entry->flag[1] == autopick_list[i].flag[1]
                   && entry->dice == autopick_list[i].dice
-                  && entry->bonus == autopick_list[i].bonus) return 0;
+                  && entry->bonus == autopick_list[i].bonus)
+               {
+                       autopick_free_entry(entry);
+                       return 0;
+               }
 
        add_autopick_list(entry);
        return 0;
@@ -1058,6 +1046,12 @@ static bool is_autopick_aux(object_type *o_ptr, autopick_type *entry, cptr o_nam
                /* Require boosted dice */
                if ((o_ptr->dd == k_ptr->dd) && (o_ptr->ds == k_ptr->ds))
                        return FALSE;
+               
+               /* In Vault Quest, Dice must be hide.*/
+               if(!object_is_known(o_ptr) && object_is_quest_target(o_ptr))
+               {
+                       return FALSE;
+               }
        }
 
        /*** Weapons which dd*ds is more than nn ***/
@@ -1232,11 +1226,11 @@ static bool is_autopick_aux(object_type *o_ptr, autopick_type *entry, cptr o_nam
                }
        }
 
-       /*** Rere equpiments ***/
+       /*** Rere equipments ***/
        if (IS_FLG(FLG_RARE) && !object_is_rare(o_ptr))
                return FALSE;
 
-       /*** Common equpiments ***/
+       /*** Common equipments ***/
        if (IS_FLG(FLG_COMMON) && object_is_rare(o_ptr))
                return FALSE;
 
@@ -1494,21 +1488,21 @@ static bool is_opt_confirm_destroy(object_type *o_ptr)
        /* Known to be worthless? */
        if (leave_worth)
                if (object_value(o_ptr) > 0) return FALSE;
-       
+
        if (leave_equip)
-               if (!object_is_weapon_armour_ammo(o_ptr)) return FALSE;
-       
+               if (object_is_weapon_armour_ammo(o_ptr)) return FALSE;
+
        if (leave_chest)
                if ((o_ptr->tval == TV_CHEST) && o_ptr->pval) return FALSE;
-       
+
        if (leave_wanted)
        {
                if (object_is_shoukinkubi(o_ptr)) return FALSE;
        }
-       
+
        if (leave_corpse)
                if (o_ptr->tval == TV_CORPSE) return FALSE;
-       
+
        if (leave_junk)
                if ((o_ptr->tval == TV_SKELETON) || (o_ptr->tval == TV_BOTTLE) || (o_ptr->tval == TV_JUNK) || (o_ptr->tval == TV_STATUE)) return FALSE;
 
@@ -1531,20 +1525,20 @@ static bool is_opt_confirm_destroy(object_type *o_ptr)
                else if (p_ptr->pclass == CLASS_NINJA)
                {
                        if (o_ptr->tval == TV_LITE &&
-                           o_ptr->name2 == EGO_LITE_DARKNESS)
+                           o_ptr->name2 == EGO_LITE_DARKNESS && object_is_known(o_ptr))
                                return FALSE;
                }
                else if (p_ptr->pclass == CLASS_BEASTMASTER ||
                         p_ptr->pclass == CLASS_CAVALRY)
                {
                        if (o_ptr->tval == TV_WAND &&
-                           o_ptr->sval == SV_WAND_HEAL_MONSTER)
+                           o_ptr->sval == SV_WAND_HEAL_MONSTER && object_is_aware(o_ptr))
                                return FALSE;
                }
        }
-       
+
        if (o_ptr->tval == TV_GOLD) return FALSE;
-       
+
        return TRUE;
 }
 
@@ -1583,7 +1577,7 @@ static void auto_destroy_item(object_type *o_ptr, int autopick_idx)
 
        /* Now decided to destroy */
 
-       disturb(0,0);
+       disturb(FALSE, FALSE);
 
        /* Artifact? */
        if (!can_player_destroy_object(o_ptr))
@@ -1593,19 +1587,13 @@ static void auto_destroy_item(object_type *o_ptr, int autopick_idx)
                /* Describe the object (with {terrible/special}) */
                object_desc(o_name, o_ptr, 0);
 
-               /* Message */
-#ifdef JP
-               msg_format("%s¤ÏÇ˲õÉÔǽ¤À¡£", o_name);
-#else
-               msg_format("You cannot auto-destroy %s.", o_name);
-#endif
+               msg_format(_("%sは破壊不能だ。", "You cannot auto-destroy %s."), o_name);
 
-               /* Done */
                return;
        }
 
        /* Record name of destroyed item */
-       COPY(&autopick_last_destroyed_object, o_ptr, object_type);
+       (void)COPY(&autopick_last_destroyed_object, o_ptr, object_type);
 
        /* Destroy Later */
        o_ptr->marked |= OM_AUTODESTROY;
@@ -1618,7 +1606,7 @@ static void auto_destroy_item(object_type *o_ptr, int autopick_idx)
 /*
  *  Auto-destroy marked item
  */
-static void autopick_delayed_alter_aux(int item)
+static void autopick_delayed_alter_aux(INVENTORY_IDX item)
 {
        object_type *o_ptr;
 
@@ -1628,7 +1616,7 @@ static void autopick_delayed_alter_aux(int item)
        /* Get the item (on the floor) */
        else o_ptr = &o_list[0 - item];
 
-       if (o_ptr->k_idx && o_ptr->marked & OM_AUTODESTROY)
+       if (o_ptr->k_idx && (o_ptr->marked & OM_AUTODESTROY))
        {
                char o_name[MAX_NLEN];
 
@@ -1648,12 +1636,7 @@ static void autopick_delayed_alter_aux(int item)
                        delete_object_idx(0 - item);
                }
 
-               /* Print a message */
-#ifdef JP
-               msg_format("%s¤ò¼«Æ°Ç˲õ¤·¤Þ¤¹¡£", o_name);
-#else
-               msg_format("Auto-destroying %s.", o_name);
-#endif
+               msg_format(_("%sを自動破壊します。", "Auto-destroying %s."), o_name);
        }
 }
 
@@ -1663,7 +1646,7 @@ static void autopick_delayed_alter_aux(int item)
  */
 void autopick_delayed_alter(void)
 {
-       int item;
+       INVENTORY_IDX item;
 
        /* 
         * Scan inventry in reverse order to prevent
@@ -1673,10 +1656,10 @@ void autopick_delayed_alter(void)
                autopick_delayed_alter_aux(item);
 
        /* Scan the pile of objects */
-       item = cave[py][px].o_idx;
+       item = cave[p_ptr->y][p_ptr->x].o_idx;
        while (item)
        {
-               int next = o_list[item].next_o_idx;
+               OBJECT_IDX next = o_list[item].next_o_idx;
                autopick_delayed_alter_aux(-item);
                item = next;
        }
@@ -1689,7 +1672,7 @@ void autopick_delayed_alter(void)
  * Auto-destroyer works only on inventory or on floor stack only when
  * requested.
  */
-void autopick_alter_item(int item, bool destroy)
+void autopick_alter_item(INVENTORY_IDX item, bool destroy)
 {
        object_type *o_ptr;
        int idx;
@@ -1717,7 +1700,7 @@ void autopick_alter_item(int item, bool destroy)
  */
 void autopick_pickup_items(cave_type *c_ptr)
 {
-       s16b this_o_idx, next_o_idx = 0;
+       OBJECT_IDX this_o_idx, next_o_idx = 0;
        
        /* Scan the pile of objects */
        for (this_o_idx = c_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx)
@@ -1738,21 +1721,15 @@ void autopick_pickup_items(cave_type *c_ptr)
                if (idx >= 0 &&
                        (autopick_list[idx].action & (DO_AUTOPICK | DO_QUERY_AUTOPICK)))
                {
-                       disturb(0,0);
+                       disturb(FALSE, FALSE);
 
                        if (!inven_carry_okay(o_ptr))
                        {
                                char o_name[MAX_NLEN];
 
-                               /* Describe the object */
                                object_desc(o_name, o_ptr, 0);
 
-                               /* Message */
-#ifdef JP
-                               msg_format("¥¶¥Ã¥¯¤Ë¤Ï%s¤òÆþ¤ì¤ë·ä´Ö¤¬¤Ê¤¤¡£", o_name);
-#else
-                               msg_format("You have no room for %s.", o_name);
-#endif
+                               msg_format(_("ザックには%sを入れる隙間がない。", "You have no room for %s."), o_name);
                                /* Hack - remember that the item has given a message here. */
                                o_ptr->marked |= OM_NOMSG;
 
@@ -1769,14 +1746,9 @@ void autopick_pickup_items(cave_type *c_ptr)
                                        continue;
                                }
 
-                               /* Describe the object */
                                object_desc(o_name, o_ptr, 0);
 
-#ifdef JP
-                               sprintf(out_val, "%s¤ò½¦¤¤¤Þ¤¹¤«? ", o_name);
-#else
-                               sprintf(out_val, "Pick up %s? ", o_name);
-#endif
+                               sprintf(out_val, _("%sを拾いますか? ", "Pick up %s? "), o_name);
 
                                if (!get_check(out_val))
                                {
@@ -1841,12 +1813,7 @@ static bool clear_auto_register(void)
        {
                /* Close the preference file */
                fclose(pref_fff);
-
-#ifdef JP
-               msg_format("°ì»þ¥Õ¥¡¥¤¥ë %s ¤òºîÀ®¤Ç¤­¤Þ¤»¤ó¤Ç¤·¤¿¡£", tmp_file);
-#else
-               msg_format("Failed to create temporary file %s.", tmp_file);
-#endif
+               msg_format(_("一時ファイル %s を作成できませんでした。", "Failed to create temporary file %s."), tmp_file);
                msg_print(NULL);
                return FALSE;
        }
@@ -1888,13 +1855,9 @@ static bool clear_auto_register(void)
 
        if (num)
        {
-#ifdef JP
-               msg_format("°ÊÁ°¤Î¥­¥ã¥é¥¯¥¿¡¼ÍѤμ«Æ°ÀßÄê(%d¹Ô)¤¬»Ä¤Ã¤Æ¤¤¤Þ¤¹¡£", num);
-               strcpy(buf, "¸Å¤¤ÀßÄê¹Ô¤Ïºï½ü¤·¤Þ¤¹¡£¤è¤í¤·¤¤¤Ç¤¹¤«¡©");
-#else
-               msg_format("Auto registered lines (%d lines) for previous character are remaining.", num);
-               strcpy(buf, "These lines will be deleted.  Are you sure? ");
-#endif
+               msg_format(_("以前のキャラクター用の自動設定(%d行)が残っています。",
+                                        "Auto registered lines (%d lines) for previous character are remaining."), num);
+               strcpy(buf, _("古い設定行は削除します。よろしいですか?", "These lines will be deleted.  Are you sure? "));
 
                /* You can cancel it */
                if (!get_check(buf))
@@ -1902,11 +1865,8 @@ static bool clear_auto_register(void)
                        okay = FALSE;
                        autoregister = FALSE;
 
-#ifdef JP
-                       msg_print("¥¨¥Ç¥£¥¿¤Î¥«¥Ã¥È&¥Ú¡¼¥¹¥ÈÅù¤ò»È¤Ã¤ÆɬÍפʹԤòÈòÆñ¤·¤Æ¤¯¤À¤µ¤¤¡£");
-#else
-                       msg_print("Use cut & paste of auto picker editor (_) to keep old prefs.");
-#endif
+                       msg_print(_("エディタのカット&ペースト等を使って必要な行を避難してください。",
+                                               "Use cut & paste of auto picker editor (_) to keep old prefs."));
                }
        }
 
@@ -1951,22 +1911,12 @@ bool autopick_autoregister(object_type *o_ptr)
                cptr what;
                byte act = autopick_list[match_autopick].action;
 
-#ifdef JP
-               if (act & DO_AUTOPICK) what = "¼«Æ°¤Ç½¦¤¦";
-               else if (act & DO_AUTODESTROY) what = "¼«Æ°Ç˲õ¤¹¤ë";
-               else if (act & DONT_AUTOPICK) what = "ÊüÃÖ¤¹¤ë";
-               else /* if (act & DO_QUERY_AUTOPICK) */ what = "³Îǧ¤·¤Æ½¦¤¦";
+               if (act & DO_AUTOPICK) what = _("自動で拾う", "auto-pickup");
+               else if (act & DO_AUTODESTROY) what = _("自動破壊する", "auto-destroy");
+               else if (act & DONT_AUTOPICK) what = _("放置する", "leave on floor");
+               else /* if (act & DO_QUERY_AUTOPICK) */ what = _("確認して拾う", "query auto-pickup");
 
-               msg_format("¤½¤Î¥¢¥¤¥Æ¥à¤Ï´û¤Ë%s¤è¤¦¤ËÀßÄꤵ¤ì¤Æ¤¤¤Þ¤¹¡£", what);
-#else
-               if (act & DO_AUTOPICK) what = "auto-pickup";
-               else if (act & DO_AUTODESTROY) what = "auto-destroy";
-               else if (act & DONT_AUTOPICK) what = "leave on floor";
-               else /* if (act & DO_QUERY_AUTOPICK) */ what = "query auto-pickup";
-
-               msg_format("The object is already registered to %s.", what);
-#endif
-               
+               msg_format(_("そのアイテムは既に%sように設定されています。", "The object is already registered to %s."), what);
                return FALSE;
        }
 
@@ -1980,14 +1930,8 @@ bool autopick_autoregister(object_type *o_ptr)
                /* Describe the object (with {terrible/special}) */
                object_desc(o_name, o_ptr, 0);
 
-               /* Message */
-#ifdef JP
-               msg_format("%s¤ÏÇ˲õÉÔǽ¤À¡£", o_name);
-#else
-               msg_format("You cannot auto-destroy %s.", o_name);
-#endif
+               msg_format(_("%sは破壊不能だ。", "You cannot auto-destroy %s."), o_name);
 
-               /* Done */
                return FALSE;
        }
 
@@ -2038,11 +1982,7 @@ bool autopick_autoregister(object_type *o_ptr)
 
        /* Failure */
        if (!pref_fff) {
-#ifdef JP
-               msg_format("%s ¤ò³«¤¯¤³¤È¤¬¤Ç¤­¤Þ¤»¤ó¤Ç¤·¤¿¡£", pref_file);
-#else
-               msg_format("Failed to open %s.", pref_file);
-#endif
+               msg_format(_("%s を開くことができませんでした。", "Failed to open %s."), pref_file);
                msg_print(NULL);
 
                /* Failed */
@@ -2054,13 +1994,10 @@ bool autopick_autoregister(object_type *o_ptr)
                /* Add the header */
                fprintf(pref_fff, "%s\n", autoregister_header);
 
-#ifdef JP
-               fprintf(pref_fff, "%s\n", "# *·Ù¹ð!!* °Ê¹ß¤Î¹Ô¤Ï¼«Æ°ÅÐÏ¿¤µ¤ì¤¿¤â¤Î¤Ç¤¹¡£");
-               fprintf(pref_fff, "%s\n", "# ¸å¤Ç¼«Æ°Åª¤Ëºï½ü¤µ¤ì¤Þ¤¹¤Î¤Ç¡¢É¬ÍפʹԤϾå¤ÎÊý¤Ø°ÜÆ°¤·¤Æ¤ª¤¤¤Æ¤¯¤À¤µ¤¤¡£");
-#else
-               fprintf(pref_fff, "%s\n", "# *Waring!* The lines below will be deleated later.");
-               fprintf(pref_fff, "%s\n", "# Keep it by cut & paste if you need these lines for future characters.");
-#endif
+               fprintf(pref_fff, "%s\n", _("# *警告!!* 以降の行は自動登録されたものです。",
+                                                           "# *Waring!* The lines below will be deleated later."));
+               fprintf(pref_fff, "%s\n", _("# 後で自動的に削除されますので、必要な行は上の方へ移動しておいてください。", 
+                                                           "# Keep it by cut & paste if you need these lines for future characters."));
 
                /* Now auto register is in-use */
                p_ptr->autopick_autoregister = TRUE;
@@ -2170,227 +2107,227 @@ static void describe_autopick(char *buff, autopick_type *entry)
        cptr before_str[100], body_str;
        int before_n = 0;
 
-       body_str = "¥¢¥¤¥Æ¥à";
+       body_str = "アイテム";
 
        /*** Collecting items ***/
        /*** Which can be absorbed into a slot as a bundle ***/
        if (IS_FLG(FLG_COLLECTING))
-               before_str[before_n++] = "¼ý½¸Ãæ¤Ç´û¤Ë»ý¤Ã¤Æ¤¤¤ë¥¹¥í¥Ã¥È¤Ë¤Þ¤È¤á¤é¤ì¤ë";
+               before_str[before_n++] = "収集中で既に持っているスロットにまとめられる";
        
        /*** Unaware items ***/
        if (IS_FLG(FLG_UNAWARE))
-               before_str[before_n++] = "̤´ÕÄê¤Ç¤½¤Î¸ú²Ì¤âȽÌÀ¤·¤Æ¤¤¤Ê¤¤";
+               before_str[before_n++] = "未鑑定でその効果も判明していない";
 
        /*** Unidentified ***/
        if (IS_FLG(FLG_UNIDENTIFIED))
-               before_str[before_n++] = "̤´ÕÄê¤Î";
+               before_str[before_n++] = "未鑑定の";
 
        /*** Identified ***/
        if (IS_FLG(FLG_IDENTIFIED))
-               before_str[before_n++] = "´ÕÄêºÑ¤ß¤Î";
+               before_str[before_n++] = "鑑定済みの";
 
        /*** *Identified* ***/
        if (IS_FLG(FLG_STAR_IDENTIFIED))
-               before_str[before_n++] = "´°Á´¤Ë´ÕÄêºÑ¤ß¤Î";
+               before_str[before_n++] = "完全に鑑定済みの";
 
        /*** Dice boosted (weapon of slaying) ***/
        if (IS_FLG(FLG_BOOSTED))
        {
-               before_str[before_n++] = "¥À¥á¡¼¥¸¥À¥¤¥¹¤¬Ä̾ï¤è¤êÂ礭¤¤";
-               body_str = "Éð´ï";
+               before_str[before_n++] = "ダメージダイスが通常より大きい";
+               body_str = "武器";
        }
 
        /*** Weapons whose dd*ds is more than nn ***/
        if (IS_FLG(FLG_MORE_DICE))
        {
                static char more_than_desc_str[] = "___";
-               before_str[before_n++] = "¥À¥á¡¼¥¸¥À¥¤¥¹¤ÎºÇÂçÃͤ¬";
-               body_str = "Éð´ï";
+               before_str[before_n++] = "ダメージダイスの最大値が";
+               body_str = "武器";
                        
                sprintf(more_than_desc_str,"%d", entry->dice);
                before_str[before_n++] = more_than_desc_str;
-               before_str[before_n++] = "°Ê¾å¤Î";
+               before_str[before_n++] = "以上の";
        }
 
        /*** Items whose magical bonus is more than nn ***/
        if (IS_FLG(FLG_MORE_BONUS))
        {
                static char more_bonus_desc_str[] = "___";
-               before_str[before_n++] = "½¤ÀµÃͤ¬(+";
+               before_str[before_n++] = "修正値が(+";
                        
                sprintf(more_bonus_desc_str,"%d", entry->bonus);
                before_str[before_n++] = more_bonus_desc_str;
-               before_str[before_n++] = ")°Ê¾å¤Î";
+               before_str[before_n++] = ")以上の";
        }
 
        /*** Worthless items ***/
        if (IS_FLG(FLG_WORTHLESS))
-               before_str[before_n++] = "Ź¤Ç̵²ÁÃͤÈȽÄꤵ¤ì¤ë";
+               before_str[before_n++] = "店で無価値と判定される";
 
        /*** Artifact ***/
        if (IS_FLG(FLG_ARTIFACT))
        {
-               before_str[before_n++] = "¥¢¡¼¥Æ¥£¥Õ¥¡¥¯¥È¤Î";
-               body_str = "ÁõÈ÷";
+               before_str[before_n++] = "アーティファクトの";
+               body_str = "装備";
        }
 
        /*** Ego ***/
        if (IS_FLG(FLG_EGO))
        {
-               before_str[before_n++] = "¥¨¥´¥¢¥¤¥Æ¥à¤Î";
-               body_str = "ÁõÈ÷";
+               before_str[before_n++] = "エゴアイテムの";
+               body_str = "装備";
        }
 
        /*** Good ***/
        if (IS_FLG(FLG_GOOD))
        {
-               before_str[before_n++] = "¾å¼Á¤Î";
-               body_str = "ÁõÈ÷";
+               before_str[before_n++] = "上質の";
+               body_str = "装備";
        }
 
        /*** Nameless ***/
        if (IS_FLG(FLG_NAMELESS))
        {
-               before_str[before_n++] = "¥¨¥´¤Ç¤â¥¢¡¼¥Æ¥£¥Õ¥¡¥¯¥È¤Ç¤â¤Ê¤¤";
-               body_str = "ÁõÈ÷";
+               before_str[before_n++] = "エゴでもアーティファクトでもない";
+               body_str = "装備";
        }
 
        /*** Average ***/
        if (IS_FLG(FLG_AVERAGE))
        {
-               before_str[before_n++] = "ʤÎ";
-               body_str = "ÁõÈ÷";
+               before_str[before_n++] = "並の";
+               body_str = "装備";
        }
 
-       /*** Rare equpiments ***/
+       /*** Rare equipments ***/
        if (IS_FLG(FLG_RARE))
        {
-               before_str[before_n++] = "¥É¥é¥´¥óÁõÈ÷¤ä¥«¥ª¥¹¡¦¥Ö¥ì¡¼¥ÉÅù¤ò´Þ¤àÄÁ¤·¤¤";
-               body_str = "ÁõÈ÷";
+               before_str[before_n++] = "ドラゴン装備やカオス・ブレード等を含む珍しい";
+               body_str = "装備";
        }
 
-       /*** Common equpiments ***/
+       /*** Common equipments ***/
        if (IS_FLG(FLG_COMMON))
        {
-               before_str[before_n++] = "¤¢¤ê¤Õ¤ì¤¿(¥É¥é¥´¥óÁõÈ÷¤ä¥«¥ª¥¹¡¦¥Ö¥ì¡¼¥ÉÅù¤ÎÄÁ¤·¤¤Êª¤Ç¤Ï¤Ê¤¤)";
-               body_str = "ÁõÈ÷";
+               before_str[before_n++] = "ありふれた(ドラゴン装備やカオス・ブレード等の珍しい物ではない)";
+               body_str = "装備";
        }
 
        /*** Wanted monster's corpse/skeletons ***/
        if (IS_FLG(FLG_WANTED))
        {
-               before_str[before_n++] = "¥Ï¥ó¥¿¡¼»ö̳½ê¤Ç¾Þ¶â¼ó¤È¤µ¤ì¤Æ¤¤¤ë";
-               body_str = "»àÂΤä¹ü";
+               before_str[before_n++] = "ハンター事務所で賞金首とされている";
+               body_str = "死体や骨";
        }
 
        /*** Human corpse/skeletons (for Daemon magic) ***/
        if (IS_FLG(FLG_HUMAN))
        {
-               before_str[before_n++] = "°­ËâËâË¡¤Ç»È¤¦¤¿¤á¤Î¿Í´Ö¤ä¥Ò¥å¡¼¥Þ¥Î¥¤¥É¤Î";
-               body_str = "»àÂΤä¹ü";
+               before_str[before_n++] = "悪魔魔法で使うための人間やヒューマノイドの";
+               body_str = "死体や骨";
        }
 
        /*** Unique monster's corpse/skeletons/statues ***/
        if (IS_FLG(FLG_UNIQUE))
        {
-               before_str[before_n++] = "¥æ¥Ë¡¼¥¯¥â¥ó¥¹¥¿¡¼¤Î";
-               body_str = "»àÂΤä¹ü";
+               before_str[before_n++] = "ユニークモンスターの";
+               body_str = "死体や骨";
        }
 
        /*** Unreadable spellbooks ***/
        if (IS_FLG(FLG_UNREADABLE))
        {
-               before_str[before_n++] = "¤¢¤Ê¤¿¤¬Æɤá¤Ê¤¤Îΰè¤Î";
-               body_str = "ËâË¡½ñ";
+               before_str[before_n++] = "あなたが読めない領域の";
+               body_str = "魔法書";
        }
 
        /*** First realm spellbooks ***/
        if (IS_FLG(FLG_REALM1))
        {
-               before_str[before_n++] = "Âè°ìÎΰè¤Î";
-               body_str = "ËâË¡½ñ";
+               before_str[before_n++] = "第一領域の";
+               body_str = "魔法書";
        }
 
        /*** Second realm spellbooks ***/
        if (IS_FLG(FLG_REALM2))
        {
-               before_str[before_n++] = "ÂèÆóÎΰè¤Î";
-               body_str = "ËâË¡½ñ";
+               before_str[before_n++] = "第二領域の";
+               body_str = "魔法書";
        }
 
        /*** First rank spellbooks ***/
        if (IS_FLG(FLG_FIRST))
        {
-               before_str[before_n++] = "Á´4ºý¤ÎÆâ¤Î1ºýÌܤÎ";
-               body_str = "ËâË¡½ñ";
+               before_str[before_n++] = "全4冊の内の1冊目の";
+               body_str = "魔法書";
        }
 
        /*** Second rank spellbooks ***/
        if (IS_FLG(FLG_SECOND))
        {
-               before_str[before_n++] = "Á´4ºý¤ÎÆâ¤Î2ºýÌܤÎ";
-               body_str = "ËâË¡½ñ";
+               before_str[before_n++] = "全4冊の内の2冊目の";
+               body_str = "魔法書";
        }
 
        /*** Third rank spellbooks ***/
        if (IS_FLG(FLG_THIRD))
        {
-               before_str[before_n++] = "Á´4ºý¤ÎÆâ¤Î3ºýÌܤÎ";
-               body_str = "ËâË¡½ñ";
+               before_str[before_n++] = "全4冊の内の3冊目の";
+               body_str = "魔法書";
        }
 
        /*** Fourth rank spellbooks ***/
        if (IS_FLG(FLG_FOURTH))
        {
-               before_str[before_n++] = "Á´4ºý¤ÎÆâ¤Î4ºýÌܤÎ";
-               body_str = "ËâË¡½ñ";
+               before_str[before_n++] = "全4冊の内の4冊目の";
+               body_str = "魔法書";
        }
 
        /*** Items ***/
        if (IS_FLG(FLG_ITEMS))
                ; /* Nothing to do */
        else if (IS_FLG(FLG_WEAPONS))
-               body_str = "Éð´ï";
+               body_str = "武器";
        else if (IS_FLG(FLG_FAVORITE_WEAPONS))
-               body_str = "ÆÀ°ÕÉð´ï";
+               body_str = "得意武器";
        else if (IS_FLG(FLG_ARMORS))
-               body_str = "Ëɶñ";
+               body_str = "防具";
        else if (IS_FLG(FLG_MISSILES))
-               body_str = "ÃƤäÌð¤ä¥¯¥í¥¹¥Ü¥¦¤ÎÌð";
+               body_str = "弾や矢やクロスボウの矢";
        else if (IS_FLG(FLG_DEVICES))
-               body_str = "´¬Êª¤äËâË¡ËÀ¤ä¾ó¤ä¥í¥Ã¥É";
+               body_str = "巻物や魔法棒や杖やロッド";
        else if (IS_FLG(FLG_LIGHTS))
-               body_str = "¸÷¸»ÍѤΥ¢¥¤¥Æ¥à";
+               body_str = "光源用のアイテム";
        else if (IS_FLG(FLG_JUNKS))
-               body_str = "Àޤ줿ËÀÅù¤Î¥¬¥é¥¯¥¿";
+               body_str = "æ\8a\98ã\82\8cã\81\9fæ£\92ç­\89ã\81®ã\82¬ã\83©ã\82¯ã\82¿";
        else if (IS_FLG(FLG_CORPSES))
-               body_str = "»àÂΤä¹ü";
+               body_str = "死体や骨";
        else if (IS_FLG(FLG_SPELLBOOKS))
-               body_str = "ËâË¡½ñ";
+               body_str = "魔法書";
        else if (IS_FLG(FLG_HAFTED))
-               body_str = "Æß´ï";
+               body_str = "鈍器";
        else if (IS_FLG(FLG_SHIELDS))
-               body_str = "½â";
+               body_str = "";
        else if (IS_FLG(FLG_BOWS))
-               body_str = "¥¹¥ê¥ó¥°¤äµÝ¤ä¥¯¥í¥¹¥Ü¥¦";
+               body_str = "ã\82¹ã\83ªã\83³ã\82°ã\82\84å¼\93ã\82\84ã\82¯ã\83­ã\82¹ã\83\9cã\82¦";
        else if (IS_FLG(FLG_RINGS))
-               body_str = "»ØÎØ";
+               body_str = "指輪";
        else if (IS_FLG(FLG_AMULETS))
-               body_str = "¥¢¥ß¥å¥ì¥Ã¥È";
+               body_str = "アミュレット";
        else if (IS_FLG(FLG_SUITS))
-               body_str = "³»";
+               body_str = "";
        else if (IS_FLG(FLG_CLOAKS))
-               body_str = "¥¯¥í¡¼¥¯";
+               body_str = "ã\82¯ã\83­ã\83¼ã\82¯";
        else if (IS_FLG(FLG_HELMS))
-               body_str = "¥Ø¥ë¥á¥Ã¥È¤ä´§";
+               body_str = "ヘルメットや冠";
        else if (IS_FLG(FLG_GLOVES))
-               body_str = "äƼê";
+               body_str = "籠手";
        else if (IS_FLG(FLG_BOOTS))
-               body_str = "¥Ö¡¼¥Ä";
+               body_str = "ブーツ";
 
        *buff = '\0';
        if (!before_n) 
-               strcat(buff, "Á´¤Æ¤Î");
+               strcat(buff, "全ての");
        else for (i = 0; i < before_n && before_str[i]; i++)
                strcat(buff, before_str[i]);
 
@@ -2404,52 +2341,52 @@ static void describe_autopick(char *buff, autopick_type *entry)
                        top = TRUE;
                }
 
-               strcat(buff, "¤Ç¡¢Ì¾Á°¤¬¡Ö");
+               strcat(buff, "で、名前が「");
                strncat(buff, str, 80);
                if (top)
-                       strcat(buff, "¡×¤Ç»Ï¤Þ¤ë¤â¤Î");
+                       strcat(buff, "」で始まるもの");
                else
-                       strcat(buff, "¡×¤ò´Þ¤à¤â¤Î");
+                       strcat(buff, "」を含むもの");
        }
 
        if (insc)
        {
-               strncat(buff, format("¤Ë¡Ö%s¡×", insc), 80);
+               strncat(buff, format("に「%s」", insc), 80);
 
                if (my_strstr(insc, "%%all"))
-                       strcat(buff, "(%%all¤ÏÁ´Ç½ÎϤòɽ¤¹±Ñ»ú¤Îµ­¹æ¤ÇÃÖ´¹)");
+                       strcat(buff, "(%%allは全能力を表す英字の記号で置換)");
                else if (my_strstr(insc, "%all"))
-                       strcat(buff, "(%all¤ÏÁ´Ç½ÎϤòɽ¤¹µ­¹æ¤ÇÃÖ´¹)");
+                       strcat(buff, "(%allは全能力を表す記号で置換)");
                else if (my_strstr(insc, "%%"))
-                       strcat(buff, "(%%¤ÏÄɲÃǽÎϤòɽ¤¹±Ñ»ú¤Îµ­¹æ¤ÇÃÖ´¹)");
+                       strcat(buff, "(%%は追加能力を表す英字の記号で置換)");
                else if (my_strstr(insc, "%"))
-                       strcat(buff, "(%¤ÏÄɲÃǽÎϤòɽ¤¹µ­¹æ¤ÇÃÖ´¹)");
+                       strcat(buff, "(%は追加能力を表す記号で置換)");
 
-               strcat(buff, "¤È¹ï¤ó¤Ç");
+               strcat(buff, "と刻んで");
        }
        else
-               strcat(buff, "¤ò");
+               strcat(buff, "");
 
        if (act & DONT_AUTOPICK)
-               strcat(buff, "ÊüÃÖ¤¹¤ë¡£");
+               strcat(buff, "放置する。");
        else if (act & DO_AUTODESTROY)
-               strcat(buff, "Ç˲õ¤¹¤ë¡£");
+               strcat(buff, "破壊する。");
        else if (act & DO_QUERY_AUTOPICK)
-               strcat(buff, "³Îǧ¤Î¸å¤Ë½¦¤¦¡£");
+               strcat(buff, "確認の後に拾う。");
        else
-               strcat(buff, "½¦¤¦¡£");
+               strcat(buff, "拾う。");
 
        if (act & DO_DISPLAY)
        {
                if (act & DONT_AUTOPICK)
-                       strcat(buff, "Á´ÂΥޥå×('M')¤Ç'N'¤ò²¡¤·¤¿¤È¤­¤Ëɽ¼¨¤¹¤ë¡£");
+                       strcat(buff, "全体マップ('M')で'N'を押したときに表示する。");
                else if (act & DO_AUTODESTROY)
-                       strcat(buff, "Á´ÂΥޥå×('M')¤Ç'K'¤ò²¡¤·¤¿¤È¤­¤Ëɽ¼¨¤¹¤ë¡£");
+                       strcat(buff, "全体マップ('M')で'K'を押したときに表示する。");
                else
-                       strcat(buff, "Á´ÂΥޥå×('M')¤Ç'M'¤ò²¡¤·¤¿¤È¤­¤Ëɽ¼¨¤¹¤ë¡£");
+                       strcat(buff, "全体マップ('M')で'M'を押したときに表示する。");
        }
        else
-               strcat(buff, "Á´ÂΥޥåפˤÏɽ¼¨¤·¤Ê¤¤¡£");
+               strcat(buff, "全体マップには表示しない。");
 
 #else /* JP */
 
@@ -2482,7 +2419,7 @@ static void describe_autopick(char *buff, autopick_type *entry)
        if (IS_FLG(FLG_STAR_IDENTIFIED))
                before_str[before_n++] = "fully identified";
 
-       /*** Rare equpiments ***/
+       /*** Rare equipments ***/
        if (IS_FLG(FLG_RARE))
        {
                before_str[before_n++] = "very rare";
@@ -2490,7 +2427,7 @@ static void describe_autopick(char *buff, autopick_type *entry)
                after_str[after_n++] = "such like Dragon armors, Blades of Chaos, etc.";
        }
 
-       /*** Common equpiments ***/
+       /*** Common equipments ***/
        if (IS_FLG(FLG_COMMON))
        {
                before_str[before_n++] = "relatively common";
@@ -2838,18 +2775,11 @@ static cptr *read_text_lines(cptr filename)
  */
 static void prepare_default_pickpref(void)
 {
-       static char *messages[] = {
-#ifdef JP
-               "¤¢¤Ê¤¿¤Ï¡Ö¼«Æ°½¦¤¤¥¨¥Ç¥£¥¿¡×¤ò½é¤á¤Æµ¯Æ°¤·¤Þ¤·¤¿¡£",
-               "¼«Æ°½¦¤¤¤Î¥æ¡¼¥¶¡¼ÀßÄê¥Õ¥¡¥¤¥ë¤¬¤Þ¤À½ñ¤«¤ì¤Æ¤¤¤Ê¤¤¤Î¤Ç¡¢",
-               "´ðËÜŪ¤Ê¼«Æ°½¦¤¤ÀßÄê¥Õ¥¡¥¤¥ë¤òlib/pref/picktype.prf¤«¤é¥³¥Ô¡¼¤·¤Þ¤¹¡£",
-               NULL
-#else
-               "You have activated the Auto-Picker Editor for the first time.",
-               "Since user pref file for autopick is not yet created,",
-               "the default setting is loaded from lib/pref/pickpref.prf .",
+       const cptr messages[] = {
+               _("あなたは「自動拾いエディタ」を初めて起動しました。", "You have activated the Auto-Picker Editor for the first time."),
+               _("自動拾いのユーザー設定ファイルがまだ書かれていないので、", "Since user pref file for autopick is not yet created,"),
+               _("基本的な自動拾い設定ファイルをlib/pref/picktype.prfからコピーします。", "the default setting is loaded from lib/pref/pickpref.prf ."),
                NULL
-#endif
        };
 
        char buf[1024];
@@ -2980,14 +2910,14 @@ static void free_text_lines(cptr *lines_list)
                string_free(lines_list[lines]);
 
        /* free list of pointers */
-       C_FREE((char **)lines_list, MAX_LINES, char *);
+       C_KILL(lines_list, MAX_LINES, cptr);
 }
 
 
 /*
  * Delete or insert string
  */
-static void toggle_keyword(text_body_type *tb, int flg)
+static void toggle_keyword(text_body_type *tb, BIT_FLAGS flg)
 {
        int by1, by2, y;
        bool add = TRUE;
@@ -3159,7 +3089,7 @@ static void toggle_command_letter(text_body_type *tb, byte flg)
 /*
  * Delete or insert string
  */
-static void add_keyword(text_body_type *tb, int flg)
+static void add_keyword(text_body_type *tb, BIT_FLAGS flg)
 {
        int by1, by2, y;
 
@@ -3313,7 +3243,7 @@ static bool insert_return_code(text_body_type *tb)
  */
 static object_type *choose_object(cptr q, cptr s)
 {
-       int item;
+       OBJECT_IDX item;
 
        if (!get_item(&item, q, s, (USE_INVEN | USE_FLOOR | USE_EQUIP))) return NULL;
 
@@ -3333,10 +3263,9 @@ static bool entry_from_choosed_object(autopick_type *entry)
        object_type *o_ptr;
        cptr q, s;
 
-       /* Get an item */
 #ifdef JP
-       q = "¤É¤Î¥¢¥¤¥Æ¥à¤òÅÐÏ¿¤·¤Þ¤¹¤«? ";
-       s = "¥¢¥¤¥Æ¥à¤ò»ý¤Ã¤Æ¤¤¤Ê¤¤¡£";
+       q = "どのアイテムを登録しますか? ";
+       s = "アイテムを持っていない。";
 #else
        q = "Enter which item? ";
        s = "You have nothing to enter.";
@@ -3358,10 +3287,9 @@ static byte get_object_for_search(object_type **o_handle, cptr *search_strp)
        object_type *o_ptr;
        cptr q, s;
 
-       /* Get an item */
 #ifdef JP
-       q = "¤É¤Î¥¢¥¤¥Æ¥à¤ò¸¡º÷¤·¤Þ¤¹¤«? ";
-       s = "¥¢¥¤¥Æ¥à¤ò»ý¤Ã¤Æ¤¤¤Ê¤¤¡£";
+       q = "どのアイテムを検索しますか? ";
+       s = "アイテムを持っていない。";
 #else
        q = "Enter which item? ";
        s = "You have nothing to enter.";
@@ -3412,11 +3340,7 @@ static byte get_string_for_search(object_type **o_handle, cptr *search_strp)
        char buf[MAX_NLEN+20];
        const int len = 80;
 
-#ifdef JP
-       char prompt[] = "¸¡º÷(^I:»ý¤Áʪ ^L:Ç˲õ¤µ¤ì¤¿Êª): ";
-#else
-       char prompt[] = "Search key(^I:inven ^L:destroyed): ";
-#endif
+       char prompt[] = _("検索(^I:持ち物 ^L:破壊された物): ", "Search key(^I:inven ^L:destroyed): ");
        int col = sizeof(prompt) - 1;
 
        /* Prepare string buffer for edit */
@@ -3519,7 +3443,6 @@ static byte get_string_for_search(object_type **o_handle, cptr *search_strp)
                        return (back ? -1 : 1);
 
                case KTRL('i'):
-                       /* Get an item */
                        return get_object_for_search(o_handle, search_strp);
 
                case KTRL('l'):
@@ -3711,6 +3634,8 @@ static void search_for_object(text_body_type *tb, object_type *o_ptr, bool forwa
 
        while (TRUE)
        {
+               bool match;
+
                /* End of list? */
                if (forward)
                {
@@ -3725,8 +3650,9 @@ static void search_for_object(text_body_type *tb, object_type *o_ptr, bool forwa
                if (!autopick_new_entry(entry, tb->lines_list[i], FALSE)) continue;
 
                /* Does this line match to the object? */
-               if (!is_autopick_aux(o_ptr, entry, o_name)) continue;
-
+               match = is_autopick_aux(o_ptr, entry, o_name);
+               autopick_free_entry(entry);
+               if (!match)     continue;
 
                /* Found a line but it's inactive */
                if (tb->states[i] & LSTAT_BYPASS)
@@ -3859,11 +3785,11 @@ static void search_for_string(text_body_type *tb, cptr search_str, bool forward)
 /*
  * Editor command id's
  */
-#define EC_QUIT                1 
-#define EC_SAVEQUIT            2     
-#define EC_REVERT             3 
-#define EC_HELP                4 
-#define EC_RETURN             5        
+#define EC_QUIT            1
+#define EC_SAVEQUIT        2
+#define EC_REVERT             3
+#define EC_HELP            4
+#define EC_RETURN             5
 #define EC_LEFT                       6 
 #define EC_DOWN                       7 
 #define EC_UP                 8 
@@ -3945,74 +3871,74 @@ static void search_for_string(text_body_type *tb, cptr search_str, bool forward)
 /* Manu names */
 #ifdef JP
 
-static char MN_QUIT[] = "¥»¡¼¥Ö̵¤·¤Ç½ªÎ»";
-static char MN_SAVEQUIT[] = "¥»¡¼¥Ö¤·¤Æ½ªÎ»";
-static char MN_REVERT[] = "Á´¤Æ¤ÎÊѹ¹¤òÇË´þ";
-static char MN_HELP[] = "¥Ø¥ë¥×";
-
-static char MN_MOVE[] = "¥«¡¼¥½¥ë°ÜÆ°";
-static char MN_LEFT[] =   "º¸          (¢«Ìð°õ¥­¡¼)";
-static char MN_DOWN[] =   "²¼          (¢­Ìð°õ¥­¡¼)";
-static char MN_UP[] =     "¾å          (¢¬Ìð°õ¥­¡¼)";
-static char MN_RIGHT[] =  "±¦          (¢ªÌð°õ¥­¡¼)";
-static char MN_BOL[] =    "¹Ô¤ÎÀèƬ";
-static char MN_EOL[] =    "¹Ô¤Î½ªÃ¼";
-static char MN_PGUP[] =   "¾å¤Î¥Ú¡¼¥¸  (PageUp¥­¡¼)";
-static char MN_PGDOWN[] = "²¼¤Î¥Ú¡¼¥¸  (PageDown¥­¡¼)";
-static char MN_TOP[] =    "1¹ÔÌܤذÜÆ° (Home¥­¡¼)";
-static char MN_BOTTOM[] = "ºÇ²¼¹Ô¤Ø°ÜÆ°(End¥­¡¼)";
-
-static char MN_EDIT[] = "ÊÔ½¸";
-static char MN_CUT[] = "¥«¥Ã¥È";
-static char MN_COPY[] = "¥³¥Ô¡¼";
-static char MN_PASTE[] = "¥Ú¡¼¥¹¥È";
-static char MN_BLOCK[] = "ÁªÂòÈϰϤλØÄê";
-static char MN_KILL_LINE[] = "¹Ô¤Î»Ä¤ê¤òºï½ü";
-static char MN_DELETE_CHAR[] = "1ʸ»úºï½ü";
-static char MN_BACKSPACE[] = "¥Ð¥Ã¥¯¥¹¥Ú¡¼¥¹";
-static char MN_RETURN[] = "²þ¹Ô";
-
-static char MN_SEARCH[] = "¸¡º÷";
-static char MN_SEARCH_STR[] = "ʸ»úÎó¤Ç¸¡º÷";
-static char MN_SEARCH_FORW[] = "Á°Êý¤ØºÆ¸¡º÷";
-static char MN_SEARCH_BACK[] = "¸åÊý¤ØºÆ¸¡º÷";
-static char MN_SEARCH_OBJ[] = "¥¢¥¤¥Æ¥à¤òÁªÂò¤·¤Æ¸¡º÷";
-static char MN_SEARCH_DESTROYED[] = "¼«Æ°Ç˲õ¤µ¤ì¤¿¥¢¥¤¥Æ¥à¤Ç¸¡º÷";
-
-static char MN_INSERT[] = "¿§¡¹ÁÞÆþ";
-static char MN_INSERT_OBJECT[] = "ÁªÂò¤·¤¿¥¢¥¤¥Æ¥à¤Î̾Á°¤òÁÞÆþ";
-static char MN_INSERT_DESTROYED[] = "¼«Æ°Ç˲õ¤µ¤ì¤¿¥¢¥¤¥Æ¥à¤Î̾Á°¤òÁÞÆþ";
-static char MN_INSERT_BLOCK[] = "¾ò·ïʬ´ô¥Ö¥í¥Ã¥¯¤ÎÎã¤òÁÞÆþ";
-static char MN_INSERT_MACRO[] = "¥Þ¥¯¥íÄêµÁ¤òÁÞÆþ";
-static char MN_INSERT_KEYMAP[] = "¥­¡¼¥Þ¥Ã¥×ÄêµÁ¤òÁÞÆþ";
-
-static char MN_COMMAND_LETTER[] = "½¦¤¤/Ç˲õ/ÊüÃÖ¤ÎÁªÂò";
-static char MN_CL_AUTOPICK[] = "¡Ö ¡× (¼«Æ°½¦¤¤)";
-static char MN_CL_DESTROY[] = "¡Ö!¡× (¼«Æ°Ç˲õ)";
-static char MN_CL_LEAVE[] = "¡Ö~¡× (ÊüÃÖ)";
-static char MN_CL_QUERY[] = "¡Ö;¡× (³Îǧ¤·¤Æ½¦¤¦)";
-static char MN_CL_NO_DISP[] = "¡Ö(¡× (¥Þ¥Ã¥×¥³¥Þ¥ó¥É¤Çɽ¼¨¤·¤Ê¤¤)";
-
-static char MN_ADJECTIVE_GEN[] = "·ÁÍÆ»ì(°ìÈÌ)¤ÎÁªÂò";
-static char MN_RARE[] = "¥ì¥¢¤Ê (ÁõÈ÷)";
-static char MN_COMMON[] = "¤¢¤ê¤Õ¤ì¤¿ (ÁõÈ÷)";
-
-static char MN_ADJECTIVE_SPECIAL[] = "·ÁÍÆ»ì(Æüì)¤ÎÁªÂò";
-static char MN_BOOSTED[] = "¥À¥¤¥¹Ìܤΰ㤦 (Éð´ï)";
-static char MN_MORE_DICE[] = "¥À¥¤¥¹ÌÜ # °Ê¾å¤Î (Éð´ï)";
-static char MN_MORE_BONUS[] = "½¤ÀµÃÍ # °Ê¾å¤Î (»ØÎØÅù)";
-static char MN_WANTED[] = "¾Þ¶â¼ó¤Î (»àÂÎ)";
-static char MN_UNIQUE[] = "¥æ¥Ë¡¼¥¯¡¦¥â¥ó¥¹¥¿¡¼¤Î (»àÂÎ)";
-static char MN_HUMAN[] = "¿Í´Ö¤Î (»àÂÎ)";
-static char MN_UNREADABLE[] = "Æɤá¤Ê¤¤ (ËâË¡½ñ)";
-static char MN_REALM1[] = "Âè°ìÎΰè¤Î (ËâË¡½ñ)";
-static char MN_REALM2[] = "ÂèÆóÎΰè¤Î (ËâË¡½ñ)";
-static char MN_FIRST[] = "1ºýÌܤΠ(ËâË¡½ñ)";
-static char MN_SECOND[] = "2ºýÌܤΠ(ËâË¡½ñ)";
-static char MN_THIRD[] = "3ºýÌܤΠ(ËâË¡½ñ)";
-static char MN_FOURTH[] = "4ºýÌܤΠ(ËâË¡½ñ)";
-
-static char MN_NOUN[] = "̾»ì¤ÎÁªÂò";
+static char MN_QUIT[] = "セーブ無しで終了";
+static char MN_SAVEQUIT[] = "セーブして終了";
+static char MN_REVERT[] = "全ての変更を破棄";
+static char MN_HELP[] = "ヘルプ";
+
+static char MN_MOVE[] = "カーソル移動";
+static char MN_LEFT[] =   "å·¦          (â\86\90ç\9f¢å\8d°ã\82­ã\83¼)";
+static char MN_DOWN[] =   "ä¸\8b          (â\86\93ç\9f¢å\8d°ã\82­ã\83¼)";
+static char MN_UP[] =     "ä¸\8a          (â\86\91ç\9f¢å\8d°ã\82­ã\83¼)";
+static char MN_RIGHT[] =  "å\8f³          (â\86\92ç\9f¢å\8d°ã\82­ã\83¼)";
+static char MN_BOL[] =    "行の先頭";
+static char MN_EOL[] =    "行の終端";
+static char MN_PGUP[] =   "ä¸\8aã\81®ã\83\9aã\83¼ã\82¸  (PageUpã\82­ã\83¼)";
+static char MN_PGDOWN[] = "ä¸\8bã\81®ã\83\9aã\83¼ã\82¸  (PageDownã\82­ã\83¼)";
+static char MN_TOP[] =    "1è¡\8cç\9b®ã\81¸ç§»å\8b\95 (Homeã\82­ã\83¼)";
+static char MN_BOTTOM[] = "æ\9c\80ä¸\8bè¡\8cã\81¸ç§»å\8b\95(Endã\82­ã\83¼)";
+
+static char MN_EDIT[] = "編集";
+static char MN_CUT[] = "カット";
+static char MN_COPY[] = "ã\82³ã\83\94ã\83¼";
+static char MN_PASTE[] = "ペースト";
+static char MN_BLOCK[] = "選択範囲の指定";
+static char MN_KILL_LINE[] = "行の残りを削除";
+static char MN_DELETE_CHAR[] = "1文字削除";
+static char MN_BACKSPACE[] = "ã\83\90ã\83\83ã\82¯ã\82¹ã\83\9aã\83¼ã\82¹";
+static char MN_RETURN[] = "改行";
+
+static char MN_SEARCH[] = "検索";
+static char MN_SEARCH_STR[] = "文字列で検索";
+static char MN_SEARCH_FORW[] = "前方へ再検索";
+static char MN_SEARCH_BACK[] = "後方へ再検索";
+static char MN_SEARCH_OBJ[] = "アイテムを選択して検索";
+static char MN_SEARCH_DESTROYED[] = "自動破壊されたアイテムで検索";
+
+static char MN_INSERT[] = "色々挿入";
+static char MN_INSERT_OBJECT[] = "選択したアイテムの名前を挿入";
+static char MN_INSERT_DESTROYED[] = "自動破壊されたアイテムの名前を挿入";
+static char MN_INSERT_BLOCK[] = "条件分岐ブロックの例を挿入";
+static char MN_INSERT_MACRO[] = "マクロ定義を挿入";
+static char MN_INSERT_KEYMAP[] = "キーマップ定義を挿入";
+
+static char MN_COMMAND_LETTER[] = "拾い/破壊/放置の選択";
+static char MN_CL_AUTOPICK[] = "「 」 (自動拾い)";
+static char MN_CL_DESTROY[] = "「!」 (自動破壊)";
+static char MN_CL_LEAVE[] = "「~」 (放置)";
+static char MN_CL_QUERY[] = "「;」 (確認して拾う)";
+static char MN_CL_NO_DISP[] = "「(」 (マップコマンドで表示しない)";
+
+static char MN_ADJECTIVE_GEN[] = "形容詞(一般)の選択";
+static char MN_RARE[] = "レアな (装備)";
+static char MN_COMMON[] = "ありふれた (装備)";
+
+static char MN_ADJECTIVE_SPECIAL[] = "形容詞(特殊)の選択";
+static char MN_BOOSTED[] = "ダイス目の違う (武器)";
+static char MN_MORE_DICE[] = "ダイス目 # 以上の (武器)";
+static char MN_MORE_BONUS[] = "修正値 # 以上の (指輪等)";
+static char MN_WANTED[] = "賞金首の (死体)";
+static char MN_UNIQUE[] = "ユニーク・モンスターの (死体)";
+static char MN_HUMAN[] = "人間の (死体)";
+static char MN_UNREADABLE[] = "読めない (魔法書)";
+static char MN_REALM1[] = "第一領域の (魔法書)";
+static char MN_REALM2[] = "第二領域の (魔法書)";
+static char MN_FIRST[] = "1冊目の (魔法書)";
+static char MN_SECOND[] = "2冊目の (魔法書)";
+static char MN_THIRD[] = "3冊目の (魔法書)";
+static char MN_FOURTH[] = "4冊目の (魔法書)";
+
+static char MN_NOUN[] = "名詞の選択";
 
 #else
 
@@ -4296,11 +4222,7 @@ static int do_command_menu(int level, int start)
 
                                if (menu_data[i].com_id == -1)
                                {
-#ifdef JP
-                                       strcpy(com_key_str, "¢§");
-#else
-                                       strcpy(com_key_str, ">");
-#endif
+                                       strcpy(com_key_str, _("▼", ">"));
                                }
                                else if (menu_data[i].key != -1)
                                {
@@ -4326,11 +4248,7 @@ static int do_command_menu(int level, int start)
                        /* The menu was shown */
                        redraw = FALSE;
                }
-#ifdef JP
-               prt(format("(a-%c) ¥³¥Þ¥ó¥É:", menu_key + 'a' - 1), 0, 0);
-#else
-               prt(format("(a-%c) Command:", menu_key + 'a' - 1), 0, 0);
-#endif
+               prt(format(_("(a-%c) コマンド:", "(a-%c) Command:"), menu_key + 'a' - 1), 0, 0);
                key = inkey();
 
                if (key == ESCAPE) return 0;
@@ -4523,7 +4441,6 @@ static void draw_text_editor(text_body_type *tb)
        int i;
        int by1 = 0, by2 = 0;
 
-       /* Get size */
        Term_get_size(&tb->wid, &tb->hgt);
 
        /*
@@ -4603,6 +4520,8 @@ static void draw_text_editor(text_body_type *tb)
                        char f;
                        cptr v;
                        cptr s = tb->lines_list[y];
+                       char *ss, *s_keep;
+                       int s_len;
 
                        /* Update this line's state */
                        tb->states[y] = state;
@@ -4614,13 +4533,20 @@ static void draw_text_editor(text_body_type *tb)
                        if (streq(s, "$AUTOREGISTER"))
                                state |= LSTAT_AUTOREGISTER;
 
+                       s_len = strlen(s);
+                       ss = (char *)string_make(s);
+                       s_keep = ss;
+
                        /* Parse the expr */
-                       v = process_pref_file_expr(&s, &f);
+                       v = process_pref_file_expr(&ss, &f);
 
                        /* Set flag */
                        if (streq(v, "0")) state |= LSTAT_BYPASS;
                        else state &= ~LSTAT_BYPASS;
 
+                       /* Cannot use string_free() because the string was "destroyed" */
+                       C_KILL(s_keep, s_len + 1, char);
+
                        /* Re-update this line's state */
                        tb->states[y] = state | LSTAT_EXPRESSION;
                }
@@ -4740,76 +4666,41 @@ static void draw_text_editor(text_body_type *tb)
                /* Display information */
                if (tb->dirty_flags & DIRTY_NOT_FOUND)
                {
-#ifdef JP
-                       str1 = format("¥Ñ¥¿¡¼¥ó¤¬¸«¤Ä¤«¤ê¤Þ¤»¤ó: %s", tb->search_str);
-#else
-                       str1 = format("Pattern not found: %s", tb->search_str);
-#endif
+                       str1 = format(_("パターンが見つかりません: %s", "Pattern not found: %s"), tb->search_str);
                }
                else if (tb->dirty_flags & DIRTY_SKIP_INACTIVE)
                {
-#ifdef JP
-                       str1 = format("̵¸ú¾õÂ֤ιԤò¥¹¥­¥Ã¥×¤·¤Þ¤·¤¿¡£(%s¤ò¸¡º÷Ãæ)", tb->search_str);
-#else
-                       str1 = format("Some inactive lines are skipped. (Searching %s)", tb->search_str);
-#endif
+                       str1 = format(_("無効状態の行をスキップしました。(%sを検索中)", 
+                                                       "Some inactive lines are skipped. (Searching %s)"), tb->search_str);
                }
                else if (tb->dirty_flags & DIRTY_INACTIVE)
                {
-#ifdef JP
-                       str1 = format("̵¸ú¾õÂ֤ιԤÀ¤±¤¬¸«ÉÕ¤«¤ê¤Þ¤·¤¿¡£(%s¤ò¸¡º÷Ãæ)", tb->search_str);
-#else
-                       str1 = format("Found only an inactive line. (Searching %s)", tb->search_str);
-#endif
+                       str1 = format(_("無効状態の行だけが見付かりました。(%sを検索中)",
+                                                       "Found only an inactive line. (Searching %s)"), tb->search_str);
                }
                else if (tb->dirty_flags & DIRTY_NO_SEARCH)
                {
-#ifdef JP
-                       str1 = "¸¡º÷¤¹¤ë¥Ñ¥¿¡¼¥ó¤¬¤¢¤ê¤Þ¤»¤ó(^S ¤Ç¸¡º÷)¡£";
-#else
-                       str1 = "No pattern to search. (Press ^S to search.)";
-#endif
+                       str1 = _("検索するパターンがありません(^S で検索)。", "No pattern to search. (Press ^S to search.)");
                }
                else if (tb->lines_list[tb->cy][0] == '#')
                {
-#ifdef JP
-                       str1 = "¤³¤Î¹Ô¤Ï¥³¥á¥ó¥È¤Ç¤¹¡£";
-#else
-                       str1 = "This line is a comment.";
-#endif
+                       str1 = _("この行はコメントです。", "This line is a comment.");
                }
-               else if (tb->lines_list[tb->cy][1] == ':')
+               else if (tb->lines_list[tb->cy][0] && tb->lines_list[tb->cy][1] == ':')
                {
                        switch(tb->lines_list[tb->cy][0])
                        {
                        case '?':
-#ifdef JP
-                               str1 = "¤³¤Î¹Ô¤Ï¾ò·ïʬ´ô¼°¤Ç¤¹¡£";
-#else
-                               str1 = "This line is a Conditional Expression.";
-#endif
-
+                               str1 = _("この行は条件分岐式です。", "This line is a Conditional Expression.");
                                break;
                        case 'A':
-#ifdef JP
-                               str1 = "¤³¤Î¹Ô¤Ï¥Þ¥¯¥í¤Î¼Â¹ÔÆâÍƤòÄêµÁ¤·¤Þ¤¹¡£";
-#else
-                               str1 = "This line defines a Macro action.";
-#endif
+                               str1 = _("この行はマクロの実行内容を定義します。", "This line defines a Macro action.");
                                break;
                        case 'P':
-#ifdef JP
-                               str1 = "¤³¤Î¹Ô¤Ï¥Þ¥¯¥í¤Î¥È¥ê¥¬¡¼¡¦¥­¡¼¤òÄêµÁ¤·¤Þ¤¹¡£";
-#else
-                               str1 = "This line defines a Macro trigger key.";
-#endif
+                               str1 = _("この行はマクロのトリガー・キーを定義します。", "This line defines a Macro trigger key.");
                                break;
                        case 'C':
-#ifdef JP
-                               str1 = "¤³¤Î¹Ô¤Ï¥­¡¼ÇÛÃÖ¤òÄêµÁ¤·¤Þ¤¹¡£";
-#else
-                               str1 = "This line defines a Keymap.";
-#endif
+                               str1 = _("この行はキー配置を定義します。", "This line defines a Keymap.");
                                break;
                        }
 
@@ -4818,39 +4709,23 @@ static void draw_text_editor(text_body_type *tb)
                        case '?':
                                if (tb->states[tb->cy] & LSTAT_BYPASS)
                                {
-#ifdef JP
-                                       str2 = "¸½ºß¤Î¼°¤ÎÃͤϡֵ¶(=0)¡×¤Ç¤¹¡£";
-#else
-                                       str2 = "The expression is 'False'(=0) currently.";
-#endif
+                                       str2 = _("現在の式の値は「偽(=0)」です。", "The expression is 'False'(=0) currently.");
                                }
                                else
                                {
-#ifdef JP
-                                       str2 = "¸½ºß¤Î¼°¤ÎÃͤϡֿ¿(=1)¡×¤Ç¤¹¡£";
-#else
-                                       str2 = "The expression is 'True'(=1) currently.";
-#endif
+                                       str2 = _("現在の式の値は「真(=1)」です。", "The expression is 'True'(=1) currently.");
                                }
                                break;
 
                        default:
                                if (tb->states[tb->cy] & LSTAT_AUTOREGISTER)
                                {
-#ifdef JP
-                                       str2 = "¤³¤Î¹Ô¤Ï¸å¤Çºï½ü¤µ¤ì¤Þ¤¹¡£";
-#else
-                                       str2 = "This line will be delete later.";
-#endif
+                                       str2 = _("この行は後で削除されます。", "This line will be delete later.");
                                }
 
                                else if (tb->states[tb->cy] & LSTAT_BYPASS)
                                {
-#ifdef JP
-                                       str2 = "¤³¤Î¹Ô¤Ï¸½ºß¤Ï̵¸ú¤Ê¾õÂ֤Ǥ¹¡£";
-#else
-                                       str2 = "This line is bypassed currently.";
-#endif
+                                       str2 = _("この行は現在は無効な状態です。", "This line is bypassed currently.");
                                }
                                break;
                        }
@@ -4867,20 +4742,12 @@ static void draw_text_editor(text_body_type *tb)
 
                        if (tb->states[tb->cy] & LSTAT_AUTOREGISTER)
                        {
-#ifdef JP
-                               strcat(buf, "¤³¤Î¹Ô¤Ï¸å¤Çºï½ü¤µ¤ì¤Þ¤¹¡£");
-#else
-                               strcat(buf, "  This line will be delete later.");
-#endif
+                               strcat(buf, _("この行は後で削除されます。", "  This line will be delete later."));
                        }
 
                        if (tb->states[tb->cy] & LSTAT_BYPASS)
                        {
-#ifdef JP
-                               strcat(buf, "¤³¤Î¹Ô¤Ï¸½ºß¤Ï̵¸ú¤Ê¾õÂ֤Ǥ¹¡£");
-#else
-                               strcat(buf, "  This line is bypassed currently.");
-#endif
+                               strcat(buf, _("この行は現在は無効な状態です。", "  This line is bypassed currently."));
                        }
 
                        roff_to_buf(buf, 81, temp, sizeof(temp));
@@ -4982,7 +4849,7 @@ static bool insert_macro_line(text_body_type *tb)
        while (i)
        {
                /* Save the key */
-               buf[n++] = i;
+               buf[n++] = (char)i;
 
                /* Do not process macros */
                inkey_base = TRUE;
@@ -4997,7 +4864,6 @@ static bool insert_macro_line(text_body_type *tb)
        /* Terminate */
        buf[n] = '\0';
 
-       /* Flush */
        flush();
 
        /* Convert the trigger */
@@ -5043,7 +4909,7 @@ static bool insert_keymap_line(text_body_type *tb)
 {
        char tmp[1024];
        char buf[2];
-       int mode;
+       BIT_FLAGS mode;
        cptr act;
 
        /* Roguelike */
@@ -5058,14 +4924,12 @@ static bool insert_keymap_line(text_body_type *tb)
                mode = KEYMAP_MODE_ORIG;
        }
 
-       /* Flush */
        flush();
 
        /* Get a key */
        buf[0] = inkey();
        buf[1] = '\0';
 
-       /* Flush */
        flush();
 
        /* Convert the trigger */
@@ -5084,8 +4948,17 @@ static bool insert_keymap_line(text_body_type *tb)
        /* Look up the keymap */
        act = keymap_act[mode][(byte)(buf[0])];
 
-       /* Analyze the current action */
-       ascii_to_text(tmp, act);
+       if (act)
+       {
+               /* Analyze the current action */
+               ascii_to_text(tmp, act);
+       }
+       else
+       {
+               /* No keymap defined -- Use trigger key itself as a default */
+
+               /* Nothing to do (use tmp) */
+       }
 
        /* Insert blank action preference line */
        insert_return_code(tb);
@@ -5106,11 +4979,8 @@ static bool do_editor_command(text_body_type *tb, int com_id)
        case EC_QUIT:
                if (tb->changed)
                {
-#ifdef JP
-                       if (!get_check("Á´¤Æ¤ÎÊѹ¹¤òÇË´þ¤·¤Æ¤«¤é½ªÎ»¤·¤Þ¤¹¡£¤è¤í¤·¤¤¤Ç¤¹¤«¡© ")) break;
-#else
-                       if (!get_check("Discard all changes and quit. Are you sure? ")) break;
-#endif
+                       if (!get_check(_("全ての変更を破棄してから終了します。よろしいですか? ",
+                                                        "Discard all changes and quit. Are you sure? "))) break;
                }
                return QUIT_WITHOUT_SAVE;
 
@@ -5119,11 +4989,8 @@ static bool do_editor_command(text_body_type *tb, int com_id)
 
        case EC_REVERT:
                /* Revert to original */
-#ifdef JP
-               if (!get_check("Á´¤Æ¤ÎÊѹ¹¤òÇË´þ¤·¤Æ¸µ¤Î¾õÂÖ¤ËÌᤷ¤Þ¤¹¡£¤è¤í¤·¤¤¤Ç¤¹¤«¡© ")) break;
-#else
-               if (!get_check("Discard all changes and revert to original file. Are you sure? ")) break;
-#endif
+               if (!get_check(_("全ての変更を破棄して元の状態に戻します。よろしいですか? ",
+                                                "Discard all changes and revert to original file. Are you sure? "))) break;
 
                free_text_lines(tb->lines_list);
                tb->lines_list = read_pickpref_text_lines(&tb->filename_mode);
@@ -5137,11 +5004,7 @@ static bool do_editor_command(text_body_type *tb, int com_id)
 
        case EC_HELP:
                /* Peruse the main help file */
-#ifdef JP
-               (void)show_file(TRUE, "jeditor.txt", NULL, 0, 0);
-#else
-               (void)show_file(TRUE, "editor.txt", NULL, 0, 0);
-#endif
+               (void)show_file(TRUE, _("jeditor.txt", "editor.txt"), NULL, 0, 0);
                /* Redraw all */
                tb->dirty_flags |= DIRTY_SCREEN;
 
@@ -5172,7 +5035,9 @@ static bool do_editor_command(text_body_type *tb, int com_id)
                if (0 < tb->cx)
                {
                        int len;
+#ifdef JP
                        int i;
+#endif
 
                        tb->cx--;
                        len = strlen(tb->lines_list[tb->cy]);
@@ -5368,12 +5233,29 @@ static bool do_editor_command(text_body_type *tb, int com_id)
                /*
                 * Move cursor position to the end of the selection
                 *
-                * Pressing ^C ^V correctly results in duplication of
-                * the selection.
+                * Pressing ^C ^V correctly duplicates the selection.
                 */
                if (tb->my == tb->cy)
                {
                        tb->cx = MAX(tb->cx, tb->mx);
+
+                       /*
+                        * When whole line is selected, the end of
+                        * line code is also copyed.
+                        */
+                       if (!tb->lines_list[tb->cy][tb->cx])
+                       {
+                               /* Is this the last line? */
+                               if (!tb->lines_list[tb->cy + 1])
+                               {
+                                       /* Add one more empty line if possible */
+                                       if (!add_empty_line(tb)) break;
+                               }
+
+                               /* Go to the beginning of next line */
+                               tb->cy++;
+                               tb->cx = 0;
+                       }
                }
                else
                {
@@ -5852,11 +5734,7 @@ static bool do_editor_command(text_body_type *tb, int com_id)
                Term_erase(0, tb->cy - tb->upper + 1, tb->wid);
 
                /* Prompt */
-#ifdef JP
-               Term_putstr(0, tb->cy - tb->upper + 1, tb->wid - 1, TERM_YELLOW, "P:<¥È¥ê¥¬¡¼¥­¡¼>: ");
-#else
-               Term_putstr(0, tb->cy - tb->upper + 1, tb->wid - 1, TERM_YELLOW, "P:<Trigger key>: ");
-#endif
+               Term_putstr(0, tb->cy - tb->upper + 1, tb->wid - 1, TERM_YELLOW, _("P:<トリガーキー>: ", "P:<Trigger key>: "));
                if (insert_macro_line(tb))
                {
                        /* Prepare to input action */
@@ -5879,11 +5757,8 @@ static bool do_editor_command(text_body_type *tb, int com_id)
                Term_erase(0, tb->cy - tb->upper + 1, tb->wid);
 
                /* Prompt */
-#ifdef JP
-               Term_putstr(0, tb->cy - tb->upper + 1, tb->wid - 1, TERM_YELLOW, format("C:%d:<¥³¥Þ¥ó¥É¥­¡¼>: ", (rogue_like_commands ? KEYMAP_MODE_ROGUE : KEYMAP_MODE_ORIG)));
-#else
-               Term_putstr(0, tb->cy - tb->upper + 1, tb->wid - 1, TERM_YELLOW, format("C:%d:<Keypress>: ", (rogue_like_commands ? KEYMAP_MODE_ROGUE : KEYMAP_MODE_ORIG)));
-#endif
+               Term_putstr(0, tb->cy - tb->upper + 1, tb->wid - 1, TERM_YELLOW, 
+                                       format(_("C:%d:<コマンドキー>: ", "C:%d:<Keypress>: "), (rogue_like_commands ? KEYMAP_MODE_ROGUE : KEYMAP_MODE_ORIG)));
 
                if (insert_keymap_line(tb))
                {
@@ -6000,8 +5875,8 @@ static void insert_single_letter(text_body_type *tb, int key)
                next = inkey();
                if (j+2 < MAX_LINELEN)
                {
-                       buf[j++] = key;
-                       buf[j++] = next;
+                       buf[j++] = (char)key;
+                       buf[j++] = (char)next;
                        tb->cx += 2;
                }
                else
@@ -6011,7 +5886,7 @@ static void insert_single_letter(text_body_type *tb, int key)
 #endif
        {
                if (j+1 < MAX_LINELEN)
-                       buf[j++] = key;
+                       buf[j++] = (char)key;
                tb->cx++;
        }
 
@@ -6150,6 +6025,11 @@ void do_cmd_edit_autopick(void)
        tb->dirty_line = -1;
        tb->filename_mode = PT_DEFAULT;
 
+       if (turn < old_autosave_turn)
+       {
+               while (old_autosave_turn > turn) old_autosave_turn -= TURNS_PER_TICK * TOWN_DAWN;
+       }
+
        /* Autosave */
        if (turn > old_autosave_turn + 100L)
        {
@@ -6195,11 +6075,8 @@ void do_cmd_edit_autopick(void)
                draw_text_editor(tb);
 
                /* Display header line */
-#ifdef JP
-               prt("(^Q:½ªÎ» ^W:¥»¡¼¥Ö¤·¤Æ½ªÎ», ESC:¥á¥Ë¥å¡¼, ¤½¤Î¾:ÆþÎÏ)", 0, 0);
-#else  
-               prt("(^Q:Quit, ^W:Save&Quit, ESC:Menu, Other:Input text)", 0, 0);
-#endif
+               prt(_("(^Q:終了 ^W:セーブして終了, ESC:メニュー, その他:入力)", 
+                     "(^Q:Quit, ^W:Save&Quit, ESC:Menu, Other:Input text)"), 0, 0);
                if (!tb->mark)
                {
                        /* Display current position */
@@ -6265,7 +6142,7 @@ void do_cmd_edit_autopick(void)
                /* Other commands */
                else
                {
-                       com_id = get_com_id(key);
+                       com_id = get_com_id((char)key);
                }
 
                if (com_id) quit = do_editor_command(tb, com_id);
@@ -6282,6 +6159,7 @@ void do_cmd_edit_autopick(void)
 
        free_text_lines(tb->lines_list);
 
+       string_free(tb->search_str);
        string_free(tb->last_destroyed);
 
        /* Destroy string chain */
@@ -6291,7 +6169,7 @@ void do_cmd_edit_autopick(void)
        process_autopick_file(buf);
 
        /* HACK -- reset start_time so that playtime is not increase while edit */
-       start_time = time(NULL);
+       start_time = (u32b)time(NULL);
 
        /* Save cursor location */
        cx_save = tb->cx;