I’m not fluent with translating websites, but I know it’s not an exact science for automating the process. Google Translate is free. You may find this page useful in adding the JavaScript to automatically translate content within your story.
→ https://www.geeksforgeeks.org/add-google-translate-button-webpage/
You previously asked about saving the state of the story between sessions. Did you make any progress with that? Because that is how you will save the $language
variable.
Get that working first and then you can figure out a strategy for displaying multiple languages in your story. Off the top of my head, I believe having each passage store both a French and English version of it’s own content, already translated, might be the most effective strategy.