Last active
April 8, 2018 02:24
-
-
Save croxton/6594349 to your computer and use it in GitHub Desktop.
Loading a specific language file for a 3rd party add-on module
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); | |
class My_module { | |
protected $class_name; | |
function __construct() | |
{ | |
$this->class_name = strtolower(__CLASS__); | |
// load a specific language file determined by a tag paramater, e.g. language="French" | |
if ($language = ee()->TMPL->fetch_param('language')) | |
{ | |
ee()->lang->load( | |
$this->class_name, | |
strtolower($language), | |
FALSE, | |
TRUE, | |
PATH_THIRD . $this->class_name . '/', | |
TRUE | |
); | |
} | |
else | |
{ | |
ee()->lang->loadfile($this->class_name); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks!