make prompt strings localizable

This commit is contained in:
Chris Danford
2005-12-21 09:56:16 +00:00
parent ff45bcce27
commit 28959facb3
13 changed files with 135 additions and 76 deletions
+15 -7
View File
@@ -176,22 +176,27 @@ RString Commify( int iNum )
return sReturn; return sReturn;
} }
static LocalizedString NUM_PREFIX ( "RageUtil", "NumPrefix" );
static LocalizedString NUM_ST ( "RageUtil", "NumSt" );
static LocalizedString NUM_ND ( "RageUtil", "NumNd" );
static LocalizedString NUM_RD ( "RageUtil", "NumRd" );
static LocalizedString NUM_TH ( "RageUtil", "NumTh" );
RString FormatNumberAndSuffix( int i ) RString FormatNumberAndSuffix( int i )
{ {
RString sSuffix; RString sSuffix;
switch( i%10 ) switch( i%10 )
{ {
case 1: sSuffix = "st"; break; case 1: sSuffix = NUM_ST; break;
case 2: sSuffix = "nd"; break; case 2: sSuffix = NUM_ND; break;
case 3: sSuffix = "rd"; break; case 3: sSuffix = NUM_RD; break;
default: sSuffix = "th"; break; default: sSuffix = NUM_TH; break;
} }
// "11th", "113th", etc. // "11th", "113th", etc.
if( ((i%100) / 10) == 1 ) if( ((i%100) / 10) == 1 )
sSuffix = "th"; sSuffix = NUM_TH;
return ssprintf("%i", i) + sSuffix; return NUM_PREFIX.GetValue() + ssprintf("%i", i) + sSuffix;
} }
struct tm GetLocalTime() struct tm GetLocalTime()
@@ -1939,6 +1944,7 @@ void RefreshLocalizedStrings()
LocalizedString::LocalizedString( const RString &sSection, const RString &sName ) LocalizedString::LocalizedString( const RString &sSection, const RString &sName )
{ {
m_bLoaded = false;
m_sSection = sSection; m_sSection = sSection;
m_sName = sName; m_sName = sName;
@@ -1959,13 +1965,15 @@ LocalizedString::operator RString() const
RString LocalizedString::GetValue() const RString LocalizedString::GetValue() const
{ {
ASSERT(!m_sValue.empty()); return m_sValue; ASSERT(m_bLoaded);
return m_sValue;
} }
void LocalizedString::Refresh() void LocalizedString::Refresh()
{ {
ASSERT( g_pfnLocalizer ); ASSERT( g_pfnLocalizer );
m_sValue = g_pfnLocalizer( m_sSection, m_sName ); m_sValue = g_pfnLocalizer( m_sSection, m_sName );
m_bLoaded = true;
} }
+1
View File
@@ -519,6 +519,7 @@ private:
RString m_sSection; RString m_sSection;
RString m_sName; RString m_sName;
RString m_sValue; RString m_sValue;
bool m_bLoaded;
}; };
#endif #endif
+2 -1
View File
@@ -2488,6 +2488,7 @@ static LocalizedString REVERT_LAST_SAVE ( "ScreenEdit", "Do you want to rever
static LocalizedString DESTROY_ALL_UNSAVED_CHANGES ( "ScreenEdit", "This will destroy all unsaved changes." ); static LocalizedString DESTROY_ALL_UNSAVED_CHANGES ( "ScreenEdit", "This will destroy all unsaved changes." );
static LocalizedString REVERT_FROM_DISK ( "ScreenEdit", "Do you want to revert from disk?" ); static LocalizedString REVERT_FROM_DISK ( "ScreenEdit", "Do you want to revert from disk?" );
static LocalizedString SAVE_CHANGES_BEFORE_EXITING ( "ScreenEdit", "Do you want to save changes before exiting?" ); static LocalizedString SAVE_CHANGES_BEFORE_EXITING ( "ScreenEdit", "Do you want to save changes before exiting?" );
static LocalizedString SAVED ( "ScreenEdit", "Saved '%s'" );
void ScreenEdit::HandleMainMenuChoice( MainMenuChoice c, const vector<int> &iAnswers ) void ScreenEdit::HandleMainMenuChoice( MainMenuChoice c, const vector<int> &iAnswers )
{ {
switch( c ) switch( c )
@@ -2573,7 +2574,7 @@ void ScreenEdit::HandleMainMenuChoice( MainMenuChoice c, const vector<int> &iAns
SCREENMAN->ZeroNextUpdate(); SCREENMAN->ZeroNextUpdate();
// TODO: make localizable // TODO: make localizable
CString s = ssprintf( "Saved \"%s\"", Basename(pSteps->GetFilename()).c_str() ); CString s = ssprintf( SAVED.GetValue(), Basename(pSteps->GetFilename()).c_str() );
ScreenPrompt::Prompt( SM_None, s ); ScreenPrompt::Prompt( SM_None, s );
/* FIXME /* FIXME
+8 -4
View File
@@ -142,19 +142,21 @@ static CString GetCopyDescription( const Steps *pSourceSteps )
return s; return s;
} }
static LocalizedString YOU_MUST_SUPPLY_NAME ( "ScreenEditMenu", "You must supply a name for your new edit." );
static LocalizedString EDIT_NAME_CONFLICTS ( "ScreenEditMenu", "The name you chose conflicts with another edit. Please use a different name." );
static bool ValidateCurrentStepsDescription( const CString &s, CString &sErrorOut ) static bool ValidateCurrentStepsDescription( const CString &s, CString &sErrorOut )
{ {
ASSERT( GAMESTATE->m_pCurSteps[0]->GetDifficulty() == DIFFICULTY_EDIT ); ASSERT( GAMESTATE->m_pCurSteps[0]->GetDifficulty() == DIFFICULTY_EDIT );
if( s.empty() ) if( s.empty() )
{ {
sErrorOut = "You must supply a name for your new edit."; sErrorOut = YOU_MUST_SUPPLY_NAME;
return false; return false;
} }
if( !GAMESTATE->m_pCurSong->IsEditDescriptionUnique(GAMESTATE->m_pCurSteps[0]->m_StepsType, s, GAMESTATE->m_pCurSteps[0]) ) if( !GAMESTATE->m_pCurSong->IsEditDescriptionUnique(GAMESTATE->m_pCurSteps[0]->m_StepsType, s, GAMESTATE->m_pCurSteps[0]) )
{ {
sErrorOut = "The supplied name supplied conflicts with another edit.\n\nPlease use a different name."; sErrorOut = EDIT_NAME_CONFLICTS;
return false; return false;
} }
@@ -172,7 +174,9 @@ static void DeleteCurrentSteps()
GAMESTATE->m_pCurSteps[0].Set( NULL ); GAMESTATE->m_pCurSteps[0].Set( NULL );
} }
static LocalizedString MISSING_MUSIC_FILE( "ScreenEditMenu", "This song is missing a music file and cannot be edited." ); static LocalizedString MISSING_MUSIC_FILE ( "ScreenEditMenu", "This song is missing a music file and cannot be edited." );
static LocalizedString STEPS_WILL_BE_LOST ( "ScreenEditMenu", "These steps will be lost permanently." );
static LocalizedString CONTINUE_WITH_DELETE ( "ScreenEditMenu", "Continue with delete?" );
void ScreenEditMenu::MenuStart( PlayerNumber pn ) void ScreenEditMenu::MenuStart( PlayerNumber pn )
{ {
if( IsTransitioning() ) if( IsTransitioning() )
@@ -218,7 +222,7 @@ void ScreenEditMenu::MenuStart( PlayerNumber pn )
break; break;
case EditMenuAction_Delete: case EditMenuAction_Delete:
ASSERT( pSteps ); ASSERT( pSteps );
ScreenPrompt::Prompt( SM_None, "These steps will be lost permanently.\n\nContinue with delete?", PROMPT_YES_NO, ANSWER_NO ); ScreenPrompt::Prompt( SM_None, STEPS_WILL_BE_LOST.GetValue() + "\n\n" + CONTINUE_WITH_DELETE.GetValue(), PROMPT_YES_NO, ANSWER_NO );
break; break;
case EditMenuAction_Create: case EditMenuAction_Create:
ASSERT( !pSteps ); ASSERT( !pSteps );
+4 -3
View File
@@ -447,11 +447,12 @@ void ScreenEz2SelectMusic::MenuLeft( const InputEventPlus &input )
MusicChanged(); MusicChanged();
} }
static LocalizedString DOES_NOT_HAVE_MUSIC_FILE( "ScreenEz2SelectMusic", "This song does not have a music file\n and cannot be played." );
void ScreenEz2SelectMusic::MenuStart( PlayerNumber pn ) void ScreenEz2SelectMusic::MenuStart( PlayerNumber pn )
{ {
if( !m_MusicBannerWheel.GetSelectedSong()->HasMusic() ) if( !m_MusicBannerWheel.GetSelectedSong()->HasMusic() )
{ {
ScreenPrompt::Prompt( SM_None, "ERROR:\n \nThis song does not have a music file\n and cannot be played." ); ScreenPrompt::Prompt( SM_None, DOES_NOT_HAVE_MUSIC_FILE );
return; return;
} }
@@ -481,7 +482,7 @@ void ScreenEz2SelectMusic::MenuStart( PlayerNumber pn )
m_sprOptionsMessage.SetZoomY( 0 ); m_sprOptionsMessage.SetZoomY( 0 );
} }
static LocalizedString NO_SONGS_AVAILABLE( "ScreenEz2SelectMusic", "There are no songs available for play." );
void ScreenEz2SelectMusic::Update( float fDeltaTime ) void ScreenEz2SelectMusic::Update( float fDeltaTime )
{ {
m_DifficultyRating.Update(fDeltaTime); m_DifficultyRating.Update(fDeltaTime);
@@ -497,7 +498,7 @@ void ScreenEz2SelectMusic::Update( float fDeltaTime )
if(m_MusicBannerWheel.CheckSongsExist() == 0 && ! i_ErrorDetected) if(m_MusicBannerWheel.CheckSongsExist() == 0 && ! i_ErrorDetected)
{ {
ScreenPrompt::Prompt( SM_NoSongs, "ERROR:\n \nThere are no songs available for play!" ); ScreenPrompt::Prompt( SM_NoSongs, NO_SONGS_AVAILABLE );
i_ErrorDetected=1; i_ErrorDetected=1;
this->PostScreenMessage( SM_NoSongs, 5.5f ); // timeout incase the user decides to do nothing :D this->PostScreenMessage( SM_NoSongs, 5.5f ); // timeout incase the user decides to do nothing :D
} }
+2 -1
View File
@@ -234,6 +234,7 @@ void ScreenJoinMultiplayer::MenuBack( PlayerNumber pn )
Cancel( SM_GoToPrevScreen ); Cancel( SM_GoToPrevScreen );
} }
static LocalizedString JOIN_2_OR_MORE_PLAYERS ("ScreenJoinMultiplayer", "You must join 2 or more players before continuing.");
void ScreenJoinMultiplayer::MenuStart( PlayerNumber pn ) void ScreenJoinMultiplayer::MenuStart( PlayerNumber pn )
{ {
int iNumJoinedPlayers = 0; int iNumJoinedPlayers = 0;
@@ -249,7 +250,7 @@ void ScreenJoinMultiplayer::MenuStart( PlayerNumber pn )
if( iNumJoinedPlayers < 2 ) if( iNumJoinedPlayers < 2 )
{ {
ScreenPrompt::Prompt( SM_None, "You must join 2 or more players before continuing." ); ScreenPrompt::Prompt( SM_None, JOIN_2_OR_MORE_PLAYERS );
return; return;
} }
+18 -12
View File
@@ -108,6 +108,21 @@ void ScreenOptionsEditCourse::BeginScreen()
AfterChangeRow( GAMESTATE->m_MasterPlayerNumber ); AfterChangeRow( GAMESTATE->m_MasterPlayerNumber );
} }
static LocalizedString MAXIMUM_COURSE_ENTRIES ("ScreenOptionsEditCourse", "The maximum number of entries per course is %d. This course already has %d entries.");
static bool AreEntriesFull()
{
Course *pCourse = GAMESTATE->m_pCurCourse;
if( pCourse->m_vEntries.size() >= size_t(MAX_ENTRIES_PER_COURSE) )
{
CString sError = ssprintf(MAXIMUM_COURSE_ENTRIES.GetValue(), MAX_ENTRIES_PER_COURSE, pCourse->m_vEntries.size() );
ScreenPrompt::Prompt( SM_None, sError );
return true;
}
return false;
}
static LocalizedString CANNOT_DELETE_LAST_ENTRY ("ScreenOptionsEditCourse", "You cannot delete the last entry in a course.");
void ScreenOptionsEditCourse::HandleScreenMessage( const ScreenMessage SM ) void ScreenOptionsEditCourse::HandleScreenMessage( const ScreenMessage SM )
{ {
Course *pCourse = GAMESTATE->m_pCurCourse; Course *pCourse = GAMESTATE->m_pCurCourse;
@@ -136,12 +151,8 @@ void ScreenOptionsEditCourse::HandleScreenMessage( const ScreenMessage SM )
break; break;
case CourseEntryAction_InsertEntry: case CourseEntryAction_InsertEntry:
{ {
if( pCourse->m_vEntries.size() >= size_t(MAX_ENTRIES_PER_COURSE) ) if( AreEntriesFull() )
{
CString sError = "The maximum number of entries per course is %d. This course already has %d entries.";
ScreenPrompt::Prompt( SM_None, sError );
return; return;
}
CourseEntry ce; CourseEntry ce;
CourseUtil::MakeDefaultEditCourseEntry( ce ); CourseUtil::MakeDefaultEditCourseEntry( ce );
pCourse->m_vEntries.insert( pCourse->m_vEntries.begin() + GetCourseEntryIndexWithFocus(), ce ); pCourse->m_vEntries.insert( pCourse->m_vEntries.begin() + GetCourseEntryIndexWithFocus(), ce );
@@ -152,8 +163,7 @@ void ScreenOptionsEditCourse::HandleScreenMessage( const ScreenMessage SM )
{ {
if( pCourse->m_vEntries.size() == 1 ) if( pCourse->m_vEntries.size() == 1 )
{ {
CString sError = "You cannot delete the last entry in a course."; ScreenPrompt::Prompt( SM_None, CANNOT_DELETE_LAST_ENTRY );
ScreenPrompt::Prompt( SM_None, sError );
return; return;
} }
pCourse->m_vEntries.erase( pCourse->m_vEntries.begin() + GetCourseEntryIndexWithFocus() ); pCourse->m_vEntries.erase( pCourse->m_vEntries.begin() + GetCourseEntryIndexWithFocus() );
@@ -249,12 +259,8 @@ void ScreenOptionsEditCourse::ProcessMenuStart( const InputEventPlus &input )
} }
else if( iCurRow == (int)m_pRows.size()-2 ) // "create entry" else if( iCurRow == (int)m_pRows.size()-2 ) // "create entry"
{ {
if( pCourse->m_vEntries.size() >= size_t(MAX_ENTRIES_PER_COURSE) ) if( AreEntriesFull() )
{
CString sError = "The maximum number of entries per course is %d. This course already has %d entries.";
ScreenPrompt::Prompt( SM_None, sError );
return; return;
}
CourseEntry ce; CourseEntry ce;
CourseUtil::MakeDefaultEditCourseEntry( ce ); CourseUtil::MakeDefaultEditCourseEntry( ce );
pCourse->m_vEntries.push_back( ce ); pCourse->m_vEntries.push_back( ce );
+10 -5
View File
@@ -106,6 +106,7 @@ static MenuDef g_TempMenu(
); );
static LocalizedString EDIT_NAME_CONFLICTS ( "ScreenOptionsManageCourses", "The name you chose conflicts with another edit. Please use a different name." );
static bool ValidateEditCourseName( const CString &sAnswer, CString &sErrorOut ) static bool ValidateEditCourseName( const CString &sAnswer, CString &sErrorOut )
{ {
if( sAnswer.empty() ) if( sAnswer.empty() )
@@ -120,7 +121,10 @@ static bool ValidateEditCourseName( const CString &sAnswer, CString &sErrorOut )
continue; // don't comepare name against ourself continue; // don't comepare name against ourself
if( (*c)->GetDisplayFullTitle() == sAnswer ) if( (*c)->GetDisplayFullTitle() == sAnswer )
{
sErrorOut = EDIT_NAME_CONFLICTS;
return false; return false;
}
} }
return true; return true;
@@ -230,6 +234,8 @@ void ScreenOptionsManageCourses::BeginScreen()
AfterChangeRow( PLAYER_1 ); AfterChangeRow( PLAYER_1 );
} }
static LocalizedString COURSE_WILL_BE_LOST("ScreenOptionsManageCourses", "This course will be lost permanently.");
static LocalizedString CONTINUE_WITH_DELETE("ScreenOptionsManageCourses", "Continue with delete?");
void ScreenOptionsManageCourses::HandleScreenMessage( const ScreenMessage SM ) void ScreenOptionsManageCourses::HandleScreenMessage( const ScreenMessage SM )
{ {
if( SM == SM_Success ) if( SM == SM_Success )
@@ -313,9 +319,7 @@ void ScreenOptionsManageCourses::HandleScreenMessage( const ScreenMessage SM )
} }
break; break;
case CourseAction_Delete: case CourseAction_Delete:
{ ScreenPrompt::Prompt( SM_None, COURSE_WILL_BE_LOST.GetValue()+"\n\n"+CONTINUE_WITH_DELETE.GetValue(), PROMPT_YES_NO, ANSWER_NO );
ScreenPrompt::Prompt( SM_None, "This course will be lost permanently.\n\nContinue with delete?", PROMPT_YES_NO, ANSWER_NO );
}
break; break;
} }
} }
@@ -343,6 +347,8 @@ void ScreenOptionsManageCourses::AfterChangeRow( PlayerNumber pn )
ScreenOptions::AfterChangeRow( pn ); ScreenOptions::AfterChangeRow( pn );
} }
static LocalizedString YOU_HAVE_MAXIMUM_EDITS_ALLOWED( "ScreenOptionsManageCourses", "You have %d course edits, the maximum number allowed." );
static LocalizedString YOU_MUST_DELETE( "ScreenOptionsManageCourses", "You must delete an existing course edit before creating a new course edit." );
void ScreenOptionsManageCourses::ProcessMenuStart( const InputEventPlus &input ) void ScreenOptionsManageCourses::ProcessMenuStart( const InputEventPlus &input )
{ {
int iCurRow = m_iCurrentRow[GAMESTATE->m_MasterPlayerNumber]; int iCurRow = m_iCurrentRow[GAMESTATE->m_MasterPlayerNumber];
@@ -352,8 +358,7 @@ void ScreenOptionsManageCourses::ProcessMenuStart( const InputEventPlus &input )
if( SONGMAN->GetNumEditCourses(ProfileSlot_Machine) >= MAX_EDIT_COURSES_PER_PROFILE ) if( SONGMAN->GetNumEditCourses(ProfileSlot_Machine) >= MAX_EDIT_COURSES_PER_PROFILE )
{ {
CString s = ssprintf( CString s = ssprintf(
"You have %d course edits, the maximum number allowed.\n\n" YOU_HAVE_MAXIMUM_EDITS_ALLOWED.GetValue() + "\n\n" + YOU_MUST_DELETE.GetValue(),
"You must delete an existing course edit before creating a new course edit.",
MAX_EDIT_COURSES_PER_PROFILE ); MAX_EDIT_COURSES_PER_PROFILE );
ScreenPrompt::Prompt( SM_None, s ); ScreenPrompt::Prompt( SM_None, s );
return; return;
@@ -129,6 +129,8 @@ void ScreenOptionsManageEditSteps::BeginScreen()
AfterChangeRow( PLAYER_1 ); AfterChangeRow( PLAYER_1 );
} }
static LocalizedString THESE_STEPS_WILL_BE_LOST ("ScreenOptionsManageEditSteps", "These steps will be lost permanently.");
static LocalizedString CONTINUE_WITH_DELETE ("ScreenOptionsManageEditSteps", "Continue with delete?");
void ScreenOptionsManageEditSteps::HandleScreenMessage( const ScreenMessage SM ) void ScreenOptionsManageEditSteps::HandleScreenMessage( const ScreenMessage SM )
{ {
if( SM == SM_GoToNextScreen ) if( SM == SM_GoToNextScreen )
@@ -206,7 +208,7 @@ void ScreenOptionsManageEditSteps::HandleScreenMessage( const ScreenMessage SM )
break; break;
case StepsEditAction_Delete: case StepsEditAction_Delete:
{ {
ScreenPrompt::Prompt( SM_BackFromDelete, "This Steps will be lost permanently.\n\nContinue with delete?", PROMPT_YES_NO, ANSWER_NO ); ScreenPrompt::Prompt( SM_BackFromDelete, THESE_STEPS_WILL_BE_LOST.GetValue()+"\n\n"+CONTINUE_WITH_DELETE.GetValue(), PROMPT_YES_NO, ANSWER_NO );
} }
break; break;
} }
@@ -235,6 +237,8 @@ void ScreenOptionsManageEditSteps::AfterChangeRow( PlayerNumber pn )
ScreenOptions::AfterChangeRow( pn ); ScreenOptions::AfterChangeRow( pn );
} }
static LocalizedString YOU_HAVE_MAX_STEP_EDITS( "ScreenOptionsManageEditSteps", "You have %d step edits, the maximum number allowed." );
static LocalizedString YOU_MUST_DELETE( "ScreenOptionsManageEditSteps", "You must delete an existing steps edit before creating a new steps edit." );
void ScreenOptionsManageEditSteps::ProcessMenuStart( const InputEventPlus &input ) void ScreenOptionsManageEditSteps::ProcessMenuStart( const InputEventPlus &input )
{ {
int iCurRow = m_iCurrentRow[GAMESTATE->m_MasterPlayerNumber]; int iCurRow = m_iCurrentRow[GAMESTATE->m_MasterPlayerNumber];
@@ -245,10 +249,7 @@ void ScreenOptionsManageEditSteps::ProcessMenuStart( const InputEventPlus &input
SONGMAN->GetStepsLoadedFromProfile( v, ProfileSlot_Machine ); SONGMAN->GetStepsLoadedFromProfile( v, ProfileSlot_Machine );
if( v.size() >= size_t(MAX_EDIT_STEPS_PER_PROFILE) ) if( v.size() >= size_t(MAX_EDIT_STEPS_PER_PROFILE) )
{ {
CString s = ssprintf( CString s = ssprintf( YOU_HAVE_MAX_STEP_EDITS.GetValue()+"\n\n"+YOU_MUST_DELETE.GetValue(), MAX_EDIT_STEPS_PER_PROFILE );
"You have %d Steps edits, the maximum number allowed.\n\n"
"You must delete an existing Steps edit before creating a new Steps edit.",
MAX_EDIT_STEPS_PER_PROFILE );
ScreenPrompt::Prompt( SM_None, s ); ScreenPrompt::Prompt( SM_None, s );
return; return;
} }
@@ -47,11 +47,13 @@ static MenuDef g_TempMenu(
"ScreenMiniMenuContext" "ScreenMiniMenuContext"
); );
static LocalizedString PROFILE_NAME_BLANK ( "ScreenEditMenu", "Profile name cannot be blank." );
static LocalizedString PROFILE_NAME_CONFLICTS ( "ScreenEditMenu", "The name you chose conflicts with another profile. Please use a different name." );
static bool ValidateLocalProfileName( const CString &sAnswer, CString &sErrorOut ) static bool ValidateLocalProfileName( const CString &sAnswer, CString &sErrorOut )
{ {
if( sAnswer == "" ) if( sAnswer == "" )
{ {
sErrorOut = "Profile name cannot be blank."; sErrorOut = PROFILE_NAME_BLANK;
return false; return false;
} }
@@ -64,7 +66,7 @@ static bool ValidateLocalProfileName( const CString &sAnswer, CString &sErrorOut
bool bAlreadyAProfileWithThisName = find( vsProfileNames.begin(), vsProfileNames.end(), sAnswer ) != vsProfileNames.end(); bool bAlreadyAProfileWithThisName = find( vsProfileNames.begin(), vsProfileNames.end(), sAnswer ) != vsProfileNames.end();
if( bAlreadyAProfileWithThisName ) if( bAlreadyAProfileWithThisName )
{ {
sErrorOut = "There is already another profile with this name. Please choose a different name."; sErrorOut = PROFILE_NAME_CONFLICTS;
return false; return false;
} }
@@ -165,6 +167,8 @@ void ScreenOptionsManageProfiles::BeginScreen()
AfterChangeRow( PLAYER_1 ); AfterChangeRow( PLAYER_1 );
} }
static LocalizedString CONFIRM_DELETE_PROFILE( "ScreenOptionsManageProfiles", "Are you sure you want to delete the profile '%s'?" );
static LocalizedString CONFIRM_CLEAR_PROFILE( "ScreenOptionsManageProfiles", "Are you sure you want to clear all data in the profile '%s'?" );
void ScreenOptionsManageProfiles::HandleScreenMessage( const ScreenMessage SM ) void ScreenOptionsManageProfiles::HandleScreenMessage( const ScreenMessage SM )
{ {
if( SM == SM_GoToNextScreen ) if( SM == SM_GoToNextScreen )
@@ -279,14 +283,14 @@ void ScreenOptionsManageProfiles::HandleScreenMessage( const ScreenMessage SM )
case ProfileAction_Delete: case ProfileAction_Delete:
{ {
CString sTitle = pProfile->m_sDisplayName; CString sTitle = pProfile->m_sDisplayName;
CString sMessage = ssprintf( "Are you sure you want to delete the profile '%s'?", sTitle.c_str() ); CString sMessage = ssprintf( CONFIRM_DELETE_PROFILE.GetValue(), sTitle.c_str() );
ScreenPrompt::Prompt( SM_BackFromDeleteConfirm, sMessage, PROMPT_YES_NO ); ScreenPrompt::Prompt( SM_BackFromDeleteConfirm, sMessage, PROMPT_YES_NO );
} }
break; break;
case ProfileAction_Clear: case ProfileAction_Clear:
{ {
CString sTitle = pProfile->m_sDisplayName; CString sTitle = pProfile->m_sDisplayName;
CString sMessage = ssprintf( "Are you sure you want to clear all data in the profile '%s'?", sTitle.c_str() ); CString sMessage = ssprintf( CONFIRM_CLEAR_PROFILE.GetValue(), sTitle.c_str() );
ScreenPrompt::Prompt( SM_BackFromClearConfirm, sMessage, PROMPT_YES_NO ); ScreenPrompt::Prompt( SM_BackFromClearConfirm, sMessage, PROMPT_YES_NO );
} }
break; break;
+2 -1
View File
@@ -118,6 +118,7 @@ void ScreenOptionsMemoryCard::ExportOptions( int iRow, const vector<PlayerNumber
} }
} }
static LocalizedString ERROR_MOUNTING_CARD ("ScreenOptionsMemoryCard", "Error mounting card: %s" );
void ScreenOptionsMemoryCard::ProcessMenuStart( const InputEventPlus &input ) void ScreenOptionsMemoryCard::ProcessMenuStart( const InputEventPlus &input )
{ {
int iCurRow = m_iCurrentRow[GAMESTATE->m_MasterPlayerNumber]; int iCurRow = m_iCurrentRow[GAMESTATE->m_MasterPlayerNumber];
@@ -135,7 +136,7 @@ void ScreenOptionsMemoryCard::ProcessMenuStart( const InputEventPlus &input )
} }
else else
{ {
CString s = ssprintf("error mounting card: %s", MEMCARDMAN->GetCardError(PLAYER_1).c_str() ); CString s = ssprintf(ERROR_MOUNTING_CARD.GetValue(), MEMCARDMAN->GetCardError(PLAYER_1).c_str() );
ScreenPrompt::Prompt( SM_None, s ); ScreenPrompt::Prompt( SM_None, s );
} }
} }
+21 -13
View File
@@ -5,6 +5,15 @@
#include "PrefsManager.h" #include "PrefsManager.h"
static LocalizedString EARLIER ("ScreenSaveSync","earlier");
static LocalizedString LATER ("ScreenSaveSync","later");
static LocalizedString CHANGED_GLOBAL_OFFSET ("ScreenSaveSync","You have changed the Global Offset from %+.3f to %+.3f (change of %+.3f, making the notes %s).");
static LocalizedString CHANGED_SONG_OFFSET ("ScreenSaveSync","You have changed the Song Offset from %+.3f to %+.3f (change of %+.3f, making the notes %s).");
static LocalizedString CHANGED_BPM ("ScreenSaveSync","The BPM segment number #%d changed from %+.3f BPS to %+.3f BPS (change of %+.3f).");
static LocalizedString CHANGED_STOP ("ScreenSaveSync","The stop segment #%d changed from %+.3f seconds to %+.3f seconds (change of %+.3f).");
static LocalizedString CHANGED_TIMING_OF ("ScreenSaveSync","You have changed the timing of");
static LocalizedString WOULD_YOU_LIKE_TO_SAVE ("ScreenSaveSync","Would you like to save these changes?");
static LocalizedString CHOOSING_NO_WILL_DISCARD ("ScreenSaveSync","Choosing NO will discard your changes.");
static CString GetPromptText() static CString GetPromptText()
{ {
CString s; CString s;
@@ -17,11 +26,11 @@ static CString GetPromptText()
if( fabs(fDelta) > 0.00001 ) if( fabs(fDelta) > 0.00001 )
{ {
s += ssprintf( s += ssprintf(
"You have changed the Global Offset\nfrom %+.3f to %+.3f (change of %+.3f, notes %s).\n\n", CHANGED_GLOBAL_OFFSET.GetValue()+"\n\n",
fOld, fOld,
fNew, fNew,
fDelta, fDelta,
fDelta > 0 ? "earlier":"later" ); (fDelta > 0 ? EARLIER:LATER).GetValue().c_str() );
} }
} }
@@ -35,11 +44,11 @@ static CString GetPromptText()
if( fabs(fDelta) > 0.00001 ) if( fabs(fDelta) > 0.00001 )
{ {
vsSongChanges.push_back( ssprintf( vsSongChanges.push_back( ssprintf(
"The song offset changed from %+.3f to %+.3f (change of %+.3f, notes %s).\n\n", CHANGED_SONG_OFFSET.GetValue()+"\n\n",
fOld, fOld,
fNew, fNew,
fDelta, fDelta,
fDelta > 0 ? "earlier":"later" ) ); (fDelta > 0 ? EARLIER:LATER).GetValue().c_str() ) );
} }
} }
@@ -52,8 +61,8 @@ static CString GetPromptText()
if( fabs(fDelta) > 0.00001 ) if( fabs(fDelta) > 0.00001 )
{ {
vsSongChanges.push_back( ssprintf( vsSongChanges.push_back( ssprintf(
"The %s BPM segment changed from %+.3f BPS to %+.3f BPS (change of %+.3f).\n\n", CHANGED_BPM.GetValue()+"\n\n",
FormatNumberAndSuffix(i+1).c_str(), i+1,
fOld, fOld,
fNew, fNew,
fDelta ) ); fDelta ) );
@@ -69,8 +78,8 @@ static CString GetPromptText()
if( fabs(fDelta) > 0.00001 ) if( fabs(fDelta) > 0.00001 )
{ {
vsSongChanges.push_back( ssprintf( vsSongChanges.push_back( ssprintf(
"The %s Stop segment changed from %+.3f seconds to %+.3f seconds (change of %+.3f).\n\n", CHANGED_STOP.GetValue()+"\n\n",
FormatNumberAndSuffix(i+1).c_str(), i+1,
fOld, fOld,
fNew, fNew,
fDelta ) ); fDelta ) );
@@ -81,7 +90,7 @@ static CString GetPromptText()
if( !vsSongChanges.empty() ) if( !vsSongChanges.empty() )
{ {
s += ssprintf( s += ssprintf(
"You have changed the timing of\n" CHANGED_TIMING_OF.GetValue()+"\n"
"%s:\n" "%s:\n"
"\n", "\n",
GAMESTATE->m_pCurSong->GetDisplayFullTitle().c_str() ); GAMESTATE->m_pCurSong->GetDisplayFullTitle().c_str() );
@@ -89,10 +98,9 @@ static CString GetPromptText()
s += join( "\n", vsSongChanges ); s += join( "\n", vsSongChanges );
} }
s +="\n\n" s +="\n\n"+
"Would you like to save these changes?\n" WOULD_YOU_LIKE_TO_SAVE.GetValue()+"\n"+
"Choosing NO will discard your changes."; CHOOSING_NO_WILL_DISCARD.GetValue();
return s; return s;
} }
+38 -20
View File
@@ -13,14 +13,15 @@
#include "GameState.h" #include "GameState.h"
#include "PlayerState.h" #include "PlayerState.h"
static LocalizedString BOOKKEEPING_DATA_CLEARED( "ScreenServiceAction", "Bookkeeping data cleared." );
static CString ClearBookkeepingData() static CString ClearBookkeepingData()
{ {
BOOKKEEPER->ClearAll(); BOOKKEEPER->ClearAll();
BOOKKEEPER->WriteToDisk(); BOOKKEEPER->WriteToDisk();
return "Bookkeeping data cleared."; return BOOKKEEPING_DATA_CLEARED;
} }
static LocalizedString MACHINE_STATS_CLEARED( "ScreenServiceAction", "Machine stats cleared." );
static CString ClearMachineStats() static CString ClearMachineStats()
{ {
Profile* pProfile = PROFILEMAN->GetMachineProfile(); Profile* pProfile = PROFILEMAN->GetMachineProfile();
@@ -29,9 +30,10 @@ static CString ClearMachineStats()
pProfile->InitAll(); pProfile->InitAll();
pProfile->m_sGuid = sGuid; pProfile->m_sGuid = sGuid;
PROFILEMAN->SaveMachineProfile(); PROFILEMAN->SaveMachineProfile();
return "Machine stats cleared."; return MACHINE_STATS_CLEARED;
} }
static LocalizedString MACHINE_EDITS_CLEARED( "ScreenServiceAction", "%d edits cleared, %d errors." );
static CString ClearMachineEdits() static CString ClearMachineEdits()
{ {
int iNumAttempted = 0; int iNumAttempted = 0;
@@ -52,7 +54,8 @@ static CString ClearMachineEdits()
PROFILEMAN->SaveMachineProfile(); PROFILEMAN->SaveMachineProfile();
PROFILEMAN->LoadMachineProfile(); PROFILEMAN->LoadMachineProfile();
return ssprintf("%d edits cleared, %d errors.",iNumSuccessful,iNumAttempted-iNumSuccessful); int iNumErrors = iNumAttempted-iNumSuccessful;
return ssprintf(MACHINE_EDITS_CLEARED.GetValue(),iNumSuccessful,iNumErrors);
} }
static PlayerNumber GetFirstReadyMemoryCard() static PlayerNumber GetFirstReadyMemoryCard()
@@ -70,11 +73,13 @@ static PlayerNumber GetFirstReadyMemoryCard()
return PLAYER_INVALID; return PLAYER_INVALID;
} }
static LocalizedString MEMORY_CARD_EDITS_NOT_CLEARED( "ScreenServiceAction", "Edits not cleared - No memory cards ready." );
static LocalizedString EDITS_CLEARED ( "ScreenServiceAction", "%d edits cleared, %d errors." );
static CString ClearMemoryCardEdits() static CString ClearMemoryCardEdits()
{ {
PlayerNumber pn = GetFirstReadyMemoryCard(); PlayerNumber pn = GetFirstReadyMemoryCard();
if( pn == PLAYER_INVALID ) if( pn == PLAYER_INVALID )
return "Stats not cleared - No memory cards ready."; return MEMORY_CARD_EDITS_NOT_CLEARED;
int iNumAttempted = 0; int iNumAttempted = 0;
int iNumSuccessful = 0; int iNumSuccessful = 0;
@@ -96,7 +101,7 @@ static CString ClearMemoryCardEdits()
MEMCARDMAN->UnmountCard(pn); MEMCARDMAN->UnmountCard(pn);
return ssprintf("%d edits cleared, %d errors.",iNumSuccessful,iNumAttempted-iNumSuccessful); return ssprintf(EDITS_CLEARED.GetValue(),iNumSuccessful,iNumAttempted-iNumSuccessful);
} }
static HighScore MakeRandomHighScore( float fPercentDP ) static HighScore MakeRandomHighScore( float fPercentDP )
@@ -170,20 +175,24 @@ static void FillProfile( Profile *pProfile )
} }
} }
static LocalizedString MACHINE_STATS_FILLED( "ScreenServiceAction", "Machine stats filled." );
static CString FillMachineStats() static CString FillMachineStats()
{ {
Profile* pProfile = PROFILEMAN->GetMachineProfile(); Profile* pProfile = PROFILEMAN->GetMachineProfile();
FillProfile( pProfile ); FillProfile( pProfile );
PROFILEMAN->SaveMachineProfile(); PROFILEMAN->SaveMachineProfile();
return "Machine stats filled."; return MACHINE_STATS_FILLED;
} }
static LocalizedString STATS_NOT_SAVED ( "ScreenServiceAction", "Stats not saved - No memory cards ready." );
static LocalizedString MACHINE_STATS_SAVED ( "ScreenServiceAction", "Machine stats saved to P%d card." );
static LocalizedString ERROR_SAVING_MACHINE_STATS ( "ScreenServiceAction", "Error saving machine stats to P%d card." );
static CString TransferStatsMachineToMemoryCard() static CString TransferStatsMachineToMemoryCard()
{ {
PlayerNumber pn = GetFirstReadyMemoryCard(); PlayerNumber pn = GetFirstReadyMemoryCard();
if( pn == PLAYER_INVALID ) if( pn == PLAYER_INVALID )
return "Stats not saved - No memory cards ready."; return STATS_NOT_SAVED;
if( !MEMCARDMAN->IsMounted(pn) ) if( !MEMCARDMAN->IsMounted(pn) )
MEMCARDMAN->MountCard(pn); MEMCARDMAN->MountCard(pn);
@@ -196,16 +205,20 @@ static CString TransferStatsMachineToMemoryCard()
MEMCARDMAN->UnmountCard(pn); MEMCARDMAN->UnmountCard(pn);
if( bSaved ) if( bSaved )
return ssprintf("Machine stats saved to P%d card.",pn+1); return ssprintf(MACHINE_STATS_SAVED.GetValue(),pn+1);
else else
return ssprintf("Error saving machine stats to P%d card.",pn+1); return ssprintf(ERROR_SAVING_MACHINE_STATS.GetValue(),pn+1);
} }
static LocalizedString STATS_NOT_LOADED ( "ScreenServiceAction", "Stats not loaded - No memory cards ready." );
static LocalizedString MACHINE_STATS_LOADED ( "ScreenServiceAction", "Machine stats loaded from P%d card." );
static LocalizedString THERE_IS_NO_PROFILE ( "ScreenServiceAction", "There is no machine profile on P%d card." );
static LocalizedString PROFILE_CORRUPT ( "ScreenServiceAction", "The profile on P%d card contains corrupt or tampered data." );
static CString TransferStatsMemoryCardToMachine() static CString TransferStatsMemoryCardToMachine()
{ {
PlayerNumber pn = GetFirstReadyMemoryCard(); PlayerNumber pn = GetFirstReadyMemoryCard();
if( pn == PLAYER_INVALID ) if( pn == PLAYER_INVALID )
return "Stats not loaded - No memory cards ready."; return STATS_NOT_LOADED;
if( !MEMCARDMAN->IsMounted(pn) ) if( !MEMCARDMAN->IsMounted(pn) )
MEMCARDMAN->MountCard(pn); MEMCARDMAN->MountCard(pn);
@@ -216,18 +229,19 @@ static CString TransferStatsMemoryCardToMachine()
Profile backup = *PROFILEMAN->GetMachineProfile(); Profile backup = *PROFILEMAN->GetMachineProfile();
ProfileLoadResult lr = PROFILEMAN->GetMachineProfile()->LoadAllFromDir( sDir, PREFSMAN->m_bSignProfileData ); ProfileLoadResult lr = PROFILEMAN->GetMachineProfile()->LoadAllFromDir( sDir, PREFSMAN->m_bSignProfileData );
CString s;
switch( lr ) switch( lr )
{ {
case ProfileLoadResult_Success: case ProfileLoadResult_Success:
return ssprintf("Machine stats loaded from P%d card.",pn+1); s = ssprintf(MACHINE_STATS_LOADED.GetValue(),pn+1);
break; break;
case ProfileLoadResult_FailedNoProfile: case ProfileLoadResult_FailedNoProfile:
return ssprintf("There is no machine profile on P%d card.",pn+1);
*PROFILEMAN->GetMachineProfile() = backup; *PROFILEMAN->GetMachineProfile() = backup;
s = ssprintf(THERE_IS_NO_PROFILE.GetValue(),pn+1);
break; break;
case ProfileLoadResult_FailedTampered: case ProfileLoadResult_FailedTampered:
return ssprintf("The profile on P%d card contains corrupt or tampered data.",pn+1);
*PROFILEMAN->GetMachineProfile() = backup; *PROFILEMAN->GetMachineProfile() = backup;
s = ssprintf(PROFILE_CORRUPT.GetValue(),pn+1);
break; break;
default: default:
ASSERT(0); ASSERT(0);
@@ -235,7 +249,7 @@ static CString TransferStatsMemoryCardToMachine()
MEMCARDMAN->UnmountCard(pn); MEMCARDMAN->UnmountCard(pn);
return "Stats transferred to machine."; return s;
} }
static void CopyEdits( const CString &sFrom, const CString &sTo, int &iNumAttempted, int &iNumSuccessful, int &iNumOverwritten ) static void CopyEdits( const CString &sFrom, const CString &sTo, int &iNumAttempted, int &iNumSuccessful, int &iNumOverwritten )
@@ -279,11 +293,13 @@ static void CopyEdits( const CString &sFrom, const CString &sTo, int &iNumAttemp
} }
} }
static LocalizedString EDITS_NOT_COPIED( "ScreenServiceAction", "Edits not copied - No memory cards ready." );
static LocalizedString COPIED_TO_CARD( "ScreenServiceAction", "Copied to P%d card: %d/%d copies OK (%d overwritten)." );
static CString CopyEditsMachineToMemoryCard() static CString CopyEditsMachineToMemoryCard()
{ {
PlayerNumber pn = GetFirstReadyMemoryCard(); PlayerNumber pn = GetFirstReadyMemoryCard();
if( pn == PLAYER_INVALID ) if( pn == PLAYER_INVALID )
return "Edits not copied - No memory cards ready."; return EDITS_NOT_COPIED;
if( !MEMCARDMAN->IsMounted(pn) ) if( !MEMCARDMAN->IsMounted(pn) )
MEMCARDMAN->MountCard(pn); MEMCARDMAN->MountCard(pn);
@@ -299,14 +315,15 @@ static CString CopyEditsMachineToMemoryCard()
MEMCARDMAN->UnmountCard(pn); MEMCARDMAN->UnmountCard(pn);
// TODO: Make string themable // TODO: Make string themable
return ssprintf("Copied to P%d card:\n%d/%d copies OK (%d overwritten).",pn+1,iNumSuccessful,iNumAttempted,iNumOverwritten); return ssprintf(COPIED_TO_CARD.GetValue(),pn+1,iNumSuccessful,iNumAttempted,iNumOverwritten);
} }
static LocalizedString COPIED_FROM_CARD( "ScreenServiceAction", "Copied from P%d card: %d/%d copies OK (%d overwritten)." );
static CString CopyEditsMemoryCardToMachine() static CString CopyEditsMemoryCardToMachine()
{ {
PlayerNumber pn = GetFirstReadyMemoryCard(); PlayerNumber pn = GetFirstReadyMemoryCard();
if( pn == PLAYER_INVALID ) if( pn == PLAYER_INVALID )
return "Edits not copied - No memory cards ready."; return EDITS_NOT_COPIED;
if( !MEMCARDMAN->IsMounted(pn) ) if( !MEMCARDMAN->IsMounted(pn) )
MEMCARDMAN->MountCard(pn); MEMCARDMAN->MountCard(pn);
@@ -326,13 +343,14 @@ static CString CopyEditsMemoryCardToMachine()
PROFILEMAN->LoadMachineProfile(); PROFILEMAN->LoadMachineProfile();
// TODO: Make themeable // TODO: Make themeable
return ssprintf("Copied from P%d card:\n%d/%d copies OK (%d overwritten).",pn+1,iNumSuccessful,iNumAttempted,iNumOverwritten); return ssprintf(COPIED_FROM_CARD.GetValue(),pn+1,iNumSuccessful,iNumAttempted,iNumOverwritten);
} }
static LocalizedString PREFERENCES_RESET( "ScreenServiceAction", "Preferences reset." );
static CString ResetPreferences() static CString ResetPreferences()
{ {
PREFSMAN->ResetToFactoryDefaults(); PREFSMAN->ResetToFactoryDefaults();
return "Preferences reset."; return PREFERENCES_RESET;
} }