New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support to translations to codeceptjs #189

Merged
merged 7 commits into from Aug 7, 2016

Conversation

Projects
None yet
4 participants
@abner
Contributor

abner commented Aug 5, 2016

Added feature to allow define translations to the helpers actions and also to the default Iactor.

Added a folder translations where contributors would add translations for their own languagues.

The feature actually works like this: In your concept.json file you add a translation key with some of the name of a supported language or you can also point to a file in your project path.

Example

{
  "tests": "./e2e/features/*.js",
  "timeout": 10000,
  "output": "./e2e/outputs",
  "translation": "pt-BR",
  "helpers": {
    "Protractor": {
      "url": "http://localhost:3000/",
      "host": "127.0.0.1",
      "port": 4444,
      "browser": "phantomjs",
      "rootElement": "body"
    }
  },

  "bootstrap": false,
  "mocha": {},
  "name": "my-project"
}

Using this will allow to write your steps in portuguese:

Feature('Acesso a tela de Login');

Scenario('Testar se a tela de login está acessível', (Eu) => {
    Eu.naoEstouEmAplicacaoAngular();
    Eu.estouNaPagina('http://localhost:3000/')
    Eu.vejo('My App');
});

And the report to codeceptjs run --steps will show

Acesso a tela de Login --
Testar se a tela de login está acessível
• Eu nao estou em aplicacao angular
• Eu estou na pagina "http://localhost:3000/"
• Eu vejo "My App"
✓ OK in 413ms

OK | 1 passed // 462ms

@@ -0,0 +1,56 @@
module.exports = {

This comment has been minimized.

@mfdeveloper

mfdeveloper Aug 5, 2016

Suggestion: The explicit call to module.exports is really necessary? I think that the translation file needs be a plain .json file instead a .js file

@mfdeveloper

mfdeveloper Aug 5, 2016

Suggestion: The explicit call to module.exports is really necessary? I think that the translation file needs be a plain .json file instead a .js file

This comment has been minimized.

@DavertMik

DavertMik Aug 7, 2016

Member

Looks reasonable to me to have it as .json but I don't see if it is necessary

@DavertMik

DavertMik Aug 7, 2016

Member

Looks reasonable to me to have it as .json but I don't see if it is necessary

@mfdeveloper

This comment has been minimized.

Show comment
Hide comment
@mfdeveloper

mfdeveloper Aug 5, 2016

Awesome @abner !! This is a amazing feature :)

mfdeveloper commented Aug 5, 2016

Awesome @abner !! This is a amazing feature :)

@DavertMik

This comment has been minimized.

Show comment
Hide comment
@DavertMik

DavertMik Aug 7, 2016

Member

Wow! Really cool.

Member

DavertMik commented Aug 7, 2016

Wow! Really cool.

@DavertMik DavertMik merged commit e2f818e into Codeception:master Aug 7, 2016

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
@DavertMik

This comment has been minimized.

Show comment
Hide comment
@DavertMik

DavertMik Aug 7, 2016

Member

Thank you. I will play a bit with that

Member

DavertMik commented Aug 7, 2016

Thank you. I will play a bit with that

@DavertMik

This comment has been minimized.

Show comment
Hide comment
@DavertMik

DavertMik Aug 8, 2016

Member

I have done some refactoring there #194
The next thing we should think about is to use localized Scenario/Before/Feature function names.
Also the question is about documentation. Ideally we should translate function references, in reality it will be pretty hard to do, so probably just add method aliases into the Helper references.

Member

DavertMik commented Aug 8, 2016

I have done some refactoring there #194
The next thing we should think about is to use localized Scenario/Before/Feature function names.
Also the question is about documentation. Ideally we should translate function references, in reality it will be pretty hard to do, so probably just add method aliases into the Helper references.

@DavertMik

This comment has been minimized.

Show comment
Hide comment
@DavertMik

DavertMik Aug 9, 2016

Member

Ok, I have written small reference on using translations: http://codecept.io/reports/
@abner could you help me a bit and add some Portuguese examples to https://github.com/Codeception/CodeceptJS/blob/master/docs/translation.md ?

Thanks!

Member

DavertMik commented Aug 9, 2016

Ok, I have written small reference on using translations: http://codecept.io/reports/
@abner could you help me a bit and add some Portuguese examples to https://github.com/Codeception/CodeceptJS/blob/master/docs/translation.md ?

Thanks!

@DavertMik

This comment has been minimized.

Show comment
Hide comment
Member

DavertMik commented Feb 15, 2018

@sacuribraimo

This comment has been minimized.

Show comment
Hide comment
@sacuribraimo

sacuribraimo May 24, 2018

Hi,
Is there a way to localize the messages used in I.see('My App') to a message file where there is translation to 'Minha App'?

sacuribraimo commented May 24, 2018

Hi,
Is there a way to localize the messages used in I.see('My App') to a message file where there is translation to 'Minha App'?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment