OSDN Git Service

[Refactor] #37353 USE_DEBUG のプリプロが有効であることを前提とし、プリプロ自体は削除 / Removed USE_DEBUG but...
[hengband/hengband.git] / src / main-mac.c
index 6d1870a..d19c59a 100644 (file)
@@ -1,4 +1,4 @@
-/* File: main-mac.c */
+/* File: main-mac.c */
 
 /* Purpose: Simple support for MACINTOSH Angband */
 
 /*
  * Cleaning up a couple of things to make these easier to change --AR
  */
-#ifdef JP
-#define PREF_FILE_NAME "Hengband Preferences"
-#else
-#define PREF_FILE_NAME "Hengband-E Preferences"
-#endif
+#define PREF_FILE_NAME _("Hengband Preferences", "Hengband-E Preferences")
 
 /*
  * Use "malloc()" instead of "NewPtr()"
@@ -714,7 +710,7 @@ void convert_pathname(char* path)
  * Although there is no easy way to emulate fstat in the old interface,
  * we still can do stat-like things, because Mac OS is an OS.
  */
-static int get_modification_time(cptr path, u32b *mod_time)
+static int get_modification_time(concptr path, u32b *mod_time)
 {
        CInfoPBRec pb;
        Str255 pathname;
@@ -749,7 +745,7 @@ static int get_modification_time(cptr path, u32b *mod_time)
  * A (non-Mach-O) Mac OS version of check_modification_time, for those
  * compilers without good enough POSIX-compatibility libraries XXX XXX
  */
-errr check_modification_date(int fd, cptr template_file)
+errr check_modification_date(int fd, concptr template_file)
 {
 #pragma unused(fd)
        u32b txt_stat, raw_stat;
@@ -867,7 +863,7 @@ static OSErr spec_to_path(const FSSpec *spec, char *buf, size_t size)
  * Set creator and filetype of a file specified by POSIX-style pathname.
  * Returns 0 on success, -1 in case of errors.
  */
-void fsetfileinfo(cptr pathname, OSType fcreator, OSType ftype)
+void fsetfileinfo(concptr pathname, OSType fcreator, OSType ftype)
 {
        OSErr err;
        FSSpec spec;
@@ -1001,7 +997,7 @@ static void activate(WindowPtr w)
 /*
  * Display a warning message
  */
-static void mac_warning(cptr warning)
+static void mac_warning(concptr warning)
 {
        Str255 text;
        int len, i;
@@ -1992,11 +1988,7 @@ static void play_sound(int num, SInt16 vol)
                                }
 
                                /* Notify error */
-#ifdef JP
-                               plog("¥µ¥¦¥ó¥É¥Á¥ã¥ó¥Í¥ë¤ò½é´ü²½½ÐÍè¤Þ¤»¤ó!");
-#else
-                               plog("Cannot initialise sound channels!");
-#endif
+                               plog(_("サウンドチャンネルを初期化出来ません!", "Cannot initialise sound channels!"));
 
                                /* Cancel request */
                                use_sound = arg_sound = FALSE;
@@ -2499,11 +2491,7 @@ static errr Term_xtra_mac_react(void)
 
                if ((graf_mode_req != GRAF_MODE_NONE) && !frameP && (globe_init() != 0))
                {
-#ifdef JP
-                       plog("¥°¥é¥Õ¥£¥Ã¥¯¤Î½é´ü²½¤Ï½ÐÍè¤Þ¤»¤ó¤Ç¤·¤¿.");
-#else
-                       plog("Cannot initialize graphics!");
-#endif
+                       plog(_("グラフィックの初期化は出来ませんでした.", "Cannot initialize graphics!"));
 
                        /* reject request */
                        graf_mode_req = GRAF_MODE_NONE;
@@ -3185,11 +3173,7 @@ static void SetupAppDir(void)
        err = PBGetFCBInfo(&fcbBlock, FALSE);
        if (err != noErr)
        {
-#ifdef JP
-               sprintf(errString, "PBGetFCBInfo ¥¨¥é¡¼ #%d.\r ½ªÎ»¤·¤Þ¤¹.", err);
-#else
-               sprintf(errString, "Fatal PBGetFCBInfo Error #%d.\r Exiting.", err);
-#endif
+               sprintf(errString, _("PBGetFCBInfo エラー #%d.\r 終了します.", "Fatal PBGetFCBInfo Error #%d.\r Exiting."), err);
                mac_warning(errString);
                ExitToShell();
        }
@@ -3202,11 +3186,7 @@ static void SetupAppDir(void)
        err = HSetVol(NULL, app_vol, app_dir);
        if (err != noErr)
        {
-#ifdef JP
-               sprintf(errString, "HSetVol ¥¨¥é¡¼ #%d.\r ½ªÎ»¤·¤Þ¤¹.", err);
-#else
-               sprintf(errString, "Fatal HSetVol Error #%d.\r Exiting.", err);
-#endif
+               sprintf(errString, _("HSetVol エラー #%d.\r 終了します.", "Fatal HSetVol Error #%d.\r Exiting."), err);
                mac_warning(errString);
                ExitToShell();
        }
@@ -3396,11 +3376,7 @@ static void cf_load_prefs()
        if (!ok)
        {
                /* This may be the first run */
-#ifdef JP
-               mac_warning("½é´üÀßÄê¥Õ¥¡¥¤¥ë¤¬¸«¤Ä¤«¤ê¤Þ¤»¤ó¡£");
-#else
-               mac_warning("Preferences are not found.");
-#endif
+               mac_warning(_("初期設定ファイルが見つかりません。", "Preferences are not found."));
 
                /* Ignore the rest */
                return;
@@ -3562,7 +3538,7 @@ static void load_prefs(void)
        {
                /* Message */
                #ifdef JP
-               mac_warning("¸Å¤¤½é´üÀßÄê¥Õ¥¡¥¤¥ë¤ò̵»ë¤·¤Þ¤¹.");
+               mac_warning("古い初期設定ファイルを無視します.");
                #else
                mac_warning("Ignoring old preferences.");
                #endif
@@ -3618,15 +3594,15 @@ static void term_data_hack(term_data *td)
 #if TARGET_API_MAC_CARBON
 #ifdef JP
        /* Default to Osaka font (Japanese) */
-       fid = FMGetFontFamilyFromName( "\pOsaka¡ÝÅùÉý" );
+       fid = FMGetFontFamilyFromName( "\pOsaka−等幅" );
 #else
        /* Default to Monaco font */
        fid = FMGetFontFamilyFromName("\pmonaco");
 #endif
 #else
 #ifdef JP
-       /* Default to ÅùÉýÌÀÄ« font (Japanese) */
-       GetFNum( "\pÅùÉýÌÀÄ«", &fid);
+       /* Default to 等幅明朝 font (Japanese) */
+       GetFNum( "\p等幅明朝", &fid);
        SetFScaleDisable( true );
 #else
        /* Default to Monaco font */
@@ -3701,7 +3677,7 @@ static void init_windows(void)
        {
                int n;
 
-               cptr s;
+               concptr s;
 
                /* Obtain */
                td = &data[i];
@@ -4655,11 +4631,7 @@ static void init_menubar(void)
        mbar = GetNewMBar(128);
 
        /* Whoops! */
-#ifdef JP
-       if (mbar == nil) quit("¥á¥Ë¥å¡¼¥Ð¡¼ ID 128¤ò¸«¤Ä¤±¤ë»ö¤¬¤Ç¤­¤Þ¤»¤ó!");
-#else
-       if (mbar == nil) quit("Cannot find menubar('MBAR') id 128!");
-#endif
+       if (mbar == nil) quit(_("メニューバー ID 128を見つける事ができません!", "Cannot find menubar('MBAR') id 128!"));
 
        /* Insert them into the current menu list */
        SetMenuBar(mbar);
@@ -4677,7 +4649,7 @@ static void init_menubar(void)
 
        /* Get the "File" menu */
 #if TARGET_API_MAC_CARBON
-       m = GetMenu(MENU_FILE);
+       m = GetMenuHandle(MENU_FILE);
        err = Gestalt( gestaltSystemVersion, &response );
        if ( (err == noErr) && (response >= 0x00000A00) )
        {
@@ -5763,11 +5735,7 @@ static void menu(long mc)
                                case ITEM_SAVE:
                                {
                                        if (!can_save){
-#ifdef JP
-                                               plog("º£¤Ï¥»¡¼¥Ö¤¹¤ë¤³¤È¤Ï½ÐÍè¤Þ¤»¤ó¡£");
-#else
-                                               plog("You may not do that right now.");
-#endif
+                                               plog(_("今はセーブすることは出来ません。", "You may not do that right now."));
                                                break;
                                        }
                                        
@@ -5787,11 +5755,7 @@ static void menu(long mc)
                                        if (game_in_progress && character_generated)
                                        {
                                                if (!can_save){
-#ifdef JP
-                                                       plog("º£¤Ï¥»¡¼¥Ö¤¹¤ë¤³¤È¤Ï½ÐÍè¤Þ¤»¤ó¡£");
-#else
-                                                       plog("You may not do that right now.");
-#endif
+                                                       plog(_("今はセーブすることは出来ません。", "You may not do that right now."));
                                                        break;
                                                }
                                                /* Hack -- Forget messages */
@@ -6215,11 +6179,7 @@ static pascal OSErr AEH_Quit(const AppleEvent *theAppleEvent,
        if (game_in_progress && character_generated)
        {
                        if (!can_save){
-#ifdef JP
-                               plog("º£¤Ï¥»¡¼¥Ö¤¹¤ë¤³¤È¤Ï½ÐÍè¤Þ¤»¤ó¡£");
-#else
-                               plog("You may not do that right now.");
-#endif
+                               plog(_("今はセーブすることは出来ません。", "You may not do that right now."));
                                return;
                        }
                        /* Hack -- Forget messages */
@@ -6793,7 +6753,7 @@ static bool CheckEvents(bool wait)
                        if (AEProcessAppleEvent(&event) != noErr)
                        {
                                #ifdef JP
-                               plog("Apple Event Handler¤Î¥¨¥é¡¼¤Ç¤¹.");
+                               plog("Apple Event Handlerのエラーです.");
                                #else
                                plog("Error in Apple Event Handler!");
                                #endif
@@ -6905,7 +6865,7 @@ static vptr hook_rpanic(huge size)
 
                /* Mega-Hack -- Warning */
                #ifdef JP
-               mac_warning("¥á¥â¥ê¡¼¤¬Â­¤ê¤Þ¤»¤ó!\rº£¤¹¤°½ªÎ»¤·¤Æ²¼¤µ¤¤!");
+               mac_warning("メモリーが足りません!\r今すぐ終了して下さい!");
                #else
                mac_warning("Running out of Memory!\rAbort this process now!");
                #endif
@@ -6922,7 +6882,7 @@ static vptr hook_rpanic(huge size)
 /*
  * Hook to tell the user something important
  */
-static void hook_plog(cptr str)
+static void hook_plog(concptr str)
 {
        /* Warning message */
        mac_warning(str);
@@ -6931,7 +6891,7 @@ static void hook_plog(cptr str)
 /*
  * Hook to tell the user something, and then quit
  */
-static void hook_quit(cptr str)
+static void hook_quit(concptr str)
 {
        /* Warning if needed */
        if (str) mac_warning(str);
@@ -6953,7 +6913,7 @@ static void hook_quit(cptr str)
 /*
  * Hook to tell the user something, and then crash
  */
-static void hook_core(cptr str)
+static void hook_core(concptr str)
 {
        /* XXX Use the debugger */
        /* DebugStr(str); */
@@ -6963,14 +6923,14 @@ static void hook_core(cptr str)
 
        /* Warn, then save player */
        #ifdef JP
-       mac_warning("Ã×̿Ū¤Ê¥¨¥é¡¼¤Ç¤¹.\r¶¯À©Åª¤Ë¥»¡¼¥Ö¤·¤Æ½ªÎ»¤·¤Þ¤¹.");
+       mac_warning("致命的なエラーです.\r強制的にセーブして終了します.");
        #else
        mac_warning("Fatal error.\rI will now attempt to save and quit.");
        #endif
 
        /* Attempt to save */
        #ifdef JP
-       if (!save_player()) mac_warning("·Ù¹ð -- ¥»¡¼¥Ö¤Ë¼ºÇÔ¤·¤Þ¤·¤¿!");
+       if (!save_player()) mac_warning("警告 -- セーブに失敗しました!");
        #else
        if (!save_player()) mac_warning("Warning -- save failed!");
        #endif
@@ -7059,35 +7019,19 @@ static void init_stuff(void)
                init_file_paths(path);
 
                /* Build the filename */
-#ifdef JP
-               path_build(path, sizeof(path), ANGBAND_DIR_FILE, "news_j.txt");
-#else
-               path_build(path, sizeof(path), ANGBAND_DIR_FILE, "news.txt");
-#endif
+               path_build(path, sizeof(path), ANGBAND_DIR_FILE, _("news_j.txt", "news.txt"));
 
                /* Attempt to open and close that file */
                if (0 == fd_close(fd_open(path, O_RDONLY))) break;
 
                /* Warning */
-#ifdef JP
-               plog_fmt("'%s' ¥Õ¥¡¥¤¥ë¤ò¥ª¡¼¥×¥ó½ÐÍè¤Þ¤»¤ó.", path);
-#else
-               plog_fmt("Unable to open the '%s' file.", path);
-#endif
+               plog_fmt(_("'%s' ファイルをオープン出来ません.", "Unable to open the '%s' file."), path);
 
                /* Warning */
-#ifdef JP
-               plog("Hengband¤Î'lib'¥Õ¥©¥ë¥À¤¬Â¸ºß¤·¤Ê¤¤¤«Àµ¤·¤¯Ìµ¤¤²ÄǽÀ­¤¬¤¢¤ê¤Þ¤¹.");
-#else
-               plog("The Angband 'lib' folder is probably missing or misplaced.");
-#endif
+               plog(_("Hengbandの'lib'フォルダが存在しないか正しく無い可能性があります.", "The Angband 'lib' folder is probably missing or misplaced."));
 
                /* Warning */
-#ifdef JP
-               plog("Please 'open' any file in any sub-folder of the 'lib' folder.");
-#else
-               plog("Please 'open' any file in any sub-folder of the 'lib' folder.");
-#endif
+               plog(_("Please 'open' any file in any sub-folder of the 'lib' folder.", "Please 'open' any file in any sub-folder of the 'lib' folder."));
                
 #if TARGET_API_MAC_CARBON
                /* Ask the user to choose the lib folder */
@@ -7276,7 +7220,7 @@ int main(void)
                if ((err != noErr) || (versionNumber < 0x0700))
                {
                        #ifdef JP
-                       quit("¤³¤Î¥×¥í¥°¥é¥à¤Ï´Á»úTalk7.x.x°Ê¹ß¤ÇÆ°ºî¤·¤Þ¤¹.");
+                       quit("このプログラムは漢字Talk7.x.x以降で動作します.");
                        #else
                        quit("You must have System 7 to use this program.");
                        #endif
@@ -7292,7 +7236,7 @@ int main(void)
                if (SysEnvirons(1, &env) != noErr)
                {
                        #ifdef JP
-                       quit("SysEnvirons ¥³¡¼¥ë¤Ï¼ºÇÔ¤·¤Þ¤·¤¿¡ª");
+                       quit("SysEnvirons コールは失敗しました!");
                        #else
                        quit("The SysEnvirons call failed!");
                        #endif
@@ -7302,7 +7246,7 @@ int main(void)
                if (env.systemVersion < 0x0700)
                {
                        #ifdef JP
-                       quit("¤³¤Î¥×¥í¥°¥é¥à¤Ï´Á»úTalk7.x.x°Ê¹ß¤ÇÆ°ºî¤·¤Þ¤¹.");
+                       quit("このプログラムは漢字Talk7.x.x以降で動作します.");
                        #else
                        quit("You must have System 7 to use this program.");
                        #endif
@@ -7312,7 +7256,7 @@ int main(void)
                if (!env.hasColorQD)
                {
                        #ifdef JP
-                       quit("¤³¤Î¥×¥í¥°¥é¥à¤ÏColor Quickdraw¤¬Ìµ¤¤¤ÈÆ°ºî¤·¤Þ¤»¤ó.");
+                       quit("このプログラムはColor Quickdrawが無いと動作しません.");
                        #else
                        quit("You must have Color Quickdraw to use this program.");
                        #endif
@@ -7464,11 +7408,7 @@ int main(void)
 #endif
 
        /* Prompt the user */
-#ifdef JP
-       prt("'¥Õ¥¡¥¤¥ë'¥á¥Ë¥å¡¼¤è¤ê'¿·µ¬'¤Þ¤¿¤Ï'³«¤¯...'¤òÁªÂò¤·¤Æ¤¯¤À¤µ¤¤¡£", 23, 10);
-#else
-       prt("[Choose 'New' or 'Open' from the 'File' menu]", 23, 15);
-#endif
+       prt(_("'ファイル'メニューより'新規'または'開く...'を選択してください。", "[Choose 'New' or 'Open' from the 'File' menu]"), 23, _(10, 15));
 
        /* Flush the prompt */
        Term_fresh();