robotframework icon indicating copy to clipboard operation
robotframework copied to clipboard

Enhance BDD support (GIVEN/WHEN/THEN) for French language

Open orenault opened this issue 1 year ago • 2 comments

Hi,

According to the Gherkin Syntax, there's a lot of ways to translate the BDD keywords in French. Cf: https://cucumber.io/docs/gherkin/languages/

As an exemple, GIVEN => 16 possibilities

image

Currently, only one seems implemented in Robot Framework: 'Étant donné'

This has impacts:

  • emphasis on capital letter is not easy to type
  • this involves sometimes to midy the name of the step so that the general meaning of the sentence is correct

To resolves this, will it be possible to implements all the possibilities ? Or at least "Etant donné", "Etant donné que", "Étant donné que".

Regards

orenault avatar Jun 14 '24 10:06 orenault

Updating French localization is certainly possibly. Some questions/comments related to that:

  • Should also other BDD prefixes be updated?
  • Is this something that should be discussed with the larger French speaking Robot Framework community? There's such discussion going on within the Dutch community (#5148), but updating BDD prefixes to comply with the spec you referred to may not need much discussion. Assuming the original prefixes are preserved, this change would also be fully backwards compatible.
  • Are you willing to create a pull request with the needed updates? The class to edit is here.

pekkaklarck avatar Jul 21 '24 11:07 pekkaklarck

Each BDD prefix is already a list, so this should be easy @orenault As Pekka mentioned you can provide a PR yourself, updating those strings. You can reach out to me if you run into questions.

leeuwe avatar Aug 02 '24 08:08 leeuwe

Are you @orenault interested to implement this?

@leeuwe, should we consider updating all languages so that they match https://cucumber.io/docs/gherkin/languages/?

pekkaklarck avatar Nov 13 '24 13:11 pekkaklarck

Hi, I'm still interested to see this to be implemented. Really busy at work (and at home) these days, so can't do it myself currently. If nobody else can do, I will..

orenault avatar Nov 13 '24 13:11 orenault

Hello @orenault, je peux t'aider si tu prends le lead, je suis pas dev mais si besoin je suis dispo. Olivier (Mtp)

omn32 avatar Jan 29 '25 13:01 omn32

Hello @leeuwe, I'm not developper but if I send you the "languages.py" updated. Can you create the PULL REQUEST for the next release ?

omn32 avatar Feb 10 '25 15:02 omn32

@omn32 If you can upload it as a public file somewhere on GitHub, I can do that - sure!

leeuwe avatar Feb 10 '25 16:02 leeuwe

Hello @orenault, je peux t'aider si tu prends le lead, je suis pas dev mais si besoin je suis dispo. Olivier (Mtp)

Hello. Desolé, pas vu ce message avant. Ok, je peux faire la review puis la pr. Envoie moi le fichier par mail. C'est mon nom de user at gmail.

orenault avatar Feb 10 '25 16:02 orenault

Hello everyone, I just sent a Languages.py file to @orenault with french section updated, like this:

given_prefixes = ['Soit', 'Sachant', 'Sachant que', "Sachant qu'", 'Étant donné', 'Étant donné que', "Etant donné qu'"]
when_prefixes = ['Quand', 'Lorsque', "Lorsqu'"]
then_prefixes = ['Alors', 'Donc']
and_prefixes = ['Et', 'Et que', "Et qu'"]
but_prefixes = ['Mais', 'Mais que', "Mais qu'"]

omn32 avatar Feb 10 '25 20:02 omn32

So do I get from that that @orenault will make a PR? If so, please mention issue in the PR!

leeuwe avatar Feb 10 '25 21:02 leeuwe

So do I get from that that @orenault will make a PR? If so, please mention issue in the PR!

Yes @orenault will make the PR.

omn32 avatar Feb 10 '25 21:02 omn32

Yes, will add few values, test all, then do a PR (with omn32 credits).

orenault avatar Feb 11 '25 08:02 orenault

Hi ! Unfortunatly, I've made the change on my local installation (RF 7.1.1) and I have flaky tests.

Seems the issue is in the core, and I can't troubleshoot this.

@leeuwe Can you try on your own ?

In conf\language.py, (line 559?), just replace:

given_prefixes = ['Étant donné']

by:

given_prefixes = ['Étant donné', 'Étant donné que']

Then use this TC: Cas de test en francais [Tags] FR Étant donné NO OPERATION Étant donné que NO OPERATION

Some times all is PASS, sometimes FAIL as can't find one of the Gherkin prefix.

No keyword with name 'Étant donné que NO OPERATION' found.

(and if I add more prefix, the FAIL will be randomly on the prefix list) For me, seems a 'bug' in the core. Maybe linked with the use of accents ?

Regards Olivier

orenault avatar Feb 13 '25 16:02 orenault

Olivier, il faut pas mettre des " double ' quand tu as des apostrophe et mot clef de plus de 1 motExemple "Et que" ou "Etant qu'"

Yahoo Mail : Recherchez, organisez, maîtrisez

Le jeu., févr. 13, 2025 à 17:11, Olivier @.***> a écrit:
Hi ! Unfortunatly, I've made the change on my local installation (RF 7.1.1) and I have flaky tests.

Seems the issue is in the core, and I can't troubleshoot this.

@leeuwe Can you try on your own ?

In conf\language.py, (line 559?), just replace: given_prefixes = ['Étant donné']

by: given_prefixes = ['Étant donné', 'Étant donné que']

Then use this TC: Cas de test en francais [Tags] FR Étant donné NO OPERATION Étant donné que NO OPERATION

Some times all is PASS, sometimes FAIL as can't find one of the Gherkin prefix.

No keyword with name 'Étant donné que NO OPERATION' found.

(and if I add more prefix, the FAIL will be randomly on the prefix list) For me, seems a 'bug' in the core. Maybe linked with the use of accents ?

Regards Olivier

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.***> orenault left a comment (robotframework/robotframework#5150) Hi ! Unfortunatly, I've made the change on my local installation (RF 7.1.1) and I have flaky tests.

Seems the issue is in the core, and I can't troubleshoot this.

@leeuwe Can you try on your own ?

In conf\language.py, (line 559?), just replace: given_prefixes = ['Étant donné']

by: given_prefixes = ['Étant donné', 'Étant donné que']

Then use this TC: Cas de test en francais [Tags] FR Étant donné NO OPERATION Étant donné que NO OPERATION

Some times all is PASS, sometimes FAIL as can't find one of the Gherkin prefix.

No keyword with name 'Étant donné que NO OPERATION' found.

(and if I add more prefix, the FAIL will be randomly on the prefix list) For me, seems a 'bug' in the core. Maybe linked with the use of accents ?

Regards Olivier

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.***>

omn32 avatar Feb 13 '25 16:02 omn32

I don't think so. I must clarify: this behaviour is observed on windows, I did not tried on linux.

orenault avatar Feb 13 '25 16:02 orenault

Same behaviour on Ubuntu (WSL) & RF 7.2.2 Use language: fr & language: en at the beginning of the TC, but using only language: fr gives same results.

orenault avatar Feb 13 '25 16:02 orenault

Hi, I've made the PR to fix the bug (#5340), and to add the BDD prefix in French: given_prefixes = ['Étant donné', 'Étant donné que', "Étant donné qu'", 'Soit', 'Sachant que', "Sachant qu'", 'Sachant', 'Etant donné', 'Etant donné que', "Etant donné qu'", 'Etant donnée', 'Etant données'] when_prefixes = ['Lorsque', 'Quand', "Lorsqu'"] then_prefixes = ['Alors', 'Donc'] and_prefixes = ['Et', 'Et que', "Et qu'"] but_prefixes = ['Mais', 'Mais que', "Mais qu'"]

More 'Given' can be added later (as there is a lot of variations in French) but it should be enough to cover most of the needs (use directly Use Cases written in a TMS, to implement RF TCs directly without rewrite the Gherkin).

orenault avatar Feb 17 '25 08:02 orenault