{"action":"created","issue":{"url":"https://api.github.com/repos/behave/behave/issues/357","labels_url":"https://api.github.com/repos/behave/behave/issues/357/labels{/name}","comments_url":"https://api.github.com/repos/behave/behave/issues/357/comments","events_url":"https://api.github.com/repos/behave/behave/issues/357/events","html_url":"https://github.com/behave/behave/issues/357","id":103989250,"number":357,"title":"detecting lang from step definition code","user":{"login":"yucer","id":1835059,"avatar_url":"https://avatars.githubusercontent.com/u/1835059?v=3","gravatar_id":"","url":"https://api.github.com/users/yucer","html_url":"https://github.com/yucer","followers_url":"https://api.github.com/users/yucer/followers","following_url":"https://api.github.com/users/yucer/following{/other_user}","gists_url":"https://api.github.com/users/yucer/gists{/gist_id}","starred_url":"https://api.github.com/users/yucer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yucer/subscriptions","organizations_url":"https://api.github.com/users/yucer/orgs","repos_url":"https://api.github.com/users/yucer/repos","events_url":"https://api.github.com/users/yucer/events{/privacy}","received_events_url":"https://api.github.com/users/yucer/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":8,"created_at":"2015-08-31T05:31:05Z","updated_at":"2015-09-06T10:15:58Z","closed_at":null,"body":"I am interested in forwarding some info from the parser context to the application that i am testing.\r\nSpecifically the language of the feature being executed.\r\n\r\nI was thinking in checking that in the before_feature method but I can't find the lang there.\r\n\r\nAny tip?"},"comment":{"url":"https://api.github.com/repos/behave/behave/issues/comments/138062319","html_url":"https://github.com/behave/behave/issues/357#issuecomment-138062319","issue_url":"https://api.github.com/repos/behave/behave/issues/357","id":138062319,"user":{"login":"tomekwszelaki","id":1482166,"avatar_url":"https://avatars.githubusercontent.com/u/1482166?v=3","gravatar_id":"","url":"https://api.github.com/users/tomekwszelaki","html_url":"https://github.com/tomekwszelaki","followers_url":"https://api.github.com/users/tomekwszelaki/followers","following_url":"https://api.github.com/users/tomekwszelaki/following{/other_user}","gists_url":"https://api.github.com/users/tomekwszelaki/gists{/gist_id}","starred_url":"https://api.github.com/users/tomekwszelaki/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tomekwszelaki/subscriptions","organizations_url":"https://api.github.com/users/tomekwszelaki/orgs","repos_url":"https://api.github.com/users/tomekwszelaki/repos","events_url":"https://api.github.com/users/tomekwszelaki/events{/privacy}","received_events_url":"https://api.github.com/users/tomekwszelaki/received_events","type":"User","site_admin":false},"created_at":"2015-09-06T10:15:58Z","updated_at":"2015-09-06T10:15:58Z","body":"AFAIK you can't. The `--lang` parameter is for the parser only and is used to interpret the `.feature` files themselves (before you get to the actual execution of the test). The only way (that I know of) of getting a command-line param into the test execution phase is the use of the command-line parameters defined with the `-D` switch.\r\n\r\nrunning: `behave features/de.features -Dlanguage=de_DE` will allow you to get the language like this:\r\n\r\n```\r\nfrom my_tools.lang import set_client_lang\r\ndef before_feature(ctx, feature):\r\n    lang=ctx.config.userdata[\"language\"]  # How can i get the --lang cmdline param value here ? \r\n    set_client_lang(ctx, lang)\r\n```\r\n\r\n\r\n\r\n\r\n\r\n "}}