Zulip Chat Archive

Stream: new members

Topic: NGN Dark Mode


Utensil Song (Jun 08 2020 at 08:33):

Don't know if anyone wants a Dark Mode for Natural Number Game (and other games). Just share these code snippets in case it's useful.

I haven't dived into the source code yet (could make a PR to game maker later), but I did it locally and it boils down to a few lines of CSS and one line of JS:

body, button, .accordion__button,.accordion__panel {
    background-color: #202020 !important;
    color: #cdcdcd;
}

a {
    color: rgb(79, 140, 201);
}

.Resizer {
    background-color: #535353 !important;
}

(I use https://github.com/openstyles/stylus to add these css for matched URL automatically, then every time I get to a next level, I manually press F12, choose Console, copy-paste the following js and hit Enter:)

monaco.editor.setTheme('vs-dark');

The colors are from https://github.com/StylishThemes/GitHub-Dark which I've been using.

The overall effect looks like this :

image.png

Kevin Buzzard (Jun 08 2020 at 08:34):

@Mohammad Pedramfar how is this best implemented? Does this go in your repo?

Utensil Song (Jun 08 2020 at 09:32):

Yes, the modification should go to somewhere around https://github.com/mpedramfar/Lean-game-maker/blob/master/src/interactive_interface/src/index.tsx#L466 (using state to react to a button or a radio) and https://github.com/mpedramfar/Lean-game-maker/blob/master/src/interactive_interface/public/interactive.css . Persistence can be done using GameData at https://github.com/mpedramfar/Lean-game-maker/blob/master/src/interactive_interface/src/index.tsx#L389

Mohammad Pedramfar (Jun 09 2020 at 04:44):

Thanks. I'm adding it to the game.

Mohammad Pedramfar (Jun 09 2020 at 16:32):

The night mode is now added :)

Sebastien Gouezel (Jun 09 2020 at 16:38):

Can we try it somewhere? I also wanted to try out Patrick's localization, but I didn't find how to do it on https://wwwf.imperial.ac.uk/~buzzard/xena/natural_number_game/

Kevin Buzzard (Jun 09 2020 at 16:39):

hang on I'll compile

Kevin Buzzard (Jun 09 2020 at 16:46):

http://wwwf.imperial.ac.uk/~buzzard/xena/natural_number_game_night/

Kevin Buzzard (Jun 09 2020 at 16:46):

I don't know how to test localization. Does it just happen magically if your OS language is set to FR or something?

Sebastien Gouezel (Jun 09 2020 at 16:50):

Nice! I guess my OS is set to FR and still I see the NNG in English (but maybe my browser is set to English, I don't know).

Mohammad Pedramfar (Jun 09 2020 at 16:50):

The instructions are here : https://github.com/mpedramfar/Lean-game-maker/blob/master/USAGE.md#internationalization

Mohammad Pedramfar (Jun 09 2020 at 16:51):

You'd need to merge Patrick's pull request and then open the files that are described in the link with poedit, and click save to get the .mo files. Then you can run make-lean-game --locale=fr

Sebastien Gouezel (Jun 09 2020 at 16:52):

Ah, so it's a compile-time thing, not a user thing. Kevin, willing to create http://wwwf.imperial.ac.uk/~buzzard/xena/natural_number_game_fr/?

Mohammad Pedramfar (Jun 09 2020 at 16:55):

Sebastien Gouezel said:

Ah, so it's a compile-time thing, not a user thing. Kevin, willing to create http://wwwf.imperial.ac.uk/~buzzard/xena/natural_number_game_fr/?

Yeah, but I can make it a user thing. Hopefully I'll be free this weekend and I can implement it.

Sebastien Gouezel (Jun 09 2020 at 16:56):

That would be awesome!

Kevin Buzzard (Jun 09 2020 at 16:56):

I have a grant deadline tomorrow morning, I am happy to do this though (but after the deadline)

Kevin Buzzard (Jun 09 2020 at 16:57):

Sorry, I just compiled it and hoped.

Mohammad Pedramfar (Jun 09 2020 at 17:02):

Yeah, internationalisation could be made easier.

Patrick Massot (Jun 09 2020 at 21:23):

@Sebastien Gouezel compiling the NNG is not so complicated, but I put the French version at https://www.imo.universite-paris-saclay.fr/~pmassot/nng/ for you. Of course it has only two translated levels...

Mohammad Pedramfar (Jun 13 2020 at 20:32):

I made some changes to the code. Now the user can choose between different languages. The instructions are basically the same as before : https://github.com/mpedramfar/Lean-game-maker/blob/master/USAGE.md#internationalization

Patrick Massot (Jun 13 2020 at 21:13):

Now we really need to work on that translation...

Kevin Buzzard (Jun 13 2020 at 22:09):

Can't this be automated?

Mohammad Pedramfar (Jun 13 2020 at 23:23):

Kevin Buzzard said:

Can't this be automated?

Which part?

Mohammad Pedramfar (Jun 13 2020 at 23:26):

In linux, you can generate the content.mo file by going to the LC_MESSAGES folder and running msgcat content.po | msgfmt -o content.mo -

Jalex Stark (Jun 14 2020 at 00:10):

Kevin Buzzard said:

Can't this be automated?

you need someone who is literate enough in french to step in on the auto-translations which happen to be nonsense

Jalex Stark (Jun 14 2020 at 00:10):

you have more of them in math writing than in normal writing

Jalex Stark (Jun 14 2020 at 00:11):

the localization structure in mohammad's software + poedit do automate this a lot, swiftly putting each fragment that needs to be translated in your face together with a suggested auto-translation

Mohammad Pedramfar (Jun 14 2020 at 01:06):

Kevin Buzzard said:

Can't this be automated?

I made a small change in the code. Now if you clone a repository that contains some translations, but not the machine generated .mo files, then you don't need to open POEdit and click save, just to be able to use the translations. Just running the make-lean-game --locale=fr does the job.

Mohammad Pedramfar (Jun 14 2020 at 01:10):

The next step in the automation of this translation is probably teaching the computer how to teach mathematics in French :grinning_face_with_smiling_eyes:


Last updated: Dec 20 2023 at 11:08 UTC