How can I translate the panel fields?
I remember that in kirby 1 it could be achieved in the follow way:
fields:
title:
label:
en: Title
es: Título
type: text
text:
label:
en: Text
de: Texto
Has anyone achieved this?
I do exactly the same in my blueprints and it works. The problem could be in your multilingual settings. Did you declare your languages in config.php as explain in the Docs? It has changed a lot in Kirby 2. Languages setup
This still works. Have you enabled multi-language in config.php? And are the languages both defined?
Yes, I have a config.php file with the following:
/*
---------------------------------------
Language
---------------------------------------
*/
c::set('languages', array(
array(
'code' => 'es',
'name' => 'Spanish',
'locale' => 'en_LA',
'url' => '/',
'default' => true,
),
array(
'code' => 'en',
'name' => 'English',
'locale' => 'en_US',
'url' => '/en',
),
));
I’m trying to translate the inputs of the site file.
When I add the language setting on the blueprint, In the panel only appears the key name (title) instead the correct translated label. I’ve tested with the 2.1 version and the current official version.
I appreciate any help
Your settings seem correct, and my translated site
blueprint works.
Perhaps an error somewhere in your blueprint, could you also post the whole blueprint?
Here is the blueprint for site.php:
<?php if(!defined('KIRBY')) exit ?>
title: Site
pages: default
fields:
title:
label:
es: Titulo
en: Title
type: text
author:
label:
es: Autor
en: Author
type: text
description:
label:
es: Descripción
en: Description
type: textarea
keywords:
label:
es: Palabras claves
en: Keywords
type: tags
copyright:
label:
es: Derechos de autor
en: Copyright
type: textarea
address:
label:
es: Dirección
en: Address
type: textarea
brochure:
label:
es: Archivo del folleto
en: Brochure File
type: text
Hm, maybe this is a misunderstanding of how this feature works, after all? The blueprint is correct. But the labels only change if you change the user language, not if you switch between the language variants of your content?
@texnixe, That was the trick and has a lot of sense now.
I changed the user language to “Español (América Latina)” and I replaced all the languages keys es
by es_LA
and it is working now, so my blueprint looks as follow:
title: Site
pages: default
fields:
title:
label:
es_LA: Titulo
en: Title
type: text
author:
label:
es_LA: Autor
en: Author
type: text
description:
label:
es_LA: Descripción
en: Description
type: textarea
...
Thanks a lot!!
PS. Sorry for my english