I have a issue with second language

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

I would be very glad if you could help.

error-1

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

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?

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.

Could you post your locale option and Kirby version?

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

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

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

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
];

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();
            }
        ]
    ]
      
];

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.

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.

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

Now It works :grinning:
Thank you so muxh Texnixe. You are the best :smiling_face_with_three_hearts: