PHPackages                             medienbaecker/kirby-language-access - 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. medienbaecker/kirby-language-access

ActiveKirby-plugin[Localization &amp; i18n](/categories/localization)

medienbaecker/kirby-language-access
===================================

Control public language visibility and restrict translators to assigned languages

1.0.0(2mo ago)22MITPHPPHP ^8.2

Since Mar 2Pushed 2mo ago1 watchersCompare

[ Source](https://github.com/medienbaecker/kirby-language-access)[ Packagist](https://packagist.org/packages/medienbaecker/kirby-language-access)[ RSS](/packages/medienbaecker-kirby-language-access/feed)WikiDiscussions main Synced 1mo ago

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

Kirby Language Access
=====================

[](#kirby-language-access)

Controls which languages are visible on the frontend and who can edit them in the Panel. Frontend visitors only see the languages you've enabled. Restricted users can only edit content in the languages assigned to them.

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

[](#installation)

```
composer require medienbaecker/kirby-language-access
```

Or download and place in `site/plugins/kirby-language-access`.

Setup
-----

[](#setup)

### 1. Enable languages

[](#1-enable-languages)

In `site/config/config.php`, specify which languages visitors can see. The default language is always available, but it also doesn't hurt including it in the array:

```
return [
    'medienbaecker.language-access.languages' => ['de', 'en'],
];
```

### 2. Disable fields for restricted languages

[](#2-disable-fields-for-restricted-languages)

For pages, the plugin registers a custom page model that makes fields read-only automatically. If your project has its own `site/models/default.php`, extend the plugin's model rather than `Page`:

```
use Medienbaecker\LanguageAccess\LanguageAccessPage;

class DefaultPage extends LanguageAccessPage
{
    // your methods
}
```

Unfortunately there's no equivalent for site and files in Kirby, so your blueprints need to extend the plugin:

```
# site/blueprints/site.yml
extends: language-access/site
```

```
# site/blueprints/files/default.yml
extends: language-access/file
```

### 3. Restrict users

[](#3-restrict-users)

The plugin includes a Translator role blueprint. Create it in your project and tweak the permissions as needed:

```
# site/blueprints/users/translator.yml
extends: language-access/users/translator
```

Create a user with that role in the Panel and pick the languages they're allowed to edit.

Language menu
-------------

[](#language-menu)

`$site->enabledLanguages()` gives you the languages that are publicly available. Here's a simple example of a language menu:

```
