Strings beginning with space

Re: Strings beginning with space

per Séverin Terrier -
Nombre de respostes: 6

I must admit i'm not sure if all spaces are needed, but for sure some are.

You can look at screenshots in the french discussion i pointed to better understand: the problems are not double spaces (ignored by HTML rendering) but missing spaces.

Choice has been made to integrate them in strings rather than in Moodle code, and i wonder if it's the right way of doing it, and if there are recommandations about that.

In fact, when looking at translations, some (rare) have beginning space, and most not. If you launch, from moodledata/lang folder the command grep criteria_descr_bydate */badges.php | grep "'] = ' " you'll see that de and hr languages have beginning space, but most languages not.

I just don't know if AMOS doesn't allow beginning space, or if it just don't see the difference beetween previous existing string without space and the new one with space. If it's the case, perhaps it could be possible that the language maintener modify the string, and validate it, to be able to modify it again, adding space.

Even if it's possible that way, i still wonder if it shouldn't better be directly encoded.

Séverin

En resposta a Séverin Terrier

Re: Strings beginning with space

per koen roggemans -
Imatge Language pack maintainers

It's a no brainer: there shouldn't be any leading or trailing spaces required in translation because it's too error prone.

En resposta a koen roggemans

Re: Strings beginning with space

per Nicolas Martignoni -
Imatge Language pack maintainers

I completely agree. I suggest to amend the Coding Style documentation page to clarify this and add an example under "Language strings > Structure": https://docs.moodle.org/dev/Coding_style#Language_strings.

Is there some procedure to follow (e.g. "policy" issue to open, as this is a quite official document) or can I do it directly?

En resposta a Nicolas Martignoni

Re: Strings beginning with space

per David Mudrák -
Imatge Language pack maintainers

Yes, there is a procedure - please report such a suggestion as a new MDL issue, component "Policy".

I agree it is a bad practice to design strings with trailing and heading whitespace and I believe it should be considered a bug in the original English strings.

Meanwhile, you should be able to insert strings with whitespaces into AMOS though - https://lang.moodle.org/mod/forum/discuss.php?d=5908#p6932

En resposta a David Mudrák

Re: Strings beginning with space

per Séverin Terrier -

Thanks David for (pointing to) the tip : Maintaining CTRL before clicking on text editing place to avoid AMOS filtering Somrient

Here's a command to search for english files containing trailing space (launch from Moodle dir) :

for i in `find . -type f -name '*.php' | grep 'lang/en/'`
  do grep -Hne " ';$" $i | grep string
done | sort | cut -c 3-

There are more than for begining space. I suppose my search won't find multiple lines strings...

Séverin