PHP Classes

Multiple Language Script without Database: Get application language texts from files

Recommend this page to a friend!
  Info   View files Example   View files View files (5)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not enough user ratingsTotal: 257 All time: 7,819 This week: 102Up
Version License PHP version Categories
multilanguage-script 1.0Freeware5.0Localization, PHP 5
Description 

Author

This class can get application language texts from files.

It can get the current user preferred language from session, GET or POST variables.

The class loads a text file with application texts from a file which contains the text for each application text string in different languages.

The class returns a given application text in a given supported language.

Currently it supports English, Spanish and French languages.

The class can also add new application texts to the translations file.

Recommendations
Picture of Bharat Parmar
  Performance   Level  
Name: Bharat Parmar <contact>
Classes: 11 packages by
Country: India India
Age: 32
All time rank: 52230 in India India
Week rank: 198 Up18 in India India Up
Innovation award
Innovation award
Nominee: 3x

Example

<?php
@session_start();
@include(
"MultiLanguage.class.php");
$Main = new MultiLanguage();
?>
<html>
<meta charset="UTF-8">
<title>Example Script</title>
<body>
    <b>Change Language : </b>
        <a href="?language=english">English</a> &nbsp;&nbsp;&nbsp;
        <a href="?language=spanish">Spanish</a> &nbsp;&nbsp;&nbsp;
        <a href="?language=french">French</a> &nbsp;&nbsp;&nbsp;
        <hr>
    <table border="1" width="50%">
        <caption>Default Language Demo</caption>
        <tr>
            <th><?php echo ucfirst($_SESSION['language']);?></th>
        </tr>
        <tr>
            <td><?php $Main->LanguageString("Hello");?></td>
        </tr>
        <tr>
            <td><?php $Main->LanguageString("Bye");?></td>
        </tr>
        <tr>
            <td><?php $Main->LanguageString("Thank You");?></td>
        </tr>
    </table>
    <table border="1" width="50%">
        <caption>Different Languages Demo</caption>
        <tr>
            <th>English</th>
            <th>Spanish</th>
            <th>French</th>
        </tr>
        <tr>
            <td><?php $Main->LanguageString("Hello","english");?></td>
            <td><?php $Main->LanguageString("Hello","spanish");?></td>
            <td><?php $Main->LanguageString("Hello","french");?></td>
        </tr>
        <tr>
            <td><?php $Main->LanguageString("Bye","english");?></td>
            <td><?php $Main->LanguageString("Bye","spanish");?></td>
            <td><?php $Main->LanguageString("Bye","french");?></td>
        </tr>
        <tr>
            <td><?php $Main->LanguageString("Thank You","english");?></td>
            <td><?php $Main->LanguageString("Thank You","spanish");?></td>
            <td><?php $Main->LanguageString("Thank You","french");?></td>
        </tr>
    </table>
</body>
</html>



  Files folder image Files  
File Role Description
Accessible without login Plain text file addphrase.php Example You can Add and Edit the Language Phases as per requirement
Accessible without login Plain text file index.php Example Demo script to use the class and display string in multiple language
Accessible without login Plain text file language.txt Data all the language strings will be stored here.
Plain text file MultiLanguage.class.php Class Class file which includes all the methods to use the script. Very sort and simple code
Accessible without login Plain text file README.txt Doc. Documentation file for the script.

 Version Control Unique User Downloads Download Rankings  
 0%
Total:257
This week:0
All time:7,819
This week:102Up