PHP Classes
elePHPant
Icontem

PHP Multilanguage Support: Retrieve texts for multiple application languages

Recommend this page to a friend!
  Info   View files Documentation   View files View files (10)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Last Updated Ratings Unique User Downloads Download Rankings
2019-12-14 (6 days ago) RSS 2.0 feedNot yet rated by the usersTotal: 2 This week: 2All time: 9,804 This week: 178Up
Version License PHP version Categories
multilangphp 1.0Custom (specified...5Localization, PHP 5
Description Author

This package can be used to retrieve texts for multiple application languages.

It can take the path of a directory to access configuration scripts with associative arrays that define the translation of application texts.

The package can support multiple languages by having different language files in sub-directories, one for each supported language.

Name: Melih Berat SANLI <contact>
Classes: 1 package by
Country: Turkey Turkey

 

Details

multilangPHP

MBS

MBS-PHP MBS-PHP MBS-PHP MBS-PHP MBS-PHP

MBS-master MBS-quality MBS-intelligence

Import the library

require_once("lib/multilang.php");

Using

> How to starting

multilang::setup();

> Set Languages Directory

multilang::set("dir", "../demo/langs/");

before mutlilang::setup();

> GET function

multilang::get($req, $return);

| $return | what is does | |--|--| | 1 | return | | 0 | echo |

| $request | what is does | output example | |--|--|--| | lang | Gives you the language selected by the user | en | | dir | Gives you the directory | ../demo/langs/ | | log | Gives the log of the library | array() | | log_last | Gives the last log the library | The current language is set tr | | dir&lang | Gives the language file directory selected by the user | ../demo/langs/tr.php |

> List the language in the defined direcory

echo multilang::listlang($returnType);

| $returnType | what is does | output | |-------------|--------------|--------| | html | Gives languages in html format | div.multilang > [a href="?lang=tr" title="language tr"]tr[/a] | | array | Gives languages in array | array('tr' => 'tr.php') |

> How to create the language file

For example, the folder with the language files: ../demo/langs/ and we create a language folder in the directory. Create LANGUAGE.php for example az.php

// '../demo/langs/az.php'

$LANG = array(); // We are creating an array called LANG

$LANG['test'] = "Bu bir testdir.";


$LANG['CALLED_NAME'] = "CONTENTS";

> How to get the text

echo multilang::lang($type);

$type is a CALLED NAME

// Example
echo multilang::lang('test'); // Output (return): Bu bir testtir.

Example Using

// index.php
require_once("lib/multilang.php");

multilang::set("dir", "langs/"); // We defined the language directory
multilang::setup(); // We starting the library

echo multilang::lang("test"); // Echo the text

print_r(multilang::get("log", 1)); // Print the log array
  Files folder image Files  
File Role Description
Files folder imagedemo (1 file, 2 directories)
Files folder imagelib (1 file)
Files folder imagetest (1 file)
Accessible without login Plain text file .travis.yml Data Auxiliary data
Accessible without login Plain text file LICENSE Lic. License text
Accessible without login Plain text file README.md Doc. Documentation
Accessible without login Plain text file _config.yml Data Auxiliary data

  Files folder image Files  /  demo  
File Role Description
Files folder imagelangs (2 files)
Files folder imagetheme (1 file)
  Accessible without login Plain text file index.php Aux. Auxiliary script

  Files folder image Files  /  demo  /  langs  
File Role Description
  Accessible without login Plain text file en.php Aux. Auxiliary script
  Accessible without login Plain text file tr.php Aux. Auxiliary script

  Files folder image Files  /  demo  /  theme  
File Role Description
  Accessible without login Plain text file style.css Data Auxiliary data

  Files folder image Files  /  lib  
File Role Description
  Plain text file multilang.php Class Class source

  Files folder image Files  /  test  
File Role Description
  Accessible without login Plain text file test.php Aux. Auxiliary script

 Version Control Unique User Downloads Download Rankings  
 100%
Total:2
This week:2
All time:9,804
This week:178Up