Search

In 2.0.7, all file upload fields show a link called “undefined” instead of “remove”. I think this has to do with JavaScript localization functions, but I am not sure.

Any idea? Is there a patch?

I think it has to do with this patch: http://github.com/symphony/symphony-2/commit/1c63ccf8ebb42510e7af1bbfd76dac9933e9f38d

Could you try the solution posted in the comments?

Well. Now I have no “delete” link at all.

Damn. Do you have any JavaScript errors?

This is what I have:

  • w/o the patch: “undefined”
  • w/ the patch: “undefined”
  • comments solution instead of patch: no link at all

Sorry, you were faster than me.

Have to start Firefox…

This is what I see:

GET http://www.fastaudio.com/symphony/ajax/translate?Add+item=false&Remove+item=false   
...
{"Add_item":"Add item","Remove_item":"Remove item"}

One day I will have to learn how to use this damned Firebug thing…

Above was with the Alistair’s patch.

And this is with your solution:

a is undefined
[Break on this error] isEmptyObject:function(a){for(var b in...,i=a.length,j=i===w||c.isFunction(a); 

That’s just saying that translations have been loaded.

What’s your system default language?

It’s English.

You can even see this problem with a default installation of Symphony. Just add one image to an article.

The last error seems to be the same as here http://getsymphony.com/discuss/issues/view/233/.

Sorry. I have to leave the keyboard now.

I am back at the keyboard, rather tired now. But I have noticed that there seems to be a more general JavaScript issue in S 2.0.7. One example: Disabling an extension pops up an alert with a “null” message.

I am afraid that one of those last minute changes has broken something…

OK, what about this: In line 29 you perform a simple check:

if(Symphony.Language.DICTIONARY[search] === false) {

But: Symphony.Language.DICTIONARY[search] won’t return false, but undefined. It works for me if I replace line 29 by:

if(Symphony.Language.DICTIONARY[search] === undefined) {

I guess this is it. It even solves the other issue I noticed (when uninstalling extensions).

That doesn’t make sense at all: Each string added to the language dictionary is explicitly set to false. When the system language is set to English the dictionary should not be translated.

But, here we go, we have symphony.duplicator.js which adds two strings:

{
    "Add_item": "Add item",
    "Remove_item": "Remove item"
}

So, with English as system language, you now have a dictionary which has all strings set to false besides these two. There are two cases:

  1. The get function tries to translate a string that is set to false. In this case it should stop at if(Symphony.Language.DICTIONARY[search] === false) and just return the given string, e. g. Remove selected items.
  2. The get function tries to translate a string that has value, e. g. Add item. In this case the function should pass the if clause as Symphony.Language.DICTIONARY['Add_item'] is not false. It will then get the string value (Add item) should skip the token part as these are not defined and return the new string.

As this does not work for you, there must be a logical error. But where is this error.

The problem is: I’ve got two installs with Symphony 2.0.7 which both work as they should using either English or German as default language. It’s even working without the if (!string) return null; fix.

Are you using a Windows PC or a Mac? Which browser are you using?

It’s working correctly for me using Safari and Firefox on Mac OS 10.6.2.

In your console could you please type Symphony.Language.DICTIONARY + Enter and post the result? Thanks.

Michael, I’m off to work now but maybe you could send me an email with a list of your extensions and a copy of your admin.js (maybe something is missing in the main repository). I’ll have a look at it tonight.

One thing would be interesting: If you install the German language package and switch languages, does it work then?

It’s working correctly for me using Safari and Firefox on Mac OS 10.6.2.

Same setup here, except “working correctly”.

If you install the German language package and switch languages, does it work then?

Of course I have tested this yesterday! Yes, it works.

Next try: I did some “old-school” debugging using alert statements in admin.js.

We are looking for ‘Remove File’ which is defined as false. But in line 27 you do a grep replace:

var search = string.replace(/ /gi, '_');

which returns ‘Remove_File’. And so Symphony.Language.DICTIONARY[search] (in line 29) is not false, but undefined. (‘Remove_File’ is not defined at all, not even false.)

What exactly is line 27 supposed to do? I don’t get it. If I replace it by:

var search = string;

everything seems to work as intended.

Michael found the real bug: There was a mismatch between how the default English strings and how translated strings have been stored in Symphony.Language.DICTIONARY.

You can find the fix here: http://github.com/nilshoerrmann/symphony-2/commit/cb44bec3eb33a46e2d1bcb96759531f87eaf1e5c

Create an account or sign in to comment.

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.3-5.6 or 7.0-7.3
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.5 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details