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 "selection_controller.h"
#include "utils.h" #include "utils.h"
#include <algorithm>
#include <boost/algorithm/string/find.hpp> #include <boost/algorithm/string/find.hpp>
#include <boost/algorithm/string/predicate.hpp> #include <boost/algorithm/string/predicate.hpp>
#include <boost/range/algorithm.hpp>
#include <wx/checkbox.h> #include <wx/checkbox.h>
#include <wx/combobox.h> #include <wx/combobox.h>
@ -187,42 +187,32 @@ void DialogSelection::Process(wxCommandEvent&) {
con->selectionController->GetSelectedSet(old_sel); con->selectionController->GetSelectedSet(old_sel);
wxString message; wxString message;
size_t count = 0; size_t count;
switch (action) { switch (action) {
case ACTION_SET: case ACTION_SET:
new_sel = matches; new_sel = std::move(matches);
switch (count = new_sel.size()) { message = (count = new_sel.size())
case 0: message = _("Selection was set to no lines"); break; ? wxString::Format(wxPLURAL("Selection was set to one line", "Selection was set to %u lines", count), (unsigned)count)
case 1: message = _("Selection was set to one line"); break; : _("Selection was set to no lines");
default: message = wxString::Format(_("Selection was set to %u lines"), (unsigned)count);
}
break; break;
case ACTION_ADD: case ACTION_ADD:
set_union(old_sel.begin(), old_sel.end(), matches.begin(), matches.end(), inserter(new_sel, new_sel.begin())); boost::set_union(old_sel, matches, inserter(new_sel, new_sel.begin()));
switch (count = new_sel.size() - old_sel.size()) { message = (count = new_sel.size() - old_sel.size())
case 0: message = _("No lines were added to selection"); break; ? wxString::Format(wxPLURAL("One line was added to selection", "%u lines were added to selection", count), (unsigned)count)
case 1: message = _("One line was added to selection"); break; : _("No lines were added to selection");
default: message = wxString::Format(_("%u lines were added to selection"), (unsigned)count);
}
break; break;
case ACTION_SUB: case ACTION_SUB:
set_difference(old_sel.begin(), old_sel.end(), matches.begin(), matches.end(), inserter(new_sel, new_sel.begin())); boost::set_difference(old_sel, matches, inserter(new_sel, new_sel.begin()));
switch (count = old_sel.size() - new_sel.size()) { goto sub_message;
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;
case ACTION_INTERSECT: case ACTION_INTERSECT:
set_intersection(old_sel.begin(), old_sel.end(), matches.begin(), matches.end(), inserter(new_sel, new_sel.begin())); boost::set_intersection(old_sel, matches, inserter(new_sel, new_sel.begin()));
switch (count = old_sel.size() - new_sel.size()) { sub_message:
case 0: message = _("No lines were removed from selection"); break; message = (count = old_sel.size() - new_sel.size())
case 1: message = _("One line was removed from selection"); break; ? wxString::Format(wxPLURAL("One line was removed from selection", "%u lines were removed from selection", count), (unsigned)count)
default: message = wxString::Format(_("%u lines were removed from selection"), (unsigned)count); : _("No lines were removed from selection");
}
break; 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) { int confirm_delete(int n, wxWindow *parent, wxString const& title) {
wxString message = n == 1 ? return wxMessageBox(
_("Are you sure you want to delete this style?") : wxString::Format(wxPLURAL("Are you sure you want to delete this style?", "Are you sure you want to delete these %d styles?", n), n),
wxString::Format(_("Are you sure you want to delete these %d styles?"), n); title, wxYES_NO | wxICON_EXCLAMATION, parent);
return wxMessageBox(message, title, wxYES_NO | wxICON_EXCLAMATION, parent);
} }
int get_single_sel(wxListBox *lb) { 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) if (missing == 0)
status_callback(_("All fonts found.\n"), 1); status_callback(_("All fonts found.\n"), 1);
else 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) 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; return paths;
} }