Fix capitalization of categories, fixes #4622 (#4832)

- Fix capitalization of "Standard" in kart and track selection screens
 - Fix both "All" and "Standard" in random GP screen
 - Code style/documentation/consistency improvements
This commit is contained in:
QwertyChouskie 2022-12-27 09:27:55 -08:00 committed by GitHub
parent ebaf521269
commit 3bad8d943a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 81 additions and 34 deletions

View File

@ -61,7 +61,7 @@ private:
* than once. */ * than once. */
std::vector<int> m_selected_karts; std::vector<int> m_selected_karts;
/** Contains a flag for each kart indicating wether it is available on /** Contains a flag for each kart indicating whether it is available on
* all clients or not. */ * all clients or not. */
std::vector<bool> m_kart_available; std::vector<bool> m_kart_available;

View File

@ -76,17 +76,21 @@ void ArenasScreen::beforeAddingWidget()
// Make group names being picked up by gettext // Make group names being picked up by gettext
#define FOR_GETTEXT_ONLY(x) #define FOR_GETTEXT_ONLY(x)
//I18N: arena group name //I18N: track group name
FOR_GETTEXT_ONLY( _("standard") ) FOR_GETTEXT_ONLY( _("All") )
//I18N: arena group name //I18N: track group name
FOR_GETTEXT_ONLY( _("Standard") )
//I18N: track group name
FOR_GETTEXT_ONLY( _("Add-Ons") ) FOR_GETTEXT_ONLY( _("Add-Ons") )
// add others after // Add other groups after
for (int n=0; n<group_amount; n++) for (int n=0; n<group_amount; n++)
{ {
// try to translate the group name if (groups[n] == "standard") // Fix capitalization (#4622)
tabs->addTextChild( _(groups[n].c_str()), groups[n] ); tabs->addTextChild( _("Standard") , groups[n]);
} else // Try to translate group names
tabs->addTextChild( _(groups[n].c_str()) , groups[n]);
} // for n<group_amount
int num_of_arenas=0; int num_of_arenas=0;
for (unsigned int n=0; n<track_manager->getNumberOfTracks(); n++) //iterate through tracks to find how many are arenas for (unsigned int n=0; n<track_manager->getNumberOfTracks(); n++) //iterate through tracks to find how many are arenas

View File

@ -140,16 +140,20 @@ void EasterEggScreen::beforeAddingWidget()
// Make group names being picked up by gettext // Make group names being picked up by gettext
#define FOR_GETTEXT_ONLY(x) #define FOR_GETTEXT_ONLY(x)
//I18N: track group name //I18N: track group name
FOR_GETTEXT_ONLY( _("standard") ) FOR_GETTEXT_ONLY( _("All") )
//I18N: track group name
FOR_GETTEXT_ONLY( _("Standard") )
//I18N: track group name //I18N: track group name
FOR_GETTEXT_ONLY( _("Add-Ons") ) FOR_GETTEXT_ONLY( _("Add-Ons") )
// add others after // Add other groups after
for (int n=0; n<group_amount; n++) for (int n=0; n<group_amount; n++)
{ {
// try to translate the group name if (groups[n] == "standard") // Fix capitalization (#4622)
tabs->addTextChild( _(groups[n].c_str()), groups[n] ); tabs->addTextChild( _("Standard") , groups[n]);
} else // Try to translate group names
tabs->addTextChild( _(groups[n].c_str()) , groups[n]);
} // for n<group_amount
int num_of_arenas=0; int num_of_arenas=0;
for (unsigned int n=0; n<track_manager->getNumberOfTracks(); n++) //iterate through tracks to find how many are arenas for (unsigned int n=0; n<track_manager->getNumberOfTracks(); n++) //iterate through tracks to find how many are arenas

View File

@ -224,7 +224,7 @@ void GPInfoScreen::init()
m_reverse_spinner->setValue( UserConfigParams::m_gp_reverse ); m_reverse_spinner->setValue( UserConfigParams::m_gp_reverse );
if(random) if (random)
{ {
RibbonWidget *rb = getWidget<RibbonWidget>("buttons"); RibbonWidget *rb = getWidget<RibbonWidget>("buttons");
rb->setLabel(1,_(L"Reload") ); rb->setLabel(1,_(L"Reload") );
@ -234,19 +234,35 @@ void GPInfoScreen::init()
// been added or deleted since the last time this screen was shown. // been added or deleted since the last time this screen was shown.
const std::vector<std::string>& groups = track_manager->getAllTrackGroups(); const std::vector<std::string>& groups = track_manager->getAllTrackGroups();
m_group_names.clear(); m_group_names.clear();
m_group_names.push_back("all"); m_group_names.push_back("all"); // Add "all" group as first group
for (unsigned int i = 0; i < groups.size(); i++) for (unsigned int i = 0; i < groups.size(); i++) // Add rest of groups
m_group_names.push_back(groups[i]); m_group_names.push_back(groups[i]);
m_group_spinner->clearLabels(); m_group_spinner->clearLabels();
int index_standard=0; int index_standard = 0; // Index value of "standard" category
for (unsigned int i = 0; i < m_group_names.size(); i++) for (unsigned int i = 0; i < m_group_names.size(); i++)
{ {
m_group_spinner->addLabel(_(m_group_names[i].c_str())); if (m_group_names[i] == "all")
if (m_group_names[i] == "standard") {
// Fix capitalization (#4622)
m_group_spinner->addLabel( _("All") );
}
else if (m_group_names[i] == "standard")
{
// Set index value of "Standard" category
index_standard = i + 1; index_standard = i + 1;
// Fix capitalization (#4622)
m_group_spinner->addLabel( _("Standard") );
}
else
{
m_group_spinner->addLabel(_(m_group_names[i].c_str()));
}
} }
// Try to keep a previously selected group value // Try to keep a previously selected group value
if(m_group_spinner->getValue() >= (int)groups.size()) if (m_group_spinner->getValue() >= (int)groups.size())
{ {
m_group_spinner->setValue(index_standard); m_group_spinner->setValue(index_standard);
m_group_name = "standard"; m_group_name = "standard";
@ -258,7 +274,7 @@ void GPInfoScreen::init()
m_max_num_tracks = getMaxNumTracks(m_group_name); m_max_num_tracks = getMaxNumTracks(m_group_name);
m_num_tracks_spinner->setMax(m_max_num_tracks); m_num_tracks_spinner->setMax(m_max_num_tracks);
if(m_num_tracks_spinner->getValue() > m_max_num_tracks || if (m_num_tracks_spinner->getValue() > m_max_num_tracks ||
m_num_tracks_spinner->getValue() < 1) m_num_tracks_spinner->getValue() < 1)
{ {
m_num_tracks_spinner->setValue(m_max_num_tracks); m_num_tracks_spinner->setValue(m_max_num_tracks);

View File

@ -308,27 +308,31 @@ void KartSelectionScreen::beforeAddingWidget()
kart_properties_manager->getAllGroups(); kart_properties_manager->getAllGroups();
const int group_amount = (int)groups.size(); const int group_amount = (int)groups.size();
// add all group first // Add "All" group first
if (group_amount > 1) if (group_amount > 1)
{ {
//I18N: name of the tab that will show tracks from all groups //I18N: name of the tab that will show karts from all groups
tabs->addTextChild( _("All") , ALL_KART_GROUPS_ID); tabs->addTextChild( _("All") , ALL_KART_GROUPS_ID);
} }
// Make group names being picked up by gettext // Make group names being picked up by gettext
#define FOR_GETTEXT_ONLY(x) #define FOR_GETTEXT_ONLY(x)
//I18N: kart group name //I18N: kart group name
FOR_GETTEXT_ONLY( _("standard") ) FOR_GETTEXT_ONLY( _("All") )
//I18N: kart group name
FOR_GETTEXT_ONLY( _("Standard") )
//I18N: kart group name //I18N: kart group name
FOR_GETTEXT_ONLY( _("Add-Ons") ) FOR_GETTEXT_ONLY( _("Add-Ons") )
// add others after // Add other groups after
for (int n=0; n<group_amount; n++) for (int n=0; n<group_amount; n++)
{ {
// try to translate group names if (groups[n] == "standard") // Fix capitalization (#4622)
tabs->addTextChild( _(groups[n].c_str()) , groups[n]); tabs->addTextChild( _("Standard") , groups[n]);
} // for n<group_amount else // Try to translate group names
tabs->addTextChild( _(groups[n].c_str()) , groups[n]);
} // for n<group_amount
DynamicRibbonWidget* w = getWidget<DynamicRibbonWidget>("karts"); DynamicRibbonWidget* w = getWidget<DynamicRibbonWidget>("karts");

View File

@ -354,10 +354,24 @@ void TracksScreen::beforeAddingWidget()
//I18N: name of the tab that will show tracks from all groups //I18N: name of the tab that will show tracks from all groups
tabs->addTextChild( _("All"), ALL_TRACK_GROUPS_ID ); tabs->addTextChild( _("All"), ALL_TRACK_GROUPS_ID );
} }
// Make group names being picked up by gettext
#define FOR_GETTEXT_ONLY(x)
//I18N: track group name
FOR_GETTEXT_ONLY( _("All") )
//I18N: track group name
FOR_GETTEXT_ONLY( _("Standard") )
//I18N: track group name
FOR_GETTEXT_ONLY( _("Add-Ons") )
// add behind the other categories // Add other groups after
for (int n=0; n<group_amount; n++) for (int n=0; n<group_amount; n++)
tabs->addTextChild( _(groups[n].c_str()), groups[n] ); {
if (groups[n] == "standard") // Fix capitalization (#4622)
tabs->addTextChild( _("Standard") , groups[n]);
else // Try to translate group names
tabs->addTextChild( _(groups[n].c_str()) , groups[n]);
} // for n<group_amount
DynamicRibbonWidget* tracks_widget = getWidget<DynamicRibbonWidget>("tracks"); DynamicRibbonWidget* tracks_widget = getWidget<DynamicRibbonWidget>("tracks");
tracks_widget->setItemCountHint( (int)track_manager->getNumberOfTracks()+1 ); tracks_widget->setItemCountHint( (int)track_manager->getNumberOfTracks()+1 );

View File

@ -154,15 +154,20 @@ void TracksAndGPScreen::beforeAddingWidget()
// Make group names being picked up by gettext // Make group names being picked up by gettext
#define FOR_GETTEXT_ONLY(x) #define FOR_GETTEXT_ONLY(x)
//I18N: track group name //I18N: track group name
FOR_GETTEXT_ONLY( _("all") ) FOR_GETTEXT_ONLY( _("All") )
//I18N: track group name //I18N: track group name
FOR_GETTEXT_ONLY( _("standard") ) FOR_GETTEXT_ONLY( _("Standard") )
//I18N: track group name //I18N: track group name
FOR_GETTEXT_ONLY( _("Add-Ons") ) FOR_GETTEXT_ONLY( _("Add-Ons") )
// add behind the other categories // Add other groups after
for (int n=0; n<group_amount; n++) for (int n=0; n<group_amount; n++)
tabs->addTextChild( _(groups[n].c_str()), groups[n] ); {
if (groups[n] == "standard") // Fix capitalization (#4622)
tabs->addTextChild( _("Standard") , groups[n]);
else // Try to translate group names
tabs->addTextChild( _(groups[n].c_str()) , groups[n]);
} // for n<group_amount
DynamicRibbonWidget* tracks_widget = getWidget<DynamicRibbonWidget>("tracks"); DynamicRibbonWidget* tracks_widget = getWidget<DynamicRibbonWidget>("tracks");
tracks_widget->setItemCountHint( (int)track_manager->getNumberOfTracks()+1 ); tracks_widget->setItemCountHint( (int)track_manager->getNumberOfTracks()+1 );