0

I'm making a GUI in R using the gWidgetsRGtk2 package and I need all messages in English but some appear to me in Spanish. For example:

w<- gwindow("Alert", width=100, height=100)

g <- ggroup(cont = w)

gimage("info", dirname="stock", size="large_toolbar", cont = g)

ig <- ggroup(horizontal = FALSE, cont = g)
glabel(message, cont = ig, expand = TRUE)

bg <- ggroup(cont = ig)
addSpring(bg)
gbutton("cancel", handler = function(h,...) dispose(w), cont = bg, toolkit = guiToolkit())

I need to change the word "Cancelar" to "Cancel".

> sessionInfo()
R version 3.0.1 (2013-05-16)
Platform: x86_64-w64-mingw32/x64 (64-bit)

locale:
[1] LC_COLLATE=Spanish_Mexico.1252  LC_CTYPE=Spanish_Mexico.1252    LC_MONETARY=Spanish_Mexico.1252
[4] LC_NUMERIC=C                    LC_TIME=Spanish_Mexico.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
 [1] diagram_1.6.2        shape_1.4.0          cluster_1.14.4       plyr_1.8             ade4_1.5-2          
 [6] vegan_2.0-10         lattice_0.20-15      permute_0.8-0        gWidgetsRGtk2_0.0-82 RGtk2_2.20.25       
[11] gWidgets_0.0-52     

loaded via a namespace (and not attached):
[1] grid_3.0.1  tools_3.0.1

Thanks for all the suggestions, I could change the messages to English with this line of code:

Sys.setlocale(category = "LC_ALL", locale = "English")
  • wow.. who came up with the name "gWidgetsRGtk2" – rawr Jan 18 '14 at 22:09
  • That would be John Verzani. It makes sense as a package name as it is the Gtk2 version of gWidgets. – Dason Jan 18 '14 at 22:33
  • Can you post the output of `sessionInfo()` – Dason Jan 18 '14 at 22:36
  • 1
    I'm guessing this comes about from some locale setting. You can update the text in a button through its `svalue<-` method, as in `svalue(button) <- "cancel"`. As for the name Dason is right. The "g" came from wanting something similar to Simon Urbanek's `iwidgets` and `hwidgets` and `jwidgets` just didn't seem right at the time. Now there is the awkward `gWidgets2RGtk2` with two 2's! Though you never really have to type it after it has been installed. – jverzani Jan 19 '14 at 16:06

1 Answers1

0

Although this is an old question, that already has a solution I think this answer complements the previous solution.

For Windows 7 systems when RGui is started from an icon LANGUAGE="en" can be appended to Target.

Right click the icon and select properties. Under the Shortcut tab find the Target field. Append the LANGUAGE="en" to the path, separated by a space e.g. "C:\Program Files\R\R-3.4.1\bin\x64\Rgui.exe" LANGUAGE="en"

Bonus: While you are in the icon properties it might be good to know that deleting the string in the Start in field makes the R working directory flexible - it will always be the same directory as the shortcut resides in. Copying the icon to e.g. "My R project" will make this the default directory when starting R using that icon.

Oskar Hansson
  • 331
  • 4
  • 15