Improved messages

This commit is contained in:
Zane U. Ji 2014-03-24 19:11:15 +08:00
parent 19fded5473
commit 9826820285
4 changed files with 354 additions and 345 deletions

File diff suppressed because it is too large Load Diff

View File

@ -6,7 +6,7 @@ That's quite easy. Download Xml-copy-editor(called XCE below :P),
unpack it. Go to that source dirctory. Here you can see many ".cpp"
files and ".h" files. input command:
$ xgettext -k_ --from-code=utf-8 *.cpp *.h
$ xgettext -k_ -kwxPLURAL:1,2 --from-code=utf-8 *.cpp *.h
then you get a "messages.po" in the dirctory. That's the ".po" file we
need to translate. You need a tool to help you finish the translation
@ -44,7 +44,7 @@ version. Uncompress the source and install poedit in "c:\poedit", then
open a "Command Window" by executing "cmd.exe". Go to the XCE's source
directory, run:
c:\poedit\bin\xgettext.exe -k_ --from-code=utf-8 *.cpp *.h
c:\poedit\bin\xgettext.exe -k_ -kwxPLURAL:1,2 --from-code=utf-8 *.cpp *.h
to a messages.po file. Setup poedit the same as in the Linux part, then
open the ".po" file you just created and translate all items. When you

View File

@ -25,7 +25,6 @@
#endif
#include "styledialog.h"
#include "nocasecompare.h"
#define ngettext wxGetTranslation
BEGIN_EVENT_TABLE ( StyleDialog, wxDialog )
EVT_BUTTON ( ID_STYLE_REPORT, StyleDialog::OnReport )
@ -508,7 +507,7 @@ void StyleDialog::OnReport ( wxCommandEvent& event )
++i;
}
wxString message;
message.Printf ( ngettext ( L"%i error", L"%i errors", i ), i );
message.Printf ( wxPLURAL ( "%i error", "%i errors", i ), i );
status->SetStatusText ( message );
if ( i )
table->SetFocus();

View File

@ -66,8 +66,6 @@
#include "dtd2schema.h"
#include "myipc.h"
#define ngettext wxGetTranslation
#ifdef NEWFINDREPLACE
#include "findreplacepanel.h"
#endif
@ -2001,7 +1999,7 @@ void MyFrame::OnDialogReplaceAll ( wxFindDialogEvent& event )
wxString msg;
msg.Printf (
ngettext ( L"%i replacement made", L"%i replacements made", replacementCount ),
wxPLURAL ( "%i replacement made", "%i replacements made", replacementCount ),
replacementCount );
statusProgress ( msg );
}
@ -2802,7 +2800,7 @@ void MyFrame::OnGlobalReplace ( wxCommandEvent& event )
wxString msg;
msg.Printf (
ngettext ( L"%i replacement made", L"%i replacements made", globalMatchCount ),
wxPLURAL ( "%i replacement made", "%i replacements made", globalMatchCount ),
globalMatchCount );
statusProgress ( msg );
@ -4869,7 +4867,7 @@ void MyFrame::displaySavedStatus ( int bytes )
else if ( bytes >= 0 )
{
result = bytes;
unit = ngettext ( L"byte", L"bytes", bytes );
unit = wxPLURAL ( "byte", "bytes", bytes );
}
else
return;
@ -5920,7 +5918,7 @@ void MyFrame::OnWordCount ( wxCommandEvent& event )
int count = xwc->getWordCount();
msg.Printf (
ngettext ( L"%s contains %i word", L"%s contains %i words", count ),
wxPLURAL ( "%s contains %i word", "%s contains %i words", count ),
doc->getShortFileName().c_str(), count );
messagePane ( msg, CONST_INFO, true );
@ -6079,15 +6077,15 @@ void MyFrame::addToFileQueue ( wxString& fileName )
void MyFrame::validatePaths()
{
bool valid = true;
int invalid = 0;
wxString msg;
// Warning: Don't put a space between 'CHECK' and '('
#define CHECK( check, path ) \
if ( !( check ) ( path ) )\
{\
valid = false;\
msg << _ ( "Invalid path: " ) << path << wxTextFile::GetEOL();\
invalid++;\
msg << wxTextFile::GetEOL() << path;\
}
CHECK ( wxDirExists, ruleSetDir );
//CHECK ( wxDirExists, filterDir );
@ -6110,10 +6108,12 @@ void MyFrame::validatePaths()
#endif // __WXMSW__
#undef CHECK
if ( valid )
if ( !invalid )
return;
msg = wxPLURAL ( "Invalid path: ", "Invalid paths: ", invalid ) + msg;
msg << wxTextFile::GetEOL()
<< wxTextFile::GetEOL()
#ifdef __WXMSW__
<< _ ( "To change application directory, see Tools, Options..., General" );
#else