PHPackages                             sebrogala/xsv-translate - 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. [Localization &amp; i18n](/categories/localization)
4. /
5. sebrogala/xsv-translate

AbandonedArchivedLibrary[Localization &amp; i18n](/categories/localization)

sebrogala/xsv-translate
=======================

Zend Expressive Translation Module

3.0.0(7y ago)028BSD-3-ClausePHP

Since Jul 23Pushed 7y agoCompare

[ Source](https://github.com/SebRogala/xsv-translate)[ Packagist](https://packagist.org/packages/sebrogala/xsv-translate)[ Docs](https://github.com/SebRogala/xsv-translate)[ RSS](/packages/sebrogala-xsv-translate/feed)WikiDiscussions master Synced 2w ago

READMEChangelogDependencies (1)Versions (2)Used By (0)

Zend Expressive Translation Module
==================================

[](#zend-expressive-translation-module)

Module made for database oriented resource translating with usage of Doctrine2. However it is quite simple to expand Translator with own kind of Adapter.

Installing (being in project root)
----------------------------------

[](#installing-being-in-project-root)

```
composer require sebrogala/xsv-translate^3.0
cp vendor/sebrogala/xsv-translate/data/xsv-translate-config.global.php.dist config/autoload/xsv-translate-config.global.php
```

- enable module in `config/config.php` adding `Xsv\Translate\ConfigProvider::class,`
- pipe middleware in `config/pipeline.php` before `DispatchMiddleware`:

```
/* ... */
$app->pipe(\Xsv\Translate\App\Middleware\TranslatorConfigMiddleware::class);
$app->pipe(DispatchMiddleware::class);
/* ... */
```

- change config file according to needs

```
vendor/bin/doctrine orm:schema-tool:update --force
```

Usage
-----

[](#usage)

- yet to done, for now only simple examples:

#### Recognizing which language to use

[](#recognizing-which-language-to-use)

- provide locale code with custom header:

```
X-Preferable-Locale locale_CODE

```

#### Adding translation

[](#adding-translation)

```
//adding translation interface
public static function addTranslation($resourceName, $resourceId, Locale $locale, $content)
```

```
use Xsv\Translate\Translator\Translator;
/*
...
*/
Translator::addTranslation("resource.name", "id", new Locale("pl_PL"), "TranslationToPolish");
```

Where:

- "resource.name" is self defined, can be "user.username" - it's about single field.
- "id" is unique id of row (currently it's based on uuid)

#### Translating resource

[](#translating-resource)

```
//translating interface
public static function translate(string $resourceName, string $resourceId, $defaultTranslationContent = "")
```

```
use Xsv\Translate\Translator\Translator;
/*
...
*/
return new JsonResponse(
    [
        "userName" => Translator::translate("user.name", $user->getId(), $user->getUserName())
    ]
);
```

TODO
----

[](#todo)

- remove single translation
- remove all translations for chosen ID
- provide better examples

###  Health Score

27

—

LowBetter than 47% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity62

Established project with proven stability

 Bus Factor1

Top contributor holds 100% 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

Unknown

Total

1

Last Release

2899d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/12585578?v=4)[Sebastian Rogala](/maintainers/SebRogala)[@SebRogala](https://github.com/SebRogala)

---

Top Contributors

[![SebRogala](https://avatars.githubusercontent.com/u/12585578?v=4)](https://github.com/SebRogala "SebRogala (3 commits)")

### Embed Badge

![Health badge](/badges/sebrogala-xsv-translate/health.svg)

```
[![Health](https://phpackages.com/badges/sebrogala-xsv-translate/health.svg)](https://phpackages.com/packages/sebrogala-xsv-translate)
```

###  Alternatives

[smmoosavi/php-gettext

Wrapper for php-gettext by danilo segan. This library provides PHP functions to read MO files even when gettext is not compiled in or when appropriate locale is not present on the system.

1926.6k1](/packages/smmoosavi-php-gettext)[laradevs/spanish

labels translated to spanish

166.7k](/packages/laradevs-spanish)

PHPackages © 2026

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