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.

  • Please post the actual language file that you have. It must me some typo, like a missing comma. – Yuri Salimovskiy Feb 12 '13 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. – developarvin Feb 12 '13 at 7:47
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).

| improve this answer | |
  • I found out that the problem is because of incompatible carriage returns in the client and server machines – developarvin Feb 15 '13 at 9:00
0

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

| improve this answer | |
  • I tried it and it just gave me the same error – developarvin Feb 12 '13 at 7:42
  • Do you need to uninstall and reinstall the add-on for the changes to reflect on EE? – developarvin Feb 12 '13 at 8:17
  • No, there's no need to re-install in order to 'catch' changes in language file (assuming it as installed correctly) – Yuri Salimovskiy Feb 12 '13 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 '13 at 9:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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