I want to provide language support in several different languages in a php web application. There are obviously several different ways to do this. In the past I used to store a variable in a php file for every language such as en.php
for english support and fr.php
for french support. For example, for the words Good Morning
I would store it in a key $goodmorning
then define it in both files and point to one or the other file with an if statement depending on user input.
It worked great but it was a lot of work. Is there a more efficient way to do this? I thought about storing the words in a database table called language_support. The table would look as follow
id | en | fr | es |last_update
1 | hello | allo | hola | 04/12/2018
But my question is, how would I teach my program to recognize the words?