2424#ifdef WIN32
2525#include < Windows.h>
2626#endif
27+ #include " LocaleES.h"
2728
2829#include < FreeImage.h>
2930
@@ -196,6 +197,28 @@ bool verifyHomeFolderExists()
196197 return true ;
197198}
198199
200+ void locales_init () {
201+ #ifdef HAVE_GETTEXT
202+ char * btd;
203+ char * cs;
204+
205+ #define LOCALEDIR INSTALLATION_PREFIX_DIR " /share/locale"
206+ // local dir ; uncomment if you want to use locally compiled .mo files instead of .mo from the installation dir (present only after make install)
207+ // #define LOCALEDIR "./locale/lang"
208+
209+ setlocale (LC_MESSAGES, " " );
210+ textdomain (" emulationstation" );
211+ if ((btd=bindtextdomain (" emulationstation" , LOCALEDIR)) == NULL ) {
212+ return ;
213+ }
214+
215+ cs = bind_textdomain_codeset (" emulationstation" , " UTF-8" );
216+ if (cs == NULL ) {
217+ /* outch not enough memory, no real thing to do */
218+ }
219+ #endif
220+ }
221+
199222// Returns true if everything is OK,
200223bool loadSystemConfigFile (const char ** errorString)
201224{
@@ -287,6 +310,9 @@ int main(int argc, char* argv[])
287310 // always close the log on exit
288311 atexit (&onExit);
289312
313+ // Set locale
314+ locales_init ();
315+
290316 Window window;
291317 SystemScreenSaver screensaver (&window);
292318 PowerSaver::init ();
@@ -311,9 +337,9 @@ int main(int argc, char* argv[])
311337 LOG (LogInfo) << " ARB_texture_non_power_of_two: " << (glExts.find (" ARB_texture_non_power_of_two" ) != std::string::npos ? " ok" : " MISSING" );
312338 if (splashScreen)
313339 {
314- std::string progressText = " Loading..." ;
340+ std::string progressText = _ ( " Loading..." ) ;
315341 if (splashScreenProgress)
316- progressText = " Loading system config..." ;
342+ progressText = _ ( " Loading system config..." ) ;
317343 window.renderLoadingScreen (progressText);
318344 }
319345 }
@@ -333,7 +359,7 @@ int main(int argc, char* argv[])
333359 // we can't handle es_systems.cfg file problems inside ES itself, so display the error message then quit
334360 window.pushGui (new GuiMsgBox (&window,
335361 errorMsg,
336- " QUIT" , [] {
362+ _ ( " QUIT" ) , [] {
337363 SDL_Event* quit = new SDL_Event ();
338364 quit->type = SDL_QUIT;
339365 SDL_PushEvent (quit);
@@ -354,7 +380,7 @@ int main(int argc, char* argv[])
354380 ViewController::get ()->preload ();
355381
356382 if (splashScreen && splashScreenProgress)
357- window.renderLoadingScreen (" Done." );
383+ window.renderLoadingScreen (_ ( " Done." ) );
358384
359385 // choose which GUI to open depending on if an input configuration already exists
360386 if (errorMsg == NULL )
0 commit comments