Use proper plural forms for some UI strings

This commit is contained in:
Thomas Goyne 2014-03-12 09:13:46 -07:00
parent 6374cb52e1
commit bd15a54ae3
3 changed files with 26 additions and 33 deletions

View file

@ -34,9 +34,9 @@
#include "selection_controller.h"
#include "utils.h"
#include <algorithm>
#include <boost/algorithm/string/find.hpp>
#include <boost/algorithm/string/predicate.hpp>
#include <boost/range/algorithm.hpp>
#include <wx/checkbox.h>
#include <wx/combobox.h>
@ -187,42 +187,32 @@ void DialogSelection::Process(wxCommandEvent&) {
con->selectionController->GetSelectedSet(old_sel);
wxString message;
size_t count = 0;
size_t count;
switch (action) {
case ACTION_SET:
new_sel = matches;
switch (count = new_sel.size()) {
case 0: message = _("Selection was set to no lines"); break;
case 1: message = _("Selection was set to one line"); break;
default: message = wxString::Format(_("Selection was set to %u lines"), (unsigned)count);
}
new_sel = std::move(matches);
message = (count = new_sel.size())
? wxString::Format(wxPLURAL("Selection was set to one line", "Selection was set to %u lines", count), (unsigned)count)
: _("Selection was set to no lines");
break;
case ACTION_ADD:
set_union(old_sel.begin(), old_sel.end(), matches.begin(), matches.end(), inserter(new_sel, new_sel.begin()));
switch (count = new_sel.size() - old_sel.size()) {
case 0: message = _("No lines were added to selection"); break;
case 1: message = _("One line was added to selection"); break;
default: message = wxString::Format(_("%u lines were added to selection"), (unsigned)count);
}
boost::set_union(old_sel, matches, inserter(new_sel, new_sel.begin()));
message = (count = new_sel.size() - old_sel.size())
? wxString::Format(wxPLURAL("One line was added to selection", "%u lines were added to selection", count), (unsigned)count)
: _("No lines were added to selection");
break;
case ACTION_SUB:
set_difference(old_sel.begin(), old_sel.end(), matches.begin(), matches.end(), inserter(new_sel, new_sel.begin()));
switch (count = old_sel.size() - new_sel.size()) {
case 0: message = _("No lines were removed from selection"); break;
case 1: message = _("One line was removed from selection"); break;
default: message = wxString::Format(_("%u lines were removed from selection"), (unsigned)count);
}
break;
boost::set_difference(old_sel, matches, inserter(new_sel, new_sel.begin()));
goto sub_message;
case ACTION_INTERSECT:
set_intersection(old_sel.begin(), old_sel.end(), matches.begin(), matches.end(), inserter(new_sel, new_sel.begin()));
switch (count = old_sel.size() - new_sel.size()) {
case 0: message = _("No lines were removed from selection"); break;
case 1: message = _("One line was removed from selection"); break;
default: message = wxString::Format(_("%u lines were removed from selection"), (unsigned)count);
}
boost::set_intersection(old_sel, matches, inserter(new_sel, new_sel.begin()));
sub_message:
message = (count = old_sel.size() - new_sel.size())
? wxString::Format(wxPLURAL("One line was removed from selection", "%u lines were removed from selection", count), (unsigned)count)
: _("No lines were removed from selection");
break;
}

View file

@ -144,10 +144,9 @@ void add_styles(Func1 name_checker, Func2 style_adder) {
}
int confirm_delete(int n, wxWindow *parent, wxString const& title) {
wxString message = n == 1 ?
_("Are you sure you want to delete this style?") :
wxString::Format(_("Are you sure you want to delete these %d styles?"), n);
return wxMessageBox(message, title, wxYES_NO | wxICON_EXCLAMATION, parent);
return wxMessageBox(
wxString::Format(wxPLURAL("Are you sure you want to delete this style?", "Are you sure you want to delete these %d styles?", n), n),
title, wxYES_NO | wxICON_EXCLAMATION, parent);
}
int get_single_sel(wxListBox *lb) {

View file

@ -203,9 +203,13 @@ std::vector<agi::fs::path> FontCollector::GetFontPaths(const AssFile *file) {
if (missing == 0)
status_callback(_("All fonts found.\n"), 1);
else
status_callback(wxString::Format(_("%d fonts could not be found.\n"), missing), 2);
status_callback(wxString::Format(wxPLURAL("One font could not be found\n", "%d fonts could not be found.\n", missing), missing), 2);
if (missing_glyphs != 0)
status_callback(wxString::Format(_("%d fonts were found, but were missing glyphs used in the script.\n"), missing_glyphs), 2);
status_callback(wxString::Format(wxPLURAL(
"One font was found, but was missing glyphs used in the script.\n",
"%d fonts were found, but were missing glyphs used in the script.\n",
missing_glyphs),
missing_glyphs), 2);
return paths;
}