PHPackages                             kado/kado.translation - 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. kado/kado.translation

ActiveLibrary

kado/kado.translation
=====================

PHP translation library.

1.0.0(1mo ago)01↑2900%1MITPHPPHP &gt;=8.3

Since Apr 5Pushed 1mo agoCompare

[ Source](https://github.com/sweet-andi/kado.translation)[ Packagist](https://packagist.org/packages/kado/kado.translation)[ RSS](/packages/kado-kadotranslation/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)Dependencies (5)Versions (2)Used By (1)

Kado.Translation
================

[](#kadotranslation)

Small PHP file based translation library.

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

[](#installation)

in `composer.json`:

```
{
   "require": {
      "php": ">=8.3",
      "kado/kado.translation": "~0.6"
   }
}
```

How to use
----------

[](#how-to-use)

```
include __DIR__ . '/vendor/autoload.php';

use \Kado\Locale\Locale;
use \Kado\Translation\Sources\PHPFileSource;
use \Kado\Translation\Translator;

try
{
    // Init the locale
    $locale = Locale::Create(
        // The fallback locale if no other was found
        new Locale( 'de', 'de', 'UTF-8' ),
        // Check also the URL path for a locale or language part?
        true,
        // These are the names of the parameters, accepted from $_POST, $_GET and $_SESSION
        [ 'lc', 'locale', 'language', 'lang', 'lng' ]
    );

    // Init the translator instance with defined locale
    $translator = new Translator( $locale );

    // Define the templates source directory. There is also a JSONFileSource and a XMLFileSource
    $translatorSource = new PHPFileSource( __DIR__ . '/translations', $locale );
    // ...and add the source to template engine
    $translator->addSource( $translatorSource );

    // If you want access the Translator instance globally
    $translator->setAsGlobalInstance();

    // Example output
    echo Translator::GetInstance()->read( 'Hello1', 'MyApp', 'Hello people!' ), "\n",
         $translator->read( 'NiceTM', 'MyApp', 'NiceToMeetYouM!' );

}
catch ( \Throwable $ex )
{
    // TODO: Do some error handling
}
```

Translation sources
-------------------

[](#translation-sources)

A translator must have 1 or more translation sources. Each source defines a directory, that must contain the translation source files, for all supported languages.

### Translation files

[](#translation-files)

- The **file name** (without extension) must be the locale name. (e.g. `de` or `de_AT` )
- The **file extension** must be supported by the used `ISource` implementation. Currently, known is `.php` (PHPFileSource) `.json` (JSONFileSource) and `.xml` (XMLFileSource)

### Example directory structure

[](#example-directory-structure)

```
+ translations
   - de.php
   - de_DE.php
   - en.php
   - fr_FR.php

```

### PHP file source

[](#php-file-source)

Format is:

```

   Ein anderer Beispieltext

      Ein ganz anderer Beispieltext

      Text 4
      Hallo Welt

         Montag
         Dienstag
         Mittwoch
         Donnerstag
         Freitag
         Samstag
         Sonntag

      weekdaysDict

         Montag
         Dienstag
         Mittwoch
         Donnerstag
         Freitag
         Samstag
         Sonntag

```

###  Health Score

39

—

LowBetter than 87% of packages

Maintenance90

Actively maintained with recent releases

Popularity2

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity48

Maturing project, gaining track record

 Bus Factor1

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

46d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/4c3d406ad5f42dc4f4a9af3476d667a0c5ff264b109b17e048535804772bce4d?d=identicon)[Sweet Andi](/maintainers/Sweet%20Andi)

---

Top Contributors

[![sweet-andi](https://avatars.githubusercontent.com/u/270207515?v=4)](https://github.com/sweet-andi "sweet-andi (1 commits)")[![UniKado](https://avatars.githubusercontent.com/u/6945587?v=4)](https://github.com/UniKado "UniKado (1 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/kado-kadotranslation/health.svg)

```
[![Health](https://phpackages.com/badges/kado-kadotranslation/health.svg)](https://phpackages.com/packages/kado-kadotranslation)
```

###  Alternatives

[elgg/elgg

Elgg is an award-winning social networking engine, delivering the building blocks that enable businesses, schools, universities and associations to create their own fully-featured social networks and applications.

1.7k15.7k5](/packages/elgg-elgg)[api-platform/metadata

API Resource-oriented metadata attributes and factories

243.5M96](/packages/api-platform-metadata)[neos/flow

Flow Application Framework

842.0M451](/packages/neos-flow)[phpro/http-tools

HTTP tools for developing more consistent HTTP implementations.

28137.8k](/packages/phpro-http-tools)[flowwow/cloudpayments-php-client

cloudpayments api client

2188.2k](/packages/flowwow-cloudpayments-php-client)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

245.2k](/packages/aedart-athenaeum)

PHPackages © 2026

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