unterminated string literal
[Break on this error] return l10nCommunity.copySuggestion(1283,'\n
CommentFileSizeAuthor
#7 l10n_literals_to_js.patch1.39 KBmeba
#3 l10n_literals.patch1.47 KBmeba

Comments

gábor hojtsy’s picture

This might even be related to http://drupal.org/node/195421 although the error report is very vague there (and it was closed being totally without feedback).

meba’s picture

Source:

return l10nCommunity.copySuggestion(1283,' <p>Tento web povoluje HTML obsah. Možná vás děsí učení se HTML, ale naučit se používat několik málo nejzákladnějších HTML "značek" je velice snadné. Tato tabulka poskytuje příklady pro každou značku povolenou na tomto webu.</p> <p>Více informací najdete ve <a href="http://www.w3.org/TR/html/">specifikaci HTML</a> u W3C nebo si najděte jiné stránky, kde je HTML vysvětleno.</p>');
meba’s picture

Status: Active » Needs review
StatusFileSize
new1.47 KB

JavaScript/AJAX don't like: quotes, newlines, carriage returns, tabs. Just escape them.

gábor hojtsy’s picture

What if we reuse the same code as used by drupal_add_js() when we add the settings strings (ie. the edit buttons for the original strings and translations)? Even if it does not have reusable parts, we might still miss something here. Better to reuse that or steal from there as it is already proven to work :)

gábor hojtsy’s picture

Meba? What do you think?

meba’s picture

Will look into this on Code Sprint...

meba’s picture

StatusFileSize
new1.39 KB

OK, found drupal_to_js().

gábor hojtsy’s picture

Status: Needs review » Fixed

Hm, I applied this patch and found a few issues:

- drupal_to_js() generates the quotes on its own, so we should not
- escaping \0 just ends up as \\0 (through drupal_to_js()'s addslashes()), which is not useful to us at all, since it should be \O (uppercase "oh" letter!)

This way it works again on my system and can copy plural suggestions to the edit field again. With your patch, due to these two errors, it did not (or in fact the first error just added the quotes into the string, the second stopped it from working).

I committed this edition of the patch: http://cvs.drupal.org/viewvc.py/drupal/contributions/modules/l10n_server...

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.