# I have a issue with second language

**URL:** <https://forum.getkirby.com/t/i-have-a-issue-with-second-language/19720>\
**Category:** Questions\
**Tags:** v3\
**Created:** [October 10, 2020, 9:30pm UTC](https://forum.getkirby.com/t/i-have-a-issue-with-second-language/19720 "2020-10-10T21:30:15Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![aristotheme](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/aristotheme/32/178_2.png) [@aristotheme](https://forum.getkirby.com/u/aristotheme)\
**Post date:** [October 10, 2020, 9:30pm UTC](https://forum.getkirby.com/t/i-have-a-issue-with-second-language/19720/1 "2020-10-10T21:30:15Z")

</div>

When I switch second language I got those errors. It works very well on my local server but when I work on remote server I have that issues.

I wrote to my hosting. But They coudn’t solve issues. What is going on?  
Also you can check live link when you click tr on the language switch

[http://aristotheme.com](http://aristotheme.com)

I would be very glad if you could help.

 ![error-1](https://europe1.discourse-cdn.com/flex017/uploads/getkirby/original/2X/5/5001fef74df0cb83103f2a83afb1e278abd8b896.jpeg) ![error-2](https://europe1.discourse-cdn.com/flex017/uploads/getkirby/original/2X/5/507592f974708f567a044909bdc6470c4179e3ba.jpeg)

---

<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:** [October 10, 2020, 10:04pm UTC](https://forum.getkirby.com/t/i-have-a-issue-with-second-language/19720/2 "2020-10-10T22:04:15Z")

</div>

Is that a custom method you are using? Because ` toImages()` is not a Kirby field method. Should be ` toFiles()`.

---

<div class="post-metadata">

**Author:** ![aristotheme](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/aristotheme/32/178_2.png) [@aristotheme](https://forum.getkirby.com/u/aristotheme)\
**Post date:** [October 10, 2020, 10:39pm UTC](https://forum.getkirby.com/t/i-have-a-issue-with-second-language/19720/3 "2020-10-10T22:39:41Z")

</div>

Thank you so much Texnixe!

But It still weird I got this ‘The JSON response from the API could not be parsed. Please check your API connection.’ on the panel?

---

<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:** [October 11, 2020, 7:27am UTC](https://forum.getkirby.com/t/i-have-a-issue-with-second-language/19720/4 "2020-10-11T07:27:38Z")

</div>

Yes, weird, and I don’t know why the error only appeared in the tr version on the frontend and how that relates to the Panel. Maybe the console would have had more details on the Panel error.

---

<div class="post-metadata">

**Author:** ![ahmetbora](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/ahmetbora/32/11671_2.png) [@ahmetbora](https://forum.getkirby.com/u/ahmetbora)\
**Post date:** [October 11, 2020, 10:44am UTC](https://forum.getkirby.com/t/i-have-a-issue-with-second-language/19720/5 "2020-10-11T10:44:27Z")

</div>

Could you post your `locale` option and Kirby version?

---

<div class="post-metadata">

**Author:** ![aristotheme](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/aristotheme/32/178_2.png) [@aristotheme](https://forum.getkirby.com/u/aristotheme)\
**Post date:** [October 11, 2020, 1:23pm UTC](https://forum.getkirby.com/t/i-have-a-issue-with-second-language/19720/6 "2020-10-11T13:23:10Z")

</div>

Hi Bora  
MAMP - Php version 7.4.2 and Kirby version 3.4.4 now I tried other versions and same result

---

<div class="post-metadata">

**Author:** ![aristotheme](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/aristotheme/32/178_2.png) [@aristotheme](https://forum.getkirby.com/u/aristotheme)\
**Post date:** [October 11, 2020, 1:41pm UTC](https://forum.getkirby.com/t/i-have-a-issue-with-second-language/19720/7 "2020-10-11T13:41:30Z")

</div>

I created three language EN|DE|TR and problem with TR  
When I add TR language I have this issue

> **[Aristo | Kirby Themes](http://aristotheme.com/en)**

---

<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:** [October 11, 2020, 1:50pm UTC](https://forum.getkirby.com/t/i-have-a-issue-with-second-language/19720/8 "2020-10-11T13:50:22Z")

</div>

As @ahmetbora already asked, could you please post your language definitions (from /site/languages)?

---

<div class="post-metadata">

**Author:** ![aristotheme](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/aristotheme/32/178_2.png) [@aristotheme](https://forum.getkirby.com/u/aristotheme)\
**Post date:** [October 11, 2020, 1:53pm UTC](https://forum.getkirby.com/t/i-have-a-issue-with-second-language/19720/9 "2020-10-11T13:53:20Z")

</div>

This is EN

```
<?php

return [
    'code' => 'en',
    'default' => true,
    'direction' => 'ltr',
    'locale' => [
        'LC_ALL' => 'en_US'
    ],
    'name' => 'en',
    'translations' => [

    ],
    'url' => '/'
];

```

and TR

```
<?php

return [
    'code' => 'tr',
    'default' => false,
    'direction' => 'ltr',
    'locale' => [
        'LC_ALL' => 'tr_TR'
    ],
    'name' => 'tr',
    'translations' => [

    ],
    'url' => NULL
];
```

---

<div class="post-metadata">

**Author:** ![aristotheme](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/aristotheme/32/178_2.png) [@aristotheme](https://forum.getkirby.com/u/aristotheme)\
**Post date:** [October 11, 2020, 1:55pm UTC](https://forum.getkirby.com/t/i-have-a-issue-with-second-language/19720/10 "2020-10-11T13:55:28Z")

</div>

And config.php

```
<?php

return [

    'debug' => true,

    'panel' => [
      'css' => 'assets/css/panel.css'
    ],

    'smartypants' => true,

    'date' => [
      'handler' => 'strftime'
    ],

    'languages' => true,

    // Plugin / Automatically resize images on upload.
    'medienbaecker.autoresize.maxWidth' => 1920,

    // Cachebuster
    'schnti.cachebuster.active' => true,

    // converting JPG, JPEG and PNG into much smaller WEBP
    //'mrfd.webp.autoconvert' => true,
  

    // Robots  
    'bnomei.robots-txt.sitemap' => 'sitemap.xml',
    'bnomei.robots-txt.groups' => [ // array or callback
      '*' => [ // user-agent
          'disallow' => [
              '/kirby/',
              '/site/',
          ],
          'allow' => [
              '/media/',
          ]
      ]
    ],

    // Support for language detect option
    'routes' => [
      [
          'pattern' => '/',
          'action' => function () {
              $session = kirby()->session();

                if ($session->get('languages.detect', false) === false && option('languages.detect') === true) {
                  $session->set('languages.detect', true);
                  
                  return kirby()
                      ->response()
                      ->redirect(kirby()->detectedLanguage()->url());
                }

                return page();
            }
        ]
    ]
      
];
```

---

<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:** [October 11, 2020, 1:58pm UTC](https://forum.getkirby.com/t/i-have-a-issue-with-second-language/19720/11 "2020-10-11T13:58:47Z")

</div>

The link you posted above points to the `/ en` URL, but according to your language settings, that URL ist not available, since you want to use the default language without the language code.

If you start at `/`, the language switches work for me.

---

<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:** [October 11, 2020, 2:02pm UTC](https://forum.getkirby.com/t/i-have-a-issue-with-second-language/19720/12 "2020-10-11T14:02:13Z")

</div>

> [@aristotheme](#):
>
> `if ($session->get('languages.detect', false) === false && option('languages.detect') === true)`

The `languages.detect` option doesn’t seem to be set and doesn’t work in conjunction with a ` /` URL for the default language, anyway. I guess your purpose here is to create your own language detection.

---

<div class="post-metadata">

**Author:** ![aristotheme](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/aristotheme/32/178_2.png) [@aristotheme](https://forum.getkirby.com/u/aristotheme)\
**Post date:** [October 11, 2020, 2:30pm UTC](https://forum.getkirby.com/t/i-have-a-issue-with-second-language/19720/13 "2020-10-11T14:30:40Z")

</div>

I put this code in config.php ;  
`'languages.detect' => true,`

Now It works 😀  
Thank you so muxh Texnixe. You are the best 🥰
