I noticed that some alerts are (no longer?) translated. Example: cat-toolbar.inc is_confirmed= alert(_('There are [ '+ count +' ] item(s) attached to this record \n You must delete all items before deleting this record.')); This string doesn't get translated at all now. Also the \n is not good because it causes problems in Pootle. The only solution to make this translatable seems to be: is_confirmed= alert(_("There are [ ") + count + _(" ] item(s) attached to this record.") + "\n" + _("You must delete all items before deleting this record." By splitting it up into several part the sentence is very hard to translate. Also small pieces like "Delete" or "There are" are difficult, because you might want to use different words for it in your translation. It would be better if we can make the translation script deal with those strings and make it put in placeholders. So you would end up with: is_confirmed= alert(_('There are [ '+ count +' ] item(s) attached to this record \n You must delete all items before deleting this record.')); Output in po-file: There are [ %s ] item(s) attached to this record. ... I think this is a bug now, because those alerts don't get translated at all. Splitting them up is one solution, but fixing the translation scripts would be much better.
Created attachment 7392 [details] [review] Translate scripts now handle javascript variables inside strings. The translation scripts now convert variables into '%s' when generating or reading from .po files, and convert '%s' into variables when creating translated .tt files. This means that it should work when creating, updating, or installing a language.
What is a test plan for this? Is it necessary to edit the .po file to test?
I was testing this and noted some anomalies - namely that the javascript menus were broken after running the new translation scripts. I would have to spend some time looking at po files that were right before I could determine whether or not the script is working correctly - things looked mighty strange in there to me.
I can reproduce the problems with javascript Liz noted. This is my test plan: 1) Applied the patch 2) Ran perl translate update <langcode> on 2 languages (de-DE, it-IT) 3) Ran perl translate install <langcode) on my 2 languages 4) Turned on those languages in systempreferences 5) Checked - normal templates - javascript toolbars (example: circulation? - XSLT translation (OPAC, staff) - javascript error messages (cataloging, trying to delete record with items) Examples for found problems: - Toolbar in patron account in staff (circulation) - OPAC deatail page - item tabs and more searches
*** This bug has been marked as a duplicate of bug 12138 ***