PHPackages                             kolev/multilingual-extension - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Testing &amp; Quality](/categories/testing)
4. /
5. kolev/multilingual-extension

ActiveBehat-extension[Testing &amp; Quality](/categories/testing)

kolev/multilingual-extension
============================

Behat extension for testing multilingual sites

0.0.8(1y ago)713.0k4[1 PRs](https://github.com/toni-kolev/MultilingualExtension/pulls)MITPHP

Since Jul 8Pushed 1y ago2 watchersCompare

[ Source](https://github.com/toni-kolev/MultilingualExtension)[ Packagist](https://packagist.org/packages/kolev/multilingual-extension)[ RSS](/packages/kolev-multilingual-extension/feed)WikiDiscussions master Synced 3w ago

READMEChangelog (8)Dependencies (2)Versions (12)Used By (0)

Behat MutlilingualExtension
===========================

[](#behat-mutlilingualextension)

### Write tests once, test on multiple languages

[](#write-tests-once-test-on-multiple-languages)

Behat extension to help you do less work when you have multilanguage environment.

MultilingualExtension is a Behat extension designed to ease the work with multilingual sites. English language is used as a base and translations for each string are stored in a user defined file. The main idea is to write your tests in English language and then run them against sites with different language than English. The website language is defined in YML profile.

Note that it is in very early version so some features may not work properly.

[![Latest Stable Version](https://camo.githubusercontent.com/e1b27f838cbdf503df433e0b7f8acc1222e848e057f6e143a2395779ecbad606/68747470733a2f2f706f7365722e707567782e6f72672f6b6f6c65762f6d756c74696c696e6775616c2d657874656e73696f6e2f762f737461626c65)](https://packagist.org/packages/kolev/multilingual-extension)[![License](https://camo.githubusercontent.com/eda470bb0db228717fe98c330092bf23845ab44a0e2da81090b0f82ba5f5430f/68747470733a2f2f706f7365722e707567782e6f72672f6b6f6c65762f6d756c74696c696e6775616c2d657874656e73696f6e2f6c6963656e7365)](https://packagist.org/packages/kolev/multilingual-extension)[![Coverage Status](https://camo.githubusercontent.com/8787d20bddbe80c3b52512a8b580778ca9a7ed10cf4cf9fe72c7d77a4830778d/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f62794b6f6c65762f4d756c74696c696e6775616c457874656e73696f6e2f6261646765732f6275696c642e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/byKolev/MultilingualExtension/build-status/master)[![Quality Score](https://camo.githubusercontent.com/4e37a6963338db8b2395cbbd34286ab7845f22dce3e4e1e5eb537a8bfcb00ee9/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f62794b6f6c65762f4d756c74696c696e6775616c457874656e73696f6e2e7376673f7374796c653d666c6174)](https://scrutinizer-ci.com/g/byKolev/MultilingualExtension)[![Build Status](https://camo.githubusercontent.com/61bb84f4bb1bb7f661385b5cf2ecdd2aa979a1f49682009ed3b984a06bc4e4b7/68747470733a2f2f7472617669732d63692e6f72672f746f6e692d6b6f6c65762f4d756c74696c696e6775616c457874656e73696f6e2e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/toni-kolev/MultilingualExtension)[![Total Downloads](https://camo.githubusercontent.com/0771919b5112a588453042a0cc094b851c45c23241c95e6efcaf36312d50b427/68747470733a2f2f706f7365722e707567782e6f72672f6b6f6c65762f6d756c74696c696e6775616c2d657874656e73696f6e2f646f776e6c6f616473)](https://packagist.org/packages/kolev/multilingual-extension)

Installation
------------

[](#installation)

- `curl -sS https://getcomposer.org/installer | php`
- `vim composer.json`

```
{
  "require": {
    "kolev/multilingual-extension": "dev-master"
  },
  "config": {
    "bin-dir": "bin"
  }
}

```

- `composer install`

Usage
-----

[](#usage)

MultilingualExtension is easy to use. First you need to add the extension to your profile in `behat.yml` configuration file.

```
german_profile:
  suites:
    default:
      contexts: {}
  extensions:
    Behat\MinkExtension:
      files_path: %paths.base%/files
    kolev\MultilingualExtension:
      default_language: de
      translations: translations.yml

```

The `default_language` variable is used to define the website's default language. The `translations` variable is used to define the path to the translations file. The path is relative to the `files_path` variable. So in this case the `translations.yml` file should be placed in `/files` folder.

The `translations.yml` file structure is easy to read too.

```
"carrot":
  de: "karrote"
  fr: "carrote"
"cabbage":
  de: "kohl"
  fr: "chou"

```

The user can list as many words as he/she wants. Also many different languages for each word can be added.

It is important to use the same language prefix in `translations.yml` file and when configuring the profile. For example define site's language as `de` and add translations with `de`.

Then it's time to write your test porperly in order to use the localized version of the string. For example:

```
Feature: Multilingual Extension example feature

  Scenario: Example of a Scenario for testing multilingual extension
    Given I go to "/"
    And I should see localized "carrot"

```

In this case if your run the test with `german_profile` it will open the homepage and look for `de` version of the word `carrot` which in our case is `karrote`.

FAQ
---

[](#faq)

#### What if I have more than one language installed?

[](#what-if-i-have-more-than-one-language-installed)

Language detection based on URL is introduced with version `0.0.2`. The extension tries to detect site's language based on URL. For example if you go to page  it will look for German translation of the string, if no language code found it will use the `default_language`. It works for both clean and non-clean URLs.

#### What are the availabe languages supported?

[](#what-are-the-availabe-languages-supported)

List of all languages ISO codes can be found [here](docs/IsoLanguageCodes.json)

Author
------

[](#author)

- [Toni Kolev](https://github.com/byKolev)

Contributors
------------

[](#contributors)

- [Alexei Gorobets](https://github.com/asgorobets)

###  Health Score

38

—

LowBetter than 83% of packages

Maintenance36

Infrequent updates — may be unmaintained

Popularity29

Limited adoption so far

Community15

Small or concentrated contributor base

Maturity60

Established project with proven stability

 Bus Factor1

Top contributor holds 87.8% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~435 days

Recently: every ~164 days

Total

8

Last Release

592d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/d27978ffb14445f73ed553b3ee4880a97ce65d17e647c57b44510fea2ca3cf88?d=identicon)[byKolev](/maintainers/byKolev)

---

Top Contributors

[![toni-kolev](https://avatars.githubusercontent.com/u/5762835?v=4)](https://github.com/toni-kolev "toni-kolev (43 commits)")[![asgorobets](https://avatars.githubusercontent.com/u/869079?v=4)](https://github.com/asgorobets "asgorobets (4 commits)")[![BR0kEN-](https://avatars.githubusercontent.com/u/2760616?v=4)](https://github.com/BR0kEN- "BR0kEN- (1 commits)")[![STodorov1996](https://avatars.githubusercontent.com/u/151612889?v=4)](https://github.com/STodorov1996 "STodorov1996 (1 commits)")

---

Tags

testingtestwebdrupalmultilingualBehatextensionmultilanguage

### Embed Badge

![Health badge](/badges/kolev-multilingual-extension/health.svg)

```
[![Health](https://phpackages.com/badges/kolev-multilingual-extension/health.svg)](https://phpackages.com/packages/kolev-multilingual-extension)
```

###  Alternatives

[drupal/tqextension

Behat extension for testing Drupal sites

1134.4k](/packages/drupal-tqextension)[drupal/drupal-extension

Drupal extension for Behat

21215.5M166](/packages/drupal-drupal-extension)[drupal/drupal-driver

A collection of reusable Drupal drivers

6816.2M23](/packages/drupal-drupal-driver)[nuvoleweb/drupal-behat

Drupal Behat extension.

33823.5k4](/packages/nuvoleweb-drupal-behat)[robertfausk/behat-panther-extension

Symfony Panther extension for Behat

341.9M104](/packages/robertfausk-behat-panther-extension)[teaandcode/behat-guzzle-extension

Behat API extension using Guzzle Service Descriptions to functionally test API endpoints

1017.7k](/packages/teaandcode-behat-guzzle-extension)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
