Variables missing curly brackets in various strings

Variables missing curly brackets in various strings

ដោយ Simon Coggins នៅ
ចំនួនតប៖ 10

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

ឆ្លើយតបទៅកាន់ Simon Coggins

Re: Variables missing curly brackets in various strings

ដោយ David Mudrák នៅ
រូបភាព 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.

ឆ្លើយតបទៅកាន់ David Mudrák

Re: Variables missing curly brackets in various strings

ដោយ German Valero នៅ
រូបភាព 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).

ឆ្លើយតបទៅកាន់ German Valero

Re: Variables missing curly brackets in various strings

ដោយ David Mudrák នៅ
រូបភាព 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.
ឆ្លើយតបទៅកាន់ David Mudrák

Re: Variables missing curly brackets in various strings

ដោយ German Valero នៅ
រូបភាព 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 ក្រៀមក្រំ

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

TIA

ឆ្លើយតបទៅកាន់ German Valero

Re: Variables missing curly brackets in various strings

ដោយ koen roggemans នៅ
រូបភាព 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...

ឆ្លើយតបទៅកាន់ German Valero

Re: Variables missing curly brackets in various strings

ដោយ Nicolas Martignoni នៅ
រូបភាព 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

ឆ្លើយតបទៅកាន់ Simon Coggins

Re: Variables missing curly brackets in various strings

ដោយ Nicolas Martignoni នៅ
រូបភាព 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 ញញឹម