phyver / GameShell

a game to learn (or teach) how to use standard commands in a Unix shell
GNU General Public License v3.0
2.12k stars 135 forks source link

Changing language, add folders! #100

Open gioisco opened 2 years ago

gioisco commented 2 years ago

When I play the game and I want to change the language, my expected behavior was: a) descriptions in the game and the folders in other language or b) only descriptions of the game in other language

The real behavior instead is more strange

1) Start the game with ./start.sh 2) Show folders with 'ls'

[mission 1] $ ls
Castle  Forest  Garden  Mountain  Stall

3) Exit with gsh exit 4) Start the game in other language with ./start.sh -L fr 5) I don't want to start new game (I may be already complete some mission)

[giovanni@giovanni GameShell]$ ./start.sh -L fr
Le répertoire /run/media/giovanni/DATI/Projects-shared/GameShell/.config contient des méta-données provenant d'une partie précédente.
Voulez vous les supprimer et commencer une nouvelle partie ? [o/N] N

6) Show folders and...

[mission 1] $ ls
Castle  Chateau  Forest  Garden  Mountain  Stall

I have the extra folder Chateau! (because the script of the first mission create the ./Chateau/Donjon/Premier_etage/Deuxieme_etage/Haut_du_donjon/ folders)

My expected behavios was

For a) descriptions in the game and the folders in other language

1) Start the game with ./start.sh 2) Show folders with 'ls'

[mission 1] $ ls
Castle  Forest  Garden  Mountain  Stall

3) Exit with gsh exit 4) Start the game in other language with ./start.sh -L fr 5) Show message to continue or start new game 6) If the last choice was N AND the language is different from the last run (I don't know how to check this) 7) Translate all folders. This is is now possible running follow command at startup:

rm -r $GSH_HOME/*
gsh resetstatic

For b) only descriptions of the game in other language (this is more complicated)

Same as above, but in the step 7) 7) Ask if you want to translate folders (default N) 8a) If yes

rm -r $GSH_HOME/*
gsh resetstatic

8b) If no

rm -r $GSH_HOME/*

and recreate folders with previous language of last run (I don't know how to do this) However, probably the game now doesn't work with folders in other language and only my hypothesis a) is practicable.

phyver commented 2 years ago

Ah. I had started thinking about that never went through with a solution. (The resetstatic command was part of that...)

There is a way to check language, because the locale is saved in config.sh when you run GameShell the first time. There are questions I don't know how to answer like "what happens if we switch from en_US to en_GB, but they are probably not relevant for now.

Because of the way translations are handled, the only practical solution is the first one. If we detect that the language is different, we should display a warning and ask for confirmation before running resetstatic.

The reason I had stopped is that I don't want to run rm -rf $GSH_HOME/ because it contains the journal, which should probably be kept. Keeping the whole content of $GSH_CHEST and moving it into the translated chest is probably enough though.

Does anyone see any problem with that solution?

Mte90 commented 2 years ago

I don't see any issues on that, the journal is important.

phyver commented 2 years ago

Good, I'll try doing that when I have some time!