diff --git a/cheevos/cheevos.c b/cheevos/cheevos.c index d927fe3adce..48798a7f72e 100644 --- a/cheevos/cheevos.c +++ b/cheevos/cheevos.c @@ -300,7 +300,6 @@ static void rcheevos_activate_achievements(void) { char buffer[256]; buffer[0] = '\0'; - /* TODO/FIXME - localize */ snprintf(buffer, sizeof(buffer), "Could not activate achievement %u \"%s\": %s", achievement->id, achievement->title, rc_error_str(result)); @@ -1157,17 +1156,18 @@ int rcheevos_get_richpresence(char *s, size_t len) if (ret <= 0 && rcheevos_locals.game.title) { - /* TODO/FIXME - localize */ - size_t _len = strlcpy(s, "Playing ", len); - strlcpy(s + _len, rcheevos_locals.game.title, len - _len); + int _len = snprintf(s, len, msg_hash_to_str(MSG_CHEEVOS_RICH_PRESENCE_PLAYING), + rcheevos_locals.game.title); + + if (_len < 0) + return -1; } return ret; } if (rcheevos_locals.game.title) { - /* TODO/FIXME - localize */ - size_t _len = strlcpy(s, "Spectating ", len); - return (int)strlcpy(s + _len, rcheevos_locals.game.title, len - _len); + return snprintf(s, len, msg_hash_to_str(MSG_CHEEVOS_RICH_PRESENCE_SPECTATING), + rcheevos_locals.game.title); } return 0; } @@ -1466,7 +1466,6 @@ static void rcheevos_activate_leaderboards(void) { char buffer[256]; buffer[0] = '\0'; - /* TODO/FIXME - localize */ snprintf(buffer, sizeof(buffer), "Could not activate leaderboard %u \"%s\": %s", leaderboard->id, leaderboard->title, rc_error_str(result)); @@ -1840,10 +1839,9 @@ void rcheevos_validate_config_settings(void) { char buffer[256]; buffer[0] = '\0'; - /* TODO/FIXME - localize */ snprintf(buffer, sizeof(buffer), - "Hardcore paused. You cannot earn hardcore achievements for %s using %s", - rc_console_name(console_id), sysinfo->library_name); + msg_hash_to_str(MSG_CHEEVOS_HARDCORE_PAUSED_INVALID_CORE), + rc_console_name(rcheevos_locals.game.console_id), sysinfo->library_name); CHEEVOS_LOG(RCHEEVOS_TAG "%s\n", buffer); rcheevos_pause_hardcore(); @@ -2701,31 +2699,44 @@ static void rcheevos_show_game_placard(void) number_of_active++; } - /* TODO/FIXME - localize strings */ if (number_of_core == 0) - strlcpy(msg, "This game has no achievements.", sizeof(msg)); + strlcpy(msg, msg_hash_to_str(MSG_CHEEVOS_GAME_HAS_NO_ACHIEVEMENTS), sizeof(msg)); else if (!number_of_unsupported) { if (settings->bools.cheevos_start_active) snprintf(msg, sizeof(msg), - "All %d achievements activated for this session.", + msg_hash_to_str(MSG_CHEEVOS_ALL_ACHIEVEMENTS_ACTIVATED), number_of_core); else snprintf(msg, sizeof(msg), - "You have %d of %d achievements unlocked.", + msg_hash_to_str(MSG_CHEEVOS_NUMBER_ACHIEVEMENTS_UNLOCKED), number_of_core - number_of_active, number_of_core); } else { + char number_of_unsupported_msg[64]; + int _len; + + snprintf(number_of_unsupported_msg, + sizeof(number_of_unsupported_msg), + msg_hash_to_str(MSG_CHEEVOS_UNSUPPORTED_COUNT), + number_of_unsupported); + if (settings->bools.cheevos_start_active) - snprintf(msg, sizeof(msg), - "All %d achievements activated for this session (%d unsupported).", - number_of_core, number_of_unsupported); + _len = snprintf(msg, sizeof(msg), + msg_hash_to_str(MSG_CHEEVOS_ALL_ACHIEVEMENTS_ACTIVATED), + number_of_core); else - snprintf(msg, sizeof(msg), - "You have %d of %d achievements unlocked (%d unsupported).", - number_of_core - number_of_active - number_of_unsupported, - number_of_core, number_of_unsupported); + _len = snprintf(msg, sizeof(msg), + msg_hash_to_str(MSG_CHEEVOS_NUMBER_ACHIEVEMENTS_UNLOCKED), + number_of_core - number_of_active - number_of_unsupported, + number_of_core); + + _len += snprintf(msg + _len, sizeof(msg) - _len, + " (%s)", number_of_unsupported_msg); + + if (_len < 0) + return; } msg[sizeof(msg) - 1] = 0; @@ -3123,9 +3134,8 @@ static void rcheevos_login_callback(void* userdata) { char msg[256]; msg[0] = '\0'; - /* TODO/FIXME - localize */ snprintf(msg, sizeof(msg), - "RetroAchievements: Logged in as \"%s\".", + msg_hash_to_str(MSG_CHEEVOS_LOGGED_IN_AS_USER), rcheevos_locals.displayname); runloop_msg_queue_push(msg, 0, 2 * 60, false, NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); diff --git a/intl/msg_hash_us.h b/intl/msg_hash_us.h index b1e91bbd223..1596fc58d7f 100644 --- a/intl/msg_hash_us.h +++ b/intl/msg_hash_us.h @@ -14309,6 +14309,38 @@ MSG_HASH( MSG_CHEEVOS_HARDCORE_MODE_ENABLE, "Achievements Hardcore Mode Enabled, save state & rewind were disabled." ) +MSG_HASH( + MSG_CHEEVOS_HARDCORE_PAUSED_INVALID_CORE, + "Hardcore paused. You cannot earn hardcore achievements for %s using %s" + ) +MSG_HASH( + MSG_CHEEVOS_LOGGED_IN_AS_USER, + "RetroAchievements: Logged in as \"%s\"." + ) +MSG_HASH( + MSG_CHEEVOS_GAME_HAS_NO_ACHIEVEMENTS, + "This game has no achievements." + ) +MSG_HASH( + MSG_CHEEVOS_ALL_ACHIEVEMENTS_ACTIVATED, + "All %d achievements activated for this session" +) +MSG_HASH( + MSG_CHEEVOS_NUMBER_ACHIEVEMENTS_UNLOCKED, + "You have %d of %d achievements unlocked" +) +MSG_HASH( + MSG_CHEEVOS_UNSUPPORTED_COUNT, + "%d unsupported" +) +MSG_HASH( + MSG_CHEEVOS_RICH_PRESENCE_PLAYING, + "Playing %s" +) +MSG_HASH( + MSG_CHEEVOS_RICH_PRESENCE_SPECTATING, + "Spectating %s" +) MSG_HASH( MSG_COMPARING_WITH_KNOWN_MAGIC_NUMBERS, "Comparing with known magic numbers..." diff --git a/msg_hash.h b/msg_hash.h index 6cf193e897e..dc9661a40e8 100644 --- a/msg_hash.h +++ b/msg_hash.h @@ -479,6 +479,14 @@ enum msg_hash_enums MSG_REWIND_REACHED_END, MSG_FAILED_TO_START_MOVIE_RECORD, MSG_CHEEVOS_HARDCORE_MODE_ENABLE, + MSG_CHEEVOS_HARDCORE_PAUSED_INVALID_CORE, + MSG_CHEEVOS_LOGGED_IN_AS_USER, + MSG_CHEEVOS_GAME_HAS_NO_ACHIEVEMENTS, + MSG_CHEEVOS_ALL_ACHIEVEMENTS_ACTIVATED, + MSG_CHEEVOS_NUMBER_ACHIEVEMENTS_UNLOCKED, + MSG_CHEEVOS_UNSUPPORTED_COUNT, + MSG_CHEEVOS_RICH_PRESENCE_PLAYING, + MSG_CHEEVOS_RICH_PRESENCE_SPECTATING, MSG_STATE_SLOT, MSG_REPLAY_SLOT, MSG_STARTING_MOVIE_RECORD_TO,