PHP Classes
elePHPant
Icontem

PHP Localization Library: Translate application texts using INI files

Recommend this page to a friend!
  Info   View files Example   View files View files (8)   DownloadInstall with Composer Download .zip   Reputation   Support forum (3)   Blog    
Last Updated Ratings Unique User Downloads Download Rankings
2017-02-19 (10 months ago) RSS 2.0 feedStarStarStarStar 65%Total: 215 This week: 1All time: 7,905 This week: 579Up
Version License PHP version Categories
localization 1.0.8BSD License5.4Localization, PHP 5
Description Author

This package can translate application texts using INI files.

It can determine the current page language from a given request variable or default to the first language in an array of supported language settings defined in the config.php script.

The class loads the texts for the current language from a INI file.

It also returns the application strings translated for the current language. The string may be formatted with optional parameters as defined for sprintf.

If the chosen language translations file does not exist, the class writes a new file for that language based on the default language texts.

Recommendations
  Performance   Level  
Name: Ante <contact>
Classes: 2 packages by
Country: Croatia Croatia
Age: 35
All time rank: 30315 in Croatia Croatia
Week rank: 95 Up1 in Croatia Croatia Up
Innovation award
Innovation award
Nominee: 1x

Details

PHP Localization Library

Setting it up config.php


return [
   'path'  => 'translations', // translation files directory path | translations is default
   'input' => 'language',     // url parameter | language is default
   'languages' => [           // languages, first language is default
      'en' => 'English',
      'de' => 'Deutsch',
      'it' => 'Italiano'
   ]   
];

Translating strings

 echo __('Site title'); 

 echo __('Site %s', ['title']); 

 echo Localization::instance()->translate('Site %s', ['title']); 
  Files folder image Files  
File Role Description
Files folder imagetranslations (4 files)
Plain text file config.php Aux. Auxiliary script
Plain text file index.php Example Example script
Plain text file localization.php Class Class source
Plain text file README.md Data Auxiliary data

  Files folder image Files  /  translations  
File Role Description
  Plain text file de.ini Data Auxiliary data
  Plain text file en.ini Data Auxiliary data
  HTML file index.html Data Auxiliary data
  Plain text file it.ini Data Auxiliary data

 Version Control Unique User Downloads Download Rankings  
 100%
Total:215
This week:1
All time:7,905
This week:579Up
User Ratings User Comments (1)
 All time
Utility:91%StarStarStarStarStar
Consistency:100%StarStarStarStarStarStar
Documentation:-
Examples:100%StarStarStarStarStarStar
Tests:-
Videos:-
Overall:65%StarStarStarStar
Rank:730
 
nice
10 months ago (muabshir)
80%StarStarStarStarStar