Translation provokes file name changes

Hey there!

First of all, Iā€™m starting to programe with this CMS and I want to say that is gorgeous. I have been experiencing some problems but nothing that I couldnā€™t solve with a bit of research until now.

When I started translating the page to several languages I notices that the file names changed depending on the panel language preference set. That of course messed up some of my links within the page.

Someone knows how can I prevent this to happen?

I appreciate all the answers on advance.

What file names are you referring to and how do you link to other pages within your site?

My file structure is as follows:

  • Content
    1. Projects
      • Title 1
      • Title 2
    2. Services
      • Service 1
      • Service 2

And I use this code:

<a href="< $projects = $pages->find('projects'); echo $projects->url() ?>">

Somehow, I donā€™t yet know why, sometimes when I enter the panel and change the language, the folders on all this structure change name provoking that that pice of code not to work.

Sorry, to reply so late. Could you resolve the problem?

If not, it would helpful to know what file names change from which to what. And also how you have set up your languages in site/config/config.php.

Hey, donā€™t worry all help is appreciated :smile:

The names change from Spanish as they where originally to english or catalan. So if the original was:

Proyectos
Titulo 1
Titulo 2
Servicios
Servicio 1
Servicio 2

It converts to:
Projects
Title 1
Title 2
Services
Service 1
Service 2

My language configuration is as follows. Since this happened I changed the default language to English in stead of Spanish, Iā€™ve changed all the links and now I donā€™t use the Panel anymore just in case it keeps changing names.

c::set('lang.support', true);
c::set('lang.default', 'en');
c::set('lang.available', array('en', 'de'));
c::set('lang.detect', true);
c::set('lang.locale', false);
c::set('languages', array(
  array(
    'code'    => 'es',
    'name'    => 'Spanish',
    'locale'  => 'es_ES',
    'url'     => 'es',
  ),
  array(
    'code'    => 'ca',
    'name'    => 'Catalan',
    'locale'  => 'ca_ES',
    'url'     => 'ca',
  ),
  array(
    'code'    => 'en',
    'name'    => 'English',
    'default' => true,
    'locale'  => 'en_US',
    'url'     => '',
  ),
));

First of all, I donā€™t know if itā€™s wrong, but the normal language setup of Kirby 2 seems to differ slightly. From the documentation (http://getkirby.com/docs/languages/setup) yours might rather look like just:

c::set('languages', array(
  array(
    'code'    => 'en',
    'name'    => 'English',
    'default' => true,
    'locale'  => 'en_US',
    'url'     => '/',
  ),
  array(
    'code'    => 'es',
    'name'    => 'Sapnish',
    'locale'  => 'es_ES',
    'url'     => '/es',
  ),
  array(
    'code'    => 'ca',
    'name'    => 'Catalan',
    'locale'  => 'ca_ES',
    'url'     => '/ca',
  ),
));
c::set('language.detect', true);

Not sure, what you are trying to do with c::set('lang.locale', false); and c::set('lang.available', array('en', 'de'));.

Secondly, what you showed me know is, that the page titles seem to change, which would be what languages in Kirby are supposed to do - titles can be translated. But you mentioned that the file names seem to change as well. That would be interesting to know what changes appear there :smiley:

I think all of the following entries are leftovers of Kirby 1

c::set('lang.available', array('en', 'de'));
c::set('lang.default', 'en');
c::set('lang.support', true);
c::set('lang.locale', false);

and can or even should be deleted.