Languages and Checkboxe categories


I’m struggling with categoris translations with checkbox…

I’m following out this multilanguage-secrets,

I’ve created a structure like this:

    label: Category
    type: select
        en: Design
        es: Diseño
        en: Tourism
        es:  Turismo
        en: Beauty
        es: Bellezza

But seems that is not working, also by getting value with
<?= l($page->category()->value()); ?>

I don’t know what is wrong! :frowning_face:
thanks a lot for any suggestions

Those blueprint translations only have an effect in the Panel, not for the frontend.

Using the l() method is the right way in a multi-language installation, but requires that you define your translation as language variable in your language files:, e.g.

# es.yml
design: Diseño
travel: Turismo
beauty: Belleza
design: Design
travel: Turismo
beauty: Bellezza

Once you’ve done that, you can call your translations like this:

<?= l($page->category()->value()) ?>
1 Like

Thanks @texnixe,
I’ve tried your solution within no success :frowning:

I was struggled a while, but finally I 've found a way… reading this ur suggestion :

In particular in my /site/languages/en.php I’ve set:

l::set('', 	'Sport');
l::set('category.web', 		'Web');
l::set('category.chess', 	'Chess');

in article blueprint:

    label: Category
    type: checkboxes
        en: Sport
        it: Sport
        en: Web
        it:  Web
        en: Chess
        it: Scacchi

and then in my template/snippet:

$cats = $article->category()->split();
$arraycats = $cats;
foreach ( $arraycats as  $category ) {
	echo  l::get('category.' . $category);

it works perfectly! Thanks for ur help! :blush:

I’m just missing something for translate “category” labels in panel… but I think is only a detail

I don’t know why you had to go for the solution with individual l::set() lines, since Kirby 2.4.0 the yaml version should work. But at least it works now.

Note that the translations in your blueprint do depend on the user language, the language doesn’t change, however, when you use the language switcher in the upper right.

1 Like

Because the other solution it didn’t work for me…
I’ve tried to set up blueprint like in ur suggestion:

design: Design
travel: Turismo
beauty: Bellezza
l::set( array(
'readmore' => 'Continua..',
'previous' => 'Previous',

also tried with variables inside array:

l::set( array(
'readmore' => 'Continua..',
'previous' => 'Previous',
'design' => 'Design',
'travel' => 'Turismo',
'beauty' => 'Bellezza',

with no success, I didn’t know what was wrong in my code…
maybe… probably… I didn’t understand the difference in printing values between :

<?= l($page->category()->value()) ?>


<?php l($page->category()->value()) ?>

l::set goes into a .php file, the example I used is a .yml file. You can’t mix these things.

Thanks @texnixe now I mean! I made a big mistake… :sweat:
I’ll try just when i’ll finish to set up my blog with blueprint plugin