PHP Classes
elePHPant
Icontem

PHP Multilang: Get translated application texts for languages

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Info   View files Example   Videos Videos   View files View files (7)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Last Updated Ratings Unique User Downloads Download Rankings  
2014-06-11 (1 year ago) RSS 2.0 feedNot enough user ratingsTotal: 508 This week: 1All time: 5,350 This week: 1,131Up
Version License PHP version Categories  
multilang 1.0.0GNU Free Document...3.0Localization, PHP 5
Description Author  

This class can get translated application texts for different languages.

It can parse a file and extract texts for application strings in different languages.

The class can return text for named strings for the currently selected language.

Picture of Jake Bown
Name: Jake Bown <contact>
Classes: 2 packages by
Country: United Kingdom United Kingdom
Age: 22
All time rank: 2889129 in United Kingdom United Kingdom
Week rank: 891 Up37 in United Kingdom United Kingdom Up

Details provided by the author  

Simple PHP Multi-Language

Simple PHP Multi-Language is a dead simply way of translating your projects without using a database.

Why did I make this?

After working on a number of projects that needed translating into both French and German from English, the handover and translation process took extremely long and often became confusing, especially when the english version we're tweaked and other languages needed updating again (terrible for revising).

How does it work?

Simply by including the multilang class in your projects, you can quickly plug a translation file into your project and get busy being multilingual.

The translate file is set out exactly the same as a CSS file, for simplicity, each country is differenciated by its language prefix/code (DE, FR, EN) and can be set a number of different ways (see examples).

@welcome_message {
	
}

How to translate

All you need to do is edit the "translate.lang" file and start creating language ID's, this is done by naming each ID starting with "@". You then simply add the languages you wish to support by adding the prefix:

@welcome_message {
	en: "hello";
	fr: "bonjour";
}

and echo it out in php by using the "say" function:

<?=$var->say("welcome_message");?>

You can add as many translation as you wish to your translations ID's.

Updates

Please let me know your thoughts and suggestions to make PHP-Multilang better for everyone!

Videos  
  • Multilang Demo: Simple Translation
  Files folder image Files  
File Role Description
Accessible without login Plain text file Example-1.php Example Example #1
Accessible without login Plain text file Example-2.php Example Example #2
Accessible without login Plain text file Example-Render.php Example Render with handlebars
Accessible without login Plain text file example_include_me.html Data Needed for the render demo
Plain text file multilang.php Class Multilang Class
Accessible without login Plain text file README.md Doc. Readme
Accessible without login Plain text file translate.lang Data Main translation file

 Version Control Unique User Downloads Download Rankings  
 0%Total:508All time:5,350
 This week:1This week:1,131Up