Better laguage path location

Some frameworks, like Zend Framework 2, uses '''chdir(__DIR__)''' to make everything relative to the application root.

This fix is to improve and reduce the need to rewrite the folders path on the application
This commit is contained in:
Stephan de Souza 2014-03-28 14:40:57 -03:00
parent 23eb748aa5
commit efd2b91d03
1 changed files with 5 additions and 1 deletions

View File

@ -1354,7 +1354,7 @@ class PHPMailer
* @return bool
* @access public
*/
public function setLanguage($langcode = 'en', $lang_path = 'language/')
public function setLanguage($langcode = 'en', $lang_path = null)
{
//Define full set of translatable strings
$PHPMAILER_LANG = array(
@ -1377,6 +1377,10 @@ class PHPMailer
'smtp_error' => 'SMTP server error: ',
'variable_set' => 'Cannot set or reset variable: '
);
//Load the language path from absolute position
if(!$lang_path) {
$lang_path = __DIR__ . '/language/';
}
//Overwrite language-specific strings.
//This way we'll never have missing translations - no more "language string failed to load"!
$l = true;