Results 1 to 2 of 2

Thread: Idea: Multilinguality

  1. #1
    Join Date
    Jan 2010
    Posts
    27

    Lightbulb Idea: Multilinguality

    While dealing with my customers language files, I came up with a nice Idea for having a language switch between the provided english language and my newly created german language (which I could provide here, when it's finished and you want me to):

    Look for
    PHP Code:
    if (! isset($_SESSION['LANG']))
     {
      require_once 
    VSHARE_DIR '/include/class.language.php';
      
    language::cookie();
     } 
    and change it to
    PHP Code:
    if(!isset($_GET['lang'])){
     if (! isset(
    $_SESSION['LANG']))
     {
      require_once 
    VSHARE_DIR '/include/class.language.php';
      
    language::cookie();
     }
    } else {
     require_once 
    VSHARE_DIR '/include/class.language.php';
     
    language::validate($_GET['lang']);

    All you need now is a link to your actual page with the addition of ?lang=nameyourfolderhere
    Seems it works for me ...

  2. #2
    Join Date
    Jan 2010
    Posts
    27

    Exclamation Forget the above

    Forget the above, there is a much more conveniant way to do it. Simply add the following to your .htaccess file:

    Code:
    RewriteRule ^lang/(.*)/ language.php?lang=$1 [L,QSA]
    after that you can change language by using the following stucture:

    Code:
    <a href=www.yoursite.com/lang/nameyourfolderhere/>name of your language</a>
    Seems I am getting deeper into it ;-)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •