-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding localization support to cheevos.c #15739
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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)); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same comment about |
||
|
@@ -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); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The enum for this should be more specific. Maybe There are several other reasons hardcore could be disabled in |
||
) | ||
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" | ||
) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's probably better to include the placeholder ("Playing %s") and change the string building to use |
||
MSG_HASH( | ||
MSG_CHEEVOS_RICH_PRESENCE_SPECTATING, | ||
"Spectating %s" | ||
) | ||
MSG_HASH( | ||
MSG_COMPARING_WITH_KNOWN_MAGIC_NUMBERS, | ||
"Comparing with known magic numbers..." | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure it's reasonable to localize this as
rc_error_str
will still return an English error message.