feat(i18n): configure French as default language without URL prefix
- Set French as default language with URL '/' (no prefix) - Set English language with URL '/en' - Replace hardcoded language buttons with dynamic links - Fix invalid HTML (remove <a> inside <button>) - Add aria-current attribute for accessibility Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
3de6bf4234
commit
e228c1757e
3 changed files with 11 additions and 3 deletions
|
|
@ -1,8 +1,9 @@
|
|||
<?php
|
||||
return [
|
||||
return [
|
||||
'code' => 'en',
|
||||
'default' => false,
|
||||
'direction' => 'ltr',
|
||||
'locale' => 'en_US.UTF-8',
|
||||
'name' => 'English',
|
||||
'url' => '/en',
|
||||
];
|
||||
|
|
@ -6,4 +6,5 @@ return [
|
|||
'direction' => 'ltr',
|
||||
'locale' => 'fr_FR.UTF-8',
|
||||
'name' => 'Français',
|
||||
'url' => '/',
|
||||
];
|
||||
|
|
@ -56,8 +56,14 @@
|
|||
</button>
|
||||
|
||||
<div id="lang-toggle">
|
||||
<button disabled>FR</button>
|
||||
<button><a href="/en">EN</a></button>
|
||||
<?php foreach($kirby->languages() as $language): ?>
|
||||
<a
|
||||
href="<?= $language->url() ?>"
|
||||
<?php e($language->code() === $kirby->language()->code(), 'aria-current="page"') ?>
|
||||
>
|
||||
<?= strtoupper($language->code()) ?>
|
||||
</a>
|
||||
<?php endforeach ?>
|
||||
</div>
|
||||
|
||||
<button id="menu-toggle">
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue