PHPackages                             gelembjuk/locale - 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. gelembjuk/locale

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

gelembjuk/locale
================

Internationalization support for PHP applications. It is a simple set of classes to manage languages/locales, to translate texts depending on a locale. The package contains a trait to include internationalization functions to any classes very easy and with minimum coding.

2.0.2(1y ago)01362MITPHP

Since Jul 31Pushed 1y ago1 watchersCompare

[ Source](https://github.com/Gelembjuk/locale)[ Packagist](https://packagist.org/packages/gelembjuk/locale)[ RSS](/packages/gelembjuk-locale/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (13)Used By (2)

Gelembjuk/Locale
----------------

[](#gelembjuklocale)

Internationalization support for PHP applications. It is a simple set of classes to manage languages/locales, to translate texts depending on a locale. The package contains a trait to include internationalization functions to any classes very easy and with minimum coding.

### Installation

[](#installation)

Using composer: [gelembjuk/locale](http://packagist.org/packages/gelembjuk/locale) `require: {"gelembjuk/locale": "1.*"}`

### Configuration

[](#configuration)

No configuration needed.

You need to have a folder with your texts on different languages. Separate fodler for each locale, like en,ge,it,.... Each folder should contain minimum one file default.txt

Translation files have simple key=values format

### Usage

[](#usage)

```
require '../vendor/autoload.php';

$translation = new Gelembjuk\Locale\Translate(
	array(
		'localespath' => $lang_folder_path, // path to your translations directory
		'locale' => $locale // current locale, 2 symbol language code
	)
	);

echo $translation->getText('hello',''/*default group*/,$username);  // hello = Hello, %s on our site. $username will be put in place of %s

echo $translation->getText('welcome');

echo $translation->getText('backsoon','logoutpage'); // custom texts group in a separate web site
```

**Trait** usage

```
class MyClass {
	// include translation functions
	use Gelembjuk\Locale\GetTextTrait;

	public function doSomething() {
		echo $this->getText('welcome').'';
	}

	public function andAgainWelcome($name) {
		// use short call for getText
		echo $this->_('hello','',$name).'';
	}
}

$obj = new MyClass();

$obj->setTranslation($translation);

$obj->doSomething();

$obj->andAgainWelcome($username);

$obj->setLocale('en');

$obj->andAgainWelcome($username);
```

Languages manager usage

```
$langobj = new Gelembjuk\Locale\Languages(array('localespath' => $lang_folder_path));

// list of used languages, used are languages with a folder in $lang_folder_path
$languages = $langobj->getUsedLanguages();

// print language select form

echo '';

echo $langobj->getHTMLSelect(' name="locale" onchange="document.langform.submit()" ',$locale/*current selected locale*/);

echo '';
```

### Author

[](#author)

Roman Gelembjuk (@gelembjuk)

###  Health Score

37

—

LowBetter than 83% of packages

Maintenance46

Moderate activity, may be stable

Popularity10

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity70

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

Every ~321 days

Recently: every ~841 days

Total

12

Last Release

401d ago

Major Versions

1.1.7 → 2.0.12025-04-04

### Community

Maintainers

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

---

Top Contributors

[![Gelembjuk](https://avatars.githubusercontent.com/u/1552191?v=4)](https://github.com/Gelembjuk "Gelembjuk (19 commits)")

### Embed Badge

![Health badge](/badges/gelembjuk-locale/health.svg)

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

###  Alternatives

[symfony/translation

Provides tools to internationalize your application

6.6k836.5M2.0k](/packages/symfony-translation)[nesbot/carbon

An API extension for DateTime that supports 281 different languages.

169661.4M4.8k](/packages/nesbot-carbon)[joedixon/laravel-translation

A tool for managing all of your Laravel translations

717911.4k11](/packages/joedixon-laravel-translation)[illuminate/translation

The Illuminate Translation package.

6936.4M492](/packages/illuminate-translation)[lajax/yii2-translate-manager

Translation management extension for Yii 2

227578.8k13](/packages/lajax-yii2-translate-manager)[larswiegers/laravel-translations-checker

Make sure your laravel translations are checked and are included in all languages.

256423.2k2](/packages/larswiegers-laravel-translations-checker)

PHPackages © 2026

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