PHPackages                             janneklouman/silverstripe-translatable-controllers - 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. janneklouman/silverstripe-translatable-controllers

ActiveSilverstripe-module[Localization &amp; i18n](/categories/localization)

janneklouman/silverstripe-translatable-controllers
==================================================

An interface to allow simple translation of controller url segments and actions.

3111PHP

Since May 8Pushed 8y ago1 watchersCompare

[ Source](https://github.com/jjjjjjjjjjjjjjjjjjjj/silverstripe-translatable-controllers)[ Packagist](https://packagist.org/packages/janneklouman/silverstripe-translatable-controllers)[ RSS](/packages/janneklouman-silverstripe-translatable-controllers/feed)WikiDiscussions master Synced 1w ago

READMEChangelogDependenciesVersions (1)Used By (0)

SilverStripe Translatable Controllers
=====================================

[](#silverstripe-translatable-controllers)

This module provides a simple interface that allows you to set up multiple routes to your controllers and their actions. The most common use case would probably be translating these routes.

Requirements
------------

[](#requirements)

```
"require": {
    "php": "^5.4",
    "silverstripe/framework": "^3.1"
}
```

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

[](#installation)

`composer install jjjjjjjjjjjjjjjjjjjj/silverstripe-translatable-controllers`

Basic usage example
-------------------

[](#basic-usage-example)

The following example provides a simple controller (`ExampleController`) with one function (`example_function`), available from:

- `example.com/ExampleController/example_function`
- `example.com/example_example/function_function`
- `example.com/exempelcontroller/exempelfunktion` (when the locale is Swedish)
- `example.com/コントローラーの例/関数の例` (when the locale is Japanese)

Make your controller implement the [`TranslatableController`](https://github.com/janneklouman/silverstripe-translatable-controllers/blob/master/code/TranslatableController.php) interface:

```
# ExampleController.php
class ExampleController extends Controller implements TranslatableController
{

    private static $allowed_actions = [
        'example_function'
    ];

    public function getValidUrlSegments()
    {
        return [
            'example_example',
            _t('ExampleController.CONTROLLER_URL_SEGMENT')
        ];
    }

    public function getValidUrlHandlers()
    {
        return [
            'function_function' => 'example_function',
            _t('ExampleController.CONTROLLER_ACTION_EXAMPLE') => 'example_function'
        ]
    }

    /**
     * Returns the number 42
     */
    public function example_function
    {
        return 42;
    }

}
```

Define your routes in the translation file for the target language(s):

```
# sv_SE.yml
sv:
  ExampleController:
    CONTROLLER_URL_SEGMENT: 'exempelcontroller'
    CONTROLLER_ACTION_EXAMPLE: 'exempelfunktion'
```

```
# ja_JP.yml
ja:
  ExampleController:
    CONTROLLER_URL_SEGMENT: 'コントローラーの例'
    CONTROLLER_ACTION_EXAMPLE: '関数の例'
```

###  Health Score

21

—

LowBetter than 17% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity41

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.

### Community

Maintainers

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

---

Top Contributors

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

---

Tags

silverstripetranslation

### Embed Badge

![Health badge](/badges/janneklouman-silverstripe-translatable-controllers/health.svg)

```
[![Health](https://phpackages.com/badges/janneklouman-silverstripe-translatable-controllers/health.svg)](https://phpackages.com/packages/janneklouman-silverstripe-translatable-controllers)
```

###  Alternatives

[smarty-gettext/smarty-gettext

Gettext plugin enabling internationalization in Smarty Package files

752.5M8](/packages/smarty-gettext-smarty-gettext)[devaslanphp/auto-translate

Auto generate translation JSON files

6627.3k](/packages/devaslanphp-auto-translate)[renatomarinho/laravel-multi-language

Laravel Multi Language

235.1k](/packages/renatomarinho-laravel-multi-language)

PHPackages © 2026

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