NetLogo / Galapagos

NetLogo model simulation visualizer (Beak) and the netlogoweb.org website 🐢
https://netlogoweb.org/
Other
62 stars 43 forks source link

Google translate and exported HTML #344

Open ToonTalk opened 8 years ago

ToonTalk commented 8 years ago

A potentially great feature of the web version is that models can be automatically translated to over 100 languages.

When I load

http://www.netlogoweb.org/web?http://m.modelling4all.org/p/9oJf503_AM446-E7xFl25g.nlogo

nothing is translated. When I export the HTML and load it then sliders and text widgets are translated from German to English while all the graphs remain in German. This is in Chrome in Window 7.

More significantly the author of the page, Andreas (andreasdueringarch@gmail.com), says that when the page is translated a monitor stays at 0 unlike when running with translation turned off. And one of the graphs was missing one of its plots.

Also when I tried to enter the original URL into Google Translate I get errors:

https://translate.google.co.uk/translate?sl=de&tl=en&js=y&prev=_t&hl=en&ie=UTF-8&u=http%3A%2F%2Fwww.netlogoweb.org%2Fweb%3Fhttp%3A%2F%2Fm.modelling4all.org%2Fp%2F9oJf503_AM446-E7xFl25g.nlogo&edit-text=

notranslate can be added to the class of any DOM element that shouldn't be translated.

ToonTalk commented 8 years ago

Andreas sent me a more up-to-date version that illustrates the monitor problem.

https://dl.dropboxusercontent.com/u/51973316/Temp/Simulationsmodell%20Duering%20HTML%20VERSION%2014042016_vier%20Parameter.html

when translated the Children per woman (TFR) monitor shows 0 after setup. If one then turns off translation (without even clicking GO) you see a number: 5.4

TheBizzle commented 8 years ago

Just to provide a summary of my thoughts on this issue:

I definitely agree that making it possible to run NLW pages through translation services would be pretty nice. To my knowledge, there are two major problems that need to be resolved here:

  1. It is currently impossible to translate from a netlogoweb.org/launch#* URL, meaning that only standalone pages can be translated at the moment. I think this has something to do with how we're reading the URL hash, given that we get a funny error about not being able to read the model from a bizarre URL.
  2. Interface elements containing code need to be marked as untranslatable, so as to avoid breaking models. This is a concern that applies to variable names that are declared in some widgets (e.g. Sliders), and to the Code tab. Ken suggested the notranslate CSS class for this, but that's specific to Google Translate, so I think it would be better to use the translate="no" attribute, since that's the standard and is supported by all major translation services.