Using AMOS tool for language pack translation

Variables missing curly brackets in various strings

 
Picture of Simon Coggins
Variables missing curly brackets in various strings
by Simon Coggins - Wednesday, 29 August 2012, 6:25 AM
 

I was doing some automated checking of our language packs and I noticed there are quite a few strings that have variable references which don't have the curly brackets in the right place - i.e. $a instead of {$a}.

This was a fresh 2.2 install with various lang packs installed via moodle.org. The attached file contains all the files/strings that have errors (87 strings in total).

The command I used to find them was:

grep -Ri '$a[^-}]\|[^{]$a' *

It might be worth running this on all language packs as I only had 13 packs installed.

Simon

Ralf Krause - Moodletreff.de
Re: Variables missing curly brackets in various strings
by Ralf Krause - Wednesday, 29 August 2012, 7:22 AM
Language pack maintainers

Thanks! I did the corrections for the german language pack.

Ralf

Picture of Andrea Bicciolo
Re: Variables missing curly brackets in various strings
by Andrea Bicciolo - Wednesday, 29 August 2012, 3:18 PM
Language pack maintainers

Well spotted Simon. Updated IT lang pack on all 2.x branches.

Picture of koen roggemans
Re: Variables missing curly brackets in various strings
by koen roggemans - Wednesday, 29 August 2012, 5:01 PM
Language pack maintainers

Thanks a lot Simon. Fixed in Dutch

Picture of David Mudrák
Re: Variables missing curly brackets in various strings
by David Mudrák - Wednesday, 29 August 2012, 5:28 PM
Language pack maintainers

Very useful hint! Note that a similar regex can be used in AMOS translator's filter directly, too. Just select a single version, select all standard components and in the "substring" field, type

\$a[^-}]|[^{]\$a

and check the "regex" checkbox.

Picture of German Valero
Re: Variables missing curly brackets in various strings
by German Valero - Thursday, 30 August 2012, 1:03 AM
Language pack maintainers

Thanks for a very useful hint .

But the two strings I found in the 2.0 branch seem to be wrong in the original english language:

2.0 [gradeforstudent,core_grades]

{$a->student}<br />{$a->item}$a->feedback
 
2.0 [hexanotallowed,qtype_calculated]
Dataset <strong>{$a->name}</strong> hexadecimal format value $a->value is not allowed

Does it mean that David Mudrák might have to have those strings updated? or did I just misinterpreted the syntax spelling (I am just a veterinarian, not an engeneer).

Picture of David Mudrák
Re: Variables missing curly brackets in various strings
by David Mudrák - Thursday, 30 August 2012, 2:35 AM
Language pack maintainers
Correct. Moodle 2.0 contains these two bugs. They were fixed in MDL-27200 for 2.1 and higher. In your 2.0 language packs, you can fix the missing brackets if you prefer.
Picture of German Valero
Re: Variables missing curly brackets in various strings
by German Valero - Sunday, 23 March 2014, 7:16 AM
Language pack maintainers

Hi,

I just did an "AMOS translator's filter directly, too. Just selected a single version (2.6), selected all standard components and in the "substring" field, typed

\$a[^-}]|[^{]\$a

and check the "regex" checkbox."

 

... and found a few missing curly brackets in my language pack sad

Would the other translators kindly see if they also have missing curly brackets ?

TIA

Picture of koen roggemans
Re: Variables missing curly brackets in various strings
by koen roggemans - Sunday, 23 March 2014, 4:42 PM
Language pack maintainers

Thanks for this - I found one in Dutch: editverbose,core_grades, which was originally wrong in English and I marked it as up to date after it was fixed - probably didn't notice the change...

Seems like a good thing to check before a release or so...

Nicolas
Re: Variables missing curly brackets in various strings
by Nicolas Martignoni - Sunday, 23 March 2014, 8:38 PM
Language pack maintainers

Just did the check for french, any 2.x version.

The english lang pack for 2.0 contains 2 strings with missing curly brackets around vars:

  • gradeforstudent (core_grades)
  • hexanotallowed (qtype_calculated)

Nicolas

Nicolas
Re: Variables missing curly brackets in various strings
by Nicolas Martignoni - Thursday, 30 August 2012, 3:33 AM
Language pack maintainers

Thanks Simon and David,

I made all the necessary corrections in french too: 4 strings were bogus, somes only in 2.0 smile