From 1a1b6f99b2490bdf377a8896ff16935abb245f9d Mon Sep 17 00:00:00 2001 From: tildearrow Date: Sun, 7 Jul 2024 19:24:45 -0500 Subject: [PATCH] localize main errors --- src/main.cpp | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 7eefcede1..9c3dc6a9e 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -664,7 +664,7 @@ int main(int argc, char** argv) { val=argv[i+1]; i++; } else { - reportError(fmt::sprintf("incomplete param %s.",arg.c_str())); + reportError(fmt::sprintf(_("incomplete param %s."),arg.c_str())); return 1; } } @@ -746,13 +746,13 @@ int main(int argc, char** argv) { logI("loading module..."); FILE* f=ps_fopen(fileName.c_str(),"rb"); if (f==NULL) { - reportError(fmt::sprintf("couldn't open file! (%s)",strerror(errno))); + reportError(fmt::sprintf(_("couldn't open file! (%s)"),strerror(errno))); e.everythingOK(); finishLogFile(); return 1; } if (fseek(f,0,SEEK_END)<0) { - reportError(fmt::sprintf("couldn't open file! (couldn't get file size: %s)",strerror(errno))); + reportError(fmt::sprintf(_("couldn't open file! (couldn't get file size: %s)"),strerror(errno))); e.everythingOK(); fclose(f); finishLogFile(); @@ -760,7 +760,7 @@ int main(int argc, char** argv) { } ssize_t len=ftell(f); if (len==(SIZE_MAX>>1)) { - reportError(fmt::sprintf("couldn't open file! (couldn't get file length: %s)",strerror(errno))); + reportError(fmt::sprintf(_("couldn't open file! (couldn't get file length: %s)"),strerror(errno))); e.everythingOK(); fclose(f); finishLogFile(); @@ -768,9 +768,9 @@ int main(int argc, char** argv) { } if (len<1) { if (len==0) { - reportError("that file is empty!"); + reportError(_("that file is empty!")); } else { - reportError(fmt::sprintf("couldn't open file! (tell error: %s)",strerror(errno))); + reportError(fmt::sprintf(_("couldn't open file! (tell error: %s)"),strerror(errno))); } e.everythingOK(); fclose(f); @@ -779,7 +779,7 @@ int main(int argc, char** argv) { } unsigned char* file=new unsigned char[len]; if (fseek(f,0,SEEK_SET)<0) { - reportError(fmt::sprintf("couldn't open file! (size error: %s)",strerror(errno))); + reportError(fmt::sprintf(_("couldn't open file! (size error: %s)"),strerror(errno))); e.everythingOK(); fclose(f); delete[] file; @@ -787,7 +787,7 @@ int main(int argc, char** argv) { return 1; } if (fread(file,1,(size_t)len,f)!=(size_t)len) { - reportError(fmt::sprintf("couldn't open file! (read error: %s)",strerror(errno))); + reportError(fmt::sprintf(_("couldn't open file! (read error: %s)"),strerror(errno))); e.everythingOK(); fclose(f); delete[] file; @@ -796,7 +796,7 @@ int main(int argc, char** argv) { } fclose(f); if (!e.load(file,(size_t)len,fileName.c_str())) { - reportError(fmt::sprintf("could not open file! (%s)",e.getLastError())); + reportError(fmt::sprintf(_("could not open file! (%s)"),e.getLastError())); e.everythingOK(); finishLogFile(); return 1; @@ -810,7 +810,7 @@ int main(int argc, char** argv) { if (!e.init()) { if (consoleMode) { - reportError("could not initialize engine!"); + reportError(_("could not initialize engine!")); finishLogFile(); return 1; } else { @@ -843,12 +843,12 @@ int main(int argc, char** argv) { fwrite(w->getFinalBuf(),1,w->size(),f); fclose(f); } else { - reportError(fmt::sprintf("could not open file! (%s)",e.getLastError())); + reportError(fmt::sprintf(_("could not open file! (%s)"),e.getLastError())); } w->finish(); delete w; } else { - reportError("could not write command stream!"); + reportError(_("could not write command stream!")); } } if (vgmOutName!="") { @@ -859,12 +859,12 @@ int main(int argc, char** argv) { fwrite(w->getFinalBuf(),1,w->size(),f); fclose(f); } else { - reportError(fmt::sprintf("could not open file! (%s)",e.getLastError())); + reportError(fmt::sprintf(_("could not open file! (%s)"),e.getLastError())); } w->finish(); delete w; } else { - reportError("could not write VGM!"); + reportError(_("could not write VGM!")); } } if (outName!="") { @@ -886,11 +886,11 @@ int main(int argc, char** argv) { } cli.bindEngine(&e); if (!cli.init()) { - reportError("error while starting CLI!"); + reportError(_("error while starting CLI!")); } else { cliSuccess=true; } - logI("playing..."); + logI(_("playing...")); e.play(); if (cliSuccess) { cli.loop(); @@ -931,8 +931,8 @@ int main(int argc, char** argv) { } if (displayEngineFailError) { - logE("displaying engine fail error."); - g.showError("error while initializing audio!"); + logE(_("displaying engine fail error.")); + g.showError(_("error while initializing audio!")); } if (displayLocaleFailError) {