PHP Classes

PHP Language Change: Change application language using arrays of text

Recommend this page to a friend!
  Info   View files Example   View files View files (6)   DownloadInstall with Composer Download .zip   Reputation   Support forum (1)   Blog    
Ratings Unique User Downloads Download Rankings
Not enough user ratingsTotal: 97 All time: 9,834 This week: 560Up
Version License PHP version Categories
language-change 1.0Freeware5Localization, PHP 5


This is a simple class that can change application language using arrays of text.

It can check if a cookie is set to determine the current language to be used for the texts in a site. If the cookie is not set, the class redirects the current request to access a script that sets the language cookie.

When the language cookie is set the class can load a script that defines an array with texts for the application to use in the language that was set.

In Spanish:

Este script puede cambiar el idioma de algunas palabras de tu pagina en tomando como parametro el valor de una cookie. Devuelve un array con las palabras en el idioma preferido.

Picture of Dannel
  Performance   Level  
Name: Dannel <contact>
Classes: 9 packages by
Country: Cuba Cuba
Age: 30
All time rank: 30488 in Cuba Cuba
Week rank: 298 Up3 in Cuba Cuba Up
Innovation award
Innovation award
Nominee: 5x


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"

<html xmlns="">

    text-decoration: none;
    color: white;
    top: 0;
    left: 0;
    position: fixed;
    width: 100%;
    background-color: #666666;
    color: white;
    display: inline-block;
     text-align: center;
     font-size: 2em;
     display: inline;
     margin: 5px;
     background-color: #8D8D8D;
     cursor: pointer;


<?php include 'src/langclass.php'; $obj= new lang;?>

<span class="menu">

<span class="option">
<span class="option">
<?php if($_COOKIE['lang']=='esp'){$l='eng';}else{$l='esp';} ?>
<a href="language.change.php?lang=<?=$l?>"><?=$obj->setLang()['lang']?></a>
<span class="option">
<a><?=$obj->setLang()['edit']?> </a>
<span class="option">
<span class="option">
<h2 align="center"><?=$obj->setLang()['welcome']?></h2>
        <p style="padding-top:110px;">The rest of the page. . .</p>


  Files folder image Files  
File Role Description
Files folder imagesrc (3 files)
Accessible without login Plain text file example.php Example Main example
Accessible without login Plain text file language.change.php Aux. Lang script to change cookie
Accessible without login Plain text file language.set.php Aux. Lang script to set the cookie

  Files folder image Files  /  src  
File Role Description
  Accessible without login Plain text file arrayeng.php Conf. Array include
  Accessible without login Plain text file arrayesp.php Conf. Array include
  Plain text file langclass.php Class Class

 Version Control Unique User Downloads Download Rankings  
This week:0
All time:9,834
This week:560Up
User Comments (1)
sorry but is no longer abel now.
4 years ago (Viktor)