# Plugin is multi language kirby not

**URL:** <https://forum.getkirby.com/t/plugin-is-multi-language-kirby-not/13098>\
**Category:** Questions\
**Tags:** v3\
**Created:** [February 27, 2019, 4:29pm UTC](https://forum.getkirby.com/t/plugin-is-multi-language-kirby-not/13098 "2019-02-27T16:29:45Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![ajk](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/ajk/32/5063_2.png) [@ajk](https://forum.getkirby.com/u/ajk)\
**Post date:** [February 27, 2019, 4:29pm UTC](https://forum.getkirby.com/t/plugin-is-multi-language-kirby-not/13098/1 "2019-02-27T16:29:45Z")

</div>

What’s the simplest solution?  
The installed plugin is multi language but Kirby 3 not.  
All `translation()` / `t()` doesn’t display anything.

---

<div class="post-metadata">

**Author:** ![texnixe](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/texnixe/32/5754_2.png) [@texnixe](https://forum.getkirby.com/u/texnixe)\
**Post date:** [February 27, 2019, 4:35pm UTC](https://forum.getkirby.com/t/plugin-is-multi-language-kirby-not/13098/2 "2019-02-27T16:35:01Z")

</div>

Hm, the plugin should actually provide a default value, I don’t think there’s anything you can do other than contacting the developer or set a language.

---

<div class="post-metadata">

**Author:** ![ajk](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/ajk/32/5063_2.png) [@ajk](https://forum.getkirby.com/u/ajk)\
**Post date:** [February 27, 2019, 7:35pm UTC](https://forum.getkirby.com/t/plugin-is-multi-language-kirby-not/13098/3 "2019-02-27T19:35:22Z")

</div>

Can i set the default language in the index.php file of the plugin?

---

<div class="post-metadata">

**Author:** ![texnixe](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/texnixe/32/5754_2.png) [@texnixe](https://forum.getkirby.com/u/texnixe)\
**Post date:** [February 27, 2019, 7:36pm UTC](https://forum.getkirby.com/t/plugin-is-multi-language-kirby-not/13098/4 "2019-02-27T19:36:41Z")

</div>

Could you post a link to the plugin, I need to see what’s happening there.

---

<div class="post-metadata">

**Author:** ![ajk](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/ajk/32/5063_2.png) [@ajk](https://forum.getkirby.com/u/ajk)\
**Post date:** [February 27, 2019, 7:42pm UTC](https://forum.getkirby.com/t/plugin-is-multi-language-kirby-not/13098/5 "2019-02-27T19:42:27Z")

</div>

I wrote a fork from the membership plugin (Kirby2).

The index.php

```auto
<?php
Kirby::plugin('saan/membership', [
  'templates' => [
	'account'	=> __DIR__. '/templates/account.php',
	'login' => __DIR__. '/templates/login.php',
	'register'	=> __DIR__. '/templates/register.php',
	'reset' => __DIR__. '/templates/reset.php',
	'active'	=> __DIR__. '/templates/active.php'
  ],
  'blueprints' => [
	'account'	=> __DIR__. '/blueprints/account.yml',
	'login' => __DIR__. '/blueprints/login.yml',
	'register'	=> __DIR__. '/blueprints/register.yml',
	'reset' => __DIR__. '/blueprints/reset.yml',
	'active' => __DIR__. '/blueprints/active.yml'
  ],
  'controllers' => [
	'account'	=> require __DIR__. '/controllers/account.php',
	'login' => require __DIR__. '/controllers/login.php',
	'register'	=> require __DIR__. '/controllers/register.php',
	'reset' => require __DIR__. '/controllers/reset.php'
  ],
  'snippets' => [
	'activeaccount' => __DIR__. '/snippets/activeaccount.php',
	'resetpassword' => __DIR__. '/snippets/resetpassword.php'
  ],
  'routes' => [
    [	
      'pattern' => 'logout',
      'action' => function() {
			if($user = $kirby->user()) {
				$user->logout();
			}
			go();
		}
    ],
    [
		// If user follows the activation link from email
		'pattern' => 'token/([a-f0-9]{32})',
		'action' => function($token) {	
			$site = site();
			// Find user by token
			if ($user = $site->users()->findBy('token', $token)) {
				// clear the token and set active to '1'
				$user->update([
					'token' => '',
					'active'	=> '1'
				]);
				// Account is activated go to account/active
				return go('/account/active');
			} else {
				return go();
			}
		}
	],
	[	
		// If user follows the reset link from email
		'pattern' => 'token/([a-f0-9]{36})',
		'action' => function($token) {
			$site = site();
			if($u = $site->user()) $u->logout();
			// Find user by token
			if ($user = $site->users()->findBy('token',$token)) {
	
				$user->update([
					'token' => '',
					'password' => $token,
					'active' => '1'
				]);
	
				if ($user->login($token)) {
					return go('/account');
				} else {
					return go();
				}
				
			} else {
				return go();
			}
		}
	]
	],//end routes
	'translations' => [
        'de' => [
            // All pages
			'membership.firstname' => 'Vorname',
			'membership.lastname' => 'Name',
			'membership.email' => 'E-Mail',
			'membership.password' => 'Passwort',
			'membership.newpassword' => 'Neues Passwort',
			'membership.confpassword'	=> 'Neues Passwort bestätigen',

```

---

<div class="post-metadata">

**Author:** ![texnixe](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/texnixe/32/5754_2.png) [@texnixe](https://forum.getkirby.com/u/texnixe)\
**Post date:** [February 27, 2019, 8:09pm UTC](https://forum.getkirby.com/t/plugin-is-multi-language-kirby-not/13098/6 "2019-02-27T20:09:45Z")

</div>

The `t()` helper accepts a fallback value, maybe you can work with that.

---

<div class="post-metadata">

**Author:** ![carstengrimm](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/carstengrimm/32/188_2.png) [@carstengrimm](https://forum.getkirby.com/u/carstengrimm)\
**Post date:** [February 27, 2019, 8:13pm UTC](https://forum.getkirby.com/t/plugin-is-multi-language-kirby-not/13098/7 "2019-02-27T20:13:18Z")

</div>

u could tidy up your script, that’s what i was doing on my plugin as well

```auto
    'hooks' => [
        require __DIR__.'/registry/hooks/hook.a.php',
    ],
    'routes' => [      
        require __DIR__.'/registry/route/a.php',        
        require __DIR__.'/registry/route/b.php',        
        require __DIR__.'/registry/route/c.php',
    ],
    'translations' => [
        'de' => require( __DIR__.'/languages/de.php'),
        'en' => require( __DIR__.'/languages/en.php'),
    ],

```

```auto
// de.php
<?php return [
  'key' => 'value',
]; ?>

```

In my case obviously i set ‘languages’ =\> true in config file, not sure if that’s required…

and i am accessing them (without fallback)

```auto
<?= t('key') ?>
<?php echo t('key') ?>

```

Your update method needs permissions, don’t forget about them. Not sure about single language site, u could just activate the language support and only set up one language for that.

---

<div class="post-metadata">

**Author:** ![ajk](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/ajk/32/5063_2.png) [@ajk](https://forum.getkirby.com/u/ajk)\
**Post date:** [February 28, 2019, 3:14pm UTC](https://forum.getkirby.com/t/plugin-is-multi-language-kirby-not/13098/8 "2019-02-28T15:14:38Z")

</div>

> [@carstengrimm](#):
>
> In my case obviously i set ‘languages’ =\> true in config file, not sure if that’s required…

If i set languages to TRUE, the url has this ugly “/de/” or “/en/” in it!

On a single language website!

---

<div class="post-metadata">

**Author:** ![carstengrimm](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/carstengrimm/32/188_2.png) [@carstengrimm](https://forum.getkirby.com/u/carstengrimm)\
**Post date:** [February 28, 2019, 3:27pm UTC](https://forum.getkirby.com/t/plugin-is-multi-language-kirby-not/13098/9 "2019-02-28T15:27:39Z")

</div>

```auto
return array (
  'code' => 'de',
  'default' => true,
  'direction' => 'ltr',
  'locale' => 'de_DE',
  'name' => 'Deutsch',
  'url' => '/'
);

```

check out the url parameter, u can set

- domains
- strings (such as en, de)
- or just a slash…

so when setting a slash, your default language will also become [your-url.com/page](http://your-url.com/page)

the only difference would be having text.de.txt

---

<div class="post-metadata">

**Author:** ![ajk](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/ajk/32/5063_2.png) [@ajk](https://forum.getkirby.com/u/ajk)\
**Post date:** [February 28, 2019, 3:33pm UTC](https://forum.getkirby.com/t/plugin-is-multi-language-kirby-not/13098/10 "2019-02-28T15:33:43Z")

</div>

Ah that’s it.  
Many thanks @carstengrimm ! 👍
