1

I have a language file in my foo add-on

<?php

$lang = array(

/* ----------------------------------------
/*  Required for MODULES page
/* ----------------------------------------*/

'foo_name'=>
'Foo',

'foo_description'=>
'Adds Foo information data in the field',

//-----------------------------------------//

/* END */
''=>''
);
?>

I got this error

Parse error: syntax error, unexpected T_VARIABLE in /home/test/public_html/system/expressionengine/third_party/foo/language/english/foo_lang.php on line 1

Any idea why this is happening? I am probably missing something obvious.

2
  • Please post the actual language file that you have. It must me some typo, like a missing comma. Feb 12, 2013 at 7:44
  • The code above is exactly what I have except for the word "Foo". I also ran it through a PHP syntax checker and it passed. Feb 12, 2013 at 7:47

2 Answers 2

0

This is probably either a problem with your text editor, or your FTP client (e.g. https://stackoverflow.com/questions/11514498/odd-unexpected-t-variable).

Try copy pasting it into a new file and saving. Make sure the file is saved with unix line endings, and NO byte order mark (BOM).

Also try running it locally, instead of on your server, to rule out problems with your FTP client (assuming you're getting the error on a server, that is).

1
  • I found out that the problem is because of incompatible carriage returns in the client and server machines Feb 15, 2013 at 9:00
0

The file should be named lang.foo.php, not foo_lang.php

4
  • I tried it and it just gave me the same error Feb 12, 2013 at 7:42
  • Do you need to uninstall and reinstall the add-on for the changes to reflect on EE? Feb 12, 2013 at 8:17
  • No, there's no need to re-install in order to 'catch' changes in language file (assuming it as installed correctly) Feb 12, 2013 at 8:22
  • 2
    Actually, addon_name_lang.php is the preferred file name. lang.addon_name.php is deprecated, but still works for backward compatibility.
    – Low
    Feb 12, 2013 at 9:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.