Skip to content

snrp/codeigniter-language-helper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commits
 
 
 
 

Repository files navigation

Language Helper

This is a very small language_helper extension that adds a $var parameter to the lang() function.

Compatibility

This will work with CodeIgniter 1.7.x and 2.0.

Installation

Copy the MY_language_helper.php file into your application/helpers folder.

Usage

In your language files you can now put variables inside your strings, prepended with a colon (:).

Example:

$lang['welcome'] = 'Hello :name, how are you? Today is :date!';

Then when you call the lang() helper function you send an array with the variable values.

Example:

<?php echo lang('welcome', array(':name' => 'Dan', ':date' => date('l'))); ?>

And this would output:

“Hello Dan, how are you? Today is Friday!”

About

A slight modification to the language helper to ease variable usage in the strings.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published