Behat / MinkExtension

Mink extension (tight integration and configuration) for Behat
MIT License
636 stars 278 forks source link

How use pt-br language? #254

Open andrebandeira opened 8 years ago

andrebandeira commented 8 years ago

Please, How do I use the pt-br language ?

If I put the feature as below does not work:

language: pt

Funcionalidade: Pesquisa no google

Cenário: Pesquisando por "UTFPR" Dado Eu vou à "https://www.google.com.br/" Quando Eu preencho o campo "lst-ib" com "UTFPR" E Eu pressiono o botão "Pesquisar" E Eu espero "4" segundos Então Eu devo ver o texto "A Universidade Tecnológica Federal do Paraná é uma universidade pública mantida pelo governo federal e sua sede esta localizada na cidade de Curitiba, capital do estado brasileiro do Paraná. Wikipédia"

Thank you for any help

leoqbc commented 8 years ago

@andrebandeira

Have you tried to put "# language: pt" on top? you're not using: "#"

andrebandeira commented 8 years ago

Yes, I'm using the '#'. I pasted it wrong in the first comment. In fact, my code looks like this:

language: pt

Funcionalidade: Pesquisa no google

Cenário: Pesquisando por "UTFPR" Dado Eu vou à "https://www.google.com.br/" Quando Eu preencho o campo "lst-ib" com "UTFPR" E Eu pressiono o botão "Pesquisar" E Eu espero "4" segundos Então Eu devo ver o texto "A Universidade Tecnológica Federal do Paraná é uma universidade pública mantida pelo governo federal e sua sede esta localizada na cidade de Curitiba, capital do estado brasileiro do Paraná. Wikipédia"

The problem is that the mink understand how I was using PT Portugal and not of Brazil, so it uses the file "pt.xliff". I wanted him to use the file "pt-br.xliff". A workarround I found was to rename the file "pt-br" for "pt", but I wonder if there is a correct way to use "en-us".

leoqbc commented 8 years ago

Hi @andrebandeira,

I think there's no official Gherkins "pt-br", but there is: Behat and Mink "pt-br" output translation, you can setup your configuration inside of behat.yaml like this:

default:
   translation:
      locale: pt-br

Mink will follow Behat translation, but your Gherkin should have "# language: pt", because Behat get the translations automatically generated from cucumber/gherkin repo, and the portuguese Brazil base words are the same(in my opinion), maybe that's why there's no "pt-br" translation.

Here's the config file from Behat Gherkin repo:

https://github.com/Behat/Gherkin/blob/master/i18n.php

You can send changes for:

https://raw.github.com/cucumber/gherkin/master/gherkin-languages.json

Hope it helps you

andrebandeira commented 8 years ago

Hi @leoqbc,

Thanks a lot for the help,

My behat.yaml looks like this:

default: translation: locale: pt-br extensions: Behat\MinkExtension: browser_name: 'chrome' selenium2: capabilities: { "browserName": "chrome", "browser": "chrome", "version": "29", 'chrome': {'switches':['--no-sandbox']}}

But not working, what am I doing wrong?