PHPackages                             sanatorium/localization - 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. sanatorium/localization

ActivePlatform-extension[Localization &amp; i18n](/categories/localization)

sanatorium/localization
=======================

Localization

3.2.6(9y ago)00PHPPHP &gt;=5.4.0

Since Apr 14Pushed 9y ago2 watchersCompare

[ Source](https://github.com/rozklad/platform-localization)[ Packagist](https://packagist.org/packages/sanatorium/localization)[ RSS](/packages/sanatorium-localization/feed)WikiDiscussions master Synced 4w ago

READMEChangelogDependencies (3)Versions (50)Used By (0)

sanatorium/localization
=======================

[](#sanatoriumlocalization)

Localization

Contents
--------

[](#contents)

1. [Installation](#installation)
2. [Documentation](#documentation)
3. [Changelog](#changelog)
4. [Support](#support)
5. [Hooks](#hooks)

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

[](#installation)

### Composer

[](#composer)

Add repository to your composer.json

```
"repositories": [
  {
    "type": "composer",
    "url": "http://repo.sanatorium.ninja"
  }
]

```

Download the package

```
composer require sanatorium/localization

```

Add following line to app/Http/Kernel.php

```
protected $middleware = [
    ...
    \Sanatorium\Localization\Middleware\Locale::class
];

```

Documentation
-------------

[](#documentation)

There are two terms used throughout this package - Localization and Translation, let's describe the difference:

### Localization

[](#localization)

We use **localization** for localized value of entity key. For example used like this:

```
{{-- Original value --}}
{{ $page->meta_title }}

{{-- Localized value --}}
@localize($page, 'meta_title')

```

### Translation

[](#translation)

Translation refers to original translation feature of Laravel and does not need any special markup. Special admin screen to manage translations is provided.

```
trans('platform/pages::common.title')

```

### Localize entity field

[](#localize-entity-field)

#### Register new localized entity

[](#register-new-localized-entity)

```
// Register new localized entity
$this->app['sanatorium.localization.localized']->localize(
    'Platform\Menus\Models\Menu'
);

```

#### Localize entity field

[](#localize-entity-field-1)

```
@localize($entity, 'field')

```

### Translate strings

[](#translate-strings)

General app and package language strings can be changed from

```
/resources/langs/override/{LOCALE}
/resources/langs/override/{VENDOR}/{PACKAGE}/{LOCALE}

```

These language strings are managed from

```
/admin/localization/translations

```

### Languages

[](#languages)

Manage languages available for the users on the site.

### Single request locale setting

[](#single-request-locale-setting)

Set GET param 'locale' to any supported locale, like this

```
http://example.com/?locale=en

```

### Persistent locale setting

[](#persistent-locale-setting)

#### From browser

[](#from-browser)

Set GET param 'active\_locale' to any supported locale, like this

```
http://example.com/?active_locale=en

```

#### In code

[](#in-code)

Set `active_language_locale` session to desired locale.

### Translations

[](#translations)

Manage string translation in localization files.

### Functions

[](#functions)

```
transattr($slug, $fallback = null, $locale = null)

transvalue($slug, $fallback = null, $locale = null)

```

Changelog
---------

[](#changelog)

- 3.1.1 - 2016-09-23 - Helper functions
- 3.0.9 - 2016-09-15 - Platform 5, caching
- 0.4.0 - 2016-07-23 - Translation strings override, entity field localization
- 0.3.0 - 2016-05-23 - Translation strings manager
- 0.2.3 - 2016-05-22 - Basic readme file

Support
-------

[](#support)

Support not available.

Hooks
-----

[](#hooks)

```
'shop.header' => 'sanatorium/localization::hooks.languages',  // @deprecated
'language.switch' => 'sanatorium/localization::hooks.languages',

```

###  Health Score

28

—

LowBetter than 52% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity0

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity71

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 ~4 days

Total

49

Last Release

3537d ago

Major Versions

0.5.1 → 3.02016-08-27

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/3017167?v=4)[rozklad](/maintainers/rozklad)[@rozklad](https://github.com/rozklad)

---

Top Contributors

[![rozklad](https://avatars.githubusercontent.com/u/3017167?v=4)](https://github.com/rozklad "rozklad (52 commits)")

---

Tags

laravelplatformextensioncartalystmadeinsane

### Embed Badge

![Health badge](/badges/sanatorium-localization/health.svg)

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

PHPackages © 2026

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