Skip to content

Commit

Permalink
Added i18n support.
Browse files Browse the repository at this point in the history
  • Loading branch information
kalpaitch committed Dec 23, 2016
1 parent e615bae commit 114e45e
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 1 deletion.
22 changes: 22 additions & 0 deletions i18n/fr.xliff
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?xml version="1.0"?><xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2">
<file source-language="en" datatype="plaintext" original="global" target-language="fr">
<body>
<trans-unit id="i-am-on-the-domain">
<source><![CDATA[I am on the domain ":domain"]]></source>
<target><![CDATA[Je suis sur le domaine ":domain"]]></target>
</trans-unit>
<trans-unit id="i-go-to-the-domain">
<source><![CDATA[I go to the domain ":domain"]]></source>
<target><![CDATA[Je vais sur le domaine ":domain"]]></target>
</trans-unit>
<trans-unit id="i-am-on-the-default-domain">
<source><![CDATA[I am on the default domain]]></source>
<target><![CDATA[Je suis sur le domaine par défaut]]></target>
</trans-unit>
<trans-unit id="i-go-to-the-default-domain">
<source><![CDATA[I go to the default domain]]></source>
<target><![CDATA[Je vais au domaine par défaut]]></target>
</trans-unit>
</body>
</file>
</xliff>
13 changes: 12 additions & 1 deletion src/Behat/DomainExtension/Context/DomainContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@

namespace Behat\DomainExtension\Context;

use Behat\Behat\Context\TranslatableContext;
use Behat\Behat\Hook\Scope\BeforeStepScope;
use Behat\MinkExtension\Context\RawMinkContext;

/**
* Provides pre-built step definitions for interacting with multiple domains.
*/
class DomainContext extends RawMinkContext implements DomainAwareInterface
class DomainContext extends RawMinkContext implements DomainAwareInterface, TranslatableContext
{

private $domains;
Expand Down Expand Up @@ -52,6 +53,16 @@ public function getDomainUrl()
return $this->domainUrl;
}

/**
* Returns list of definition translation resources paths
*
* @return array
*/
public static function getTranslationResources()
{
return glob(__DIR__.'/../../../../i18n/*.xliff');
}

/**
* Change the Mink Extension base url to the domain url
* to allow Mink Contexts to read our domain url.
Expand Down

0 comments on commit 114e45e

Please sign in to comment.