Hello,
i try to follow the doc example for multi-languages site http://getkirby.com/docs/languages/switching-languages but in the foreach
foreach($site->languages() as $language) {
$page->url($language->code())
}
but i don’t have the expected URL
For example: my URL
/user/stefano
expected URL
/en/user/stefano
URL generated in the foreach $page->url($language->code())
/en/partner
(a /partner URL exist in my content directory)
Any idea?
Stefano
The default language can be accessed without the language code in the URL. You have to change the url
attribute of the English language definition to make it work like you want it to: http://getkirby.com/docs/languages/setup
this is my configuration
c::set(‘languages’, array(
array(
‘code’ => ‘it’,
‘name’ => ‘Italiano’,
‘default’ => true,
‘locale’ => ‘it_IT’,
‘url’ => ‘/’,
),
array(
‘code’ => ‘en’,
‘name’ => ‘English’,
‘locale’ => ‘en_US’,
‘url’ => ‘/en’,
)
));
Ah, OK. So it’s the other way around.
What exactly does not work at the moment?
if i am in the page
/user/stefano
the language url in the navbar is
/en/partner
not
/en/users/stefano
user/stefano
is simply a page in the content directory?
And maybe could you pls. give a brief outline of your structure in the /content
folder?
yes i have a user folder and inside i have
/stefano
/marco
/paolo
other dir are
/1-home
/2-partner
/3-contatcus
/user*.*
/user/1-stefano
/user/2-marco
/user/3-paolo
/error
But then it doesn’t make any sense why the link becomes /en/partner
. Could you please post your full template for the user page?
And this piece of code looks a bit strange as well, what is that supposed to do? It doesn’t create any links or whatever …