Multi language php script

前端 未结 4 1662
死守一世寂寞
死守一世寂寞 2021-02-01 11:52

How to create multi language main menu in html/php script now i have

  • {t t=\"Let
  • 4条回答
    •  隐瞒了意图╮
      2021-02-01 12:16

      My Approach would be to do the following:

      Step 1: Setup a folder tree structure like this:

      Languages
       -en
         -lang.en.php
       -fr
         -lang.fr.php
       -de
         -lang.de.php
      

      keep making new folders with all the other languages you want to support

      Step 2: Create our language files, i will start with languages/en/lang.en.php

      
      

      you would repeat this for every other language, ill do fr for example languages/fr/lang.fr.php . NOTE how the labels stay the same in english

      
      

      Step 3: Check if the user has requested a language change, via a url variable

      
      

      Step 4: you can access your language parts like so and it would change based on what language file is loaded.

      
      

      hope this helps get you started as an idea

    提交回复
    热议问题