all the text have to be stored in a file, in a array or constants or whatever, and then replace all the texts in the website with that variables, so then you just have to switch between english/spanish.php file to change the language (spanish with strings in spanish and same with english), then you can set a cookie as a config to store what language did they choose