-1

I have this code I used for my wordpress multi language website. (currently english and french).

To make the translation of a specific part in the footer I used that code :

<?php
 /*
 $lang = (ICL_LANGUAGE_CODE == 'fr') ? 'fr' : 'en';
 $newsletter = (ICL_LANGUAGE_CODE == 'fr') ? 'Infolettre' : 'Newsletter';
 $suscribe = (ICL_LANGUAGE_CODE == 'fr') ? 'Abonnez-vous à notre infolettre' : 'Suscribe to our newsletter';
 $enter = (ICL_LANGUAGE_CODE == 'fr') ? 'Entrez votre courriel' : 'Enter your email address';
 $submit = (ICL_LANGUAGE_CODE == 'fr') ? 'S\'inscrire' : 'Submit';
*/
 $about = (ICL_LANGUAGE_CODE == 'fr') ? 'À propos' : 'About Us';
 $texte = (ICL_LANGUAGE_CODE == 'fr') ? 'text.';
?>

The thing is, now I wanna make my website trilingual. I want to make it english, french and spanish.

I'm using WPML and the 3 code abbreviation used by the plugin is 'en' 'fr' 'es'

I know I must probably use like js with if and else. But I am not enough expert to do it... Is there anyone who could help me out on this one?

I am open to completely change the code I use up till now, if you have a better way to do this.

Thanks a lot!

Aditi Parikh
  • 1,522
  • 3
  • 13
  • 34
Antoine Sp
  • 11
  • 2

1 Answers1

0

A better approach to the problem would be:

  1. Make three array of languages(english, french and spanish). This array will store value as sentences in each of respective language and key of all value should be same in all array
  2. Then allow user to choose language
  3. Display language texts as per the language chosen by user from one of the three array
Deepak Adhikari
  • 419
  • 2
  • 4