I’ve been using Kirby’s Language feature and am loving it so far.
Is there a way to create additional language attributes? My goal is to have a “short name” (e.g. English > U.S.A) attribute for each language. (And I’m using Kirby 3.)
en.php
return [
'code' => 'en',
'default' => true,
'direction' => 'ltr',
'locale' => 'en_US',
'name' => 'English',
'shortname' => 'USA',
'url' => '/',
];
And I’m trying to use it like this.
<?php foreach($kirby->languages() as $language): ?>
<li<?php e($kirby->language() == $language, ' class="active"') ?>>
<a href="<?php echo $language->url() ?>">
<?php echo html($language->shortname()) ?>
</a>
</li>
<?php endforeach ?>
Currently, it’s returning Call to undefined method Kirby\Cms\Language::shortname()
. Any tips would be appreciated!