Skip to content

Instantly share code, notes, and snippets.

@croxton
Last active April 8, 2018 02:24
Show Gist options
  • Save croxton/6594349 to your computer and use it in GitHub Desktop.
Save croxton/6594349 to your computer and use it in GitHub Desktop.
Loading a specific language file for a 3rd party add-on module
<?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);
}
}
}
@sjelfull
Copy link

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment