PHPackages                             aw-studio/localize - 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. aw-studio/localize

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

aw-studio/localize
==================

Translated Routes for Fjord Frontends

v0.3(6y ago)1137MITPHP

Since Apr 1Pushed 6y ago1 watchersCompare

[ Source](https://github.com/aw-studio/localize)[ Packagist](https://packagist.org/packages/aw-studio/localize)[ RSS](/packages/aw-studio-localize/feed)WikiDiscussions master Synced 3w ago

READMEChangelog (3)DependenciesVersions (4)Used By (0)

Localize – Translated Routes for Fjord Frontends
================================================

[](#localize--translated-routes-for-fjord-frontends)

Build translated routes in the form of `/en/home`, `/de/startseite` made easy.

Install
-------

[](#install)

```
composer require aw-studio/localize
```

Usage
-----

[](#usage)

Make shure to translate your routes within your translation-files in the `resources` directory, e.g.:

```
// lang/de/routes.php

return [
    'home' => 'startseite'
];
```

You can now simply add translated Routes to your preferred routes file, e.g. `routes\web.php`:

```
Route::trans('/__(routes.home)', HomeController::class)->name('home');
```

Translated Routes in Blade
--------------------------

[](#translated-routes-in-blade)

In your blade-files, simply use the `__route()` helper like this:

```

    ...

```

### Switching languages

[](#switching-languages)

Use the `__routes()` helper to retrieve an array of routes to all language versions of the current route. If your route uses translated parameters these need to be passed.

```
@foreach (__routes($routeParameters ?? null) as $route)

        {{ $route->locale }}

@endforeach
```

Translated Route Parameters
---------------------------

[](#translated-route-parameters)

Imagine your route takes a translated slug as a parameter, a blog post for example:

`/en/posts/my-first-post``/de/beitraege/mein-erster-beitrag`

Your route should look something like this:

```
Route::trans('/__(routes.posts)/{slug}', PostController::class)->name('posts.show');
```

In your controller, you can retrieve the post using the `whereHas` method

```
$post = Post::whereHas('translations', function($query) use($slug) {
        $query->where('slug', $slug)->where('locale', app()->getLocale());
    })
    ->with('translations')
    ->first();
```

In order to retrieve the post's links to all other languages, we have pass the translated route parameters like this:

```
$slugs = $post->translations->mapWithKeys(function($item) {
    return [$item->locale => $item->slug];
})->toArray();

return view('posts.show')->with([
    'post' => $post,
    'routeParameters' => ['slug' => $slugs]
]);
```

In your view you can now use the `__routes()` function passing it the relevant parameters:

```
@foreach (__routes($routeParameters ?? null) as $route)
    {{ $route->link }}
@endforeach
```

###  Health Score

24

—

LowBetter than 31% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity48

Maturing project, gaining track record

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

Total

3

Last Release

2212d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/7b2d65d58480dd7fdbf4f4593158cbd0634550ee9210c49957cc48c8a8ccaef6?d=identicon)[jannescb](/maintainers/jannescb)

---

Top Contributors

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

### Embed Badge

![Health badge](/badges/aw-studio-localize/health.svg)

```
[![Health](https://phpackages.com/badges/aw-studio-localize/health.svg)](https://phpackages.com/packages/aw-studio-localize)
```

###  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.

1927.0k1](/packages/smmoosavi-php-gettext)

PHPackages © 2026

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