Jump to content

how to fetch $page->name in different languages


bmacnaughton
 Share

Recommended Posts

We have a three language web site - 'de', 'en', 'fr' with 'de' being the default.

There are pages for which we want to use the name (it's unique within its parent-scope) as in the attachment.

But when I fetch the name it does not return the name for the language - it always returns the name for the default language (guertel, in this case).

I've tried $page->getLanguageValue($lang, 'name'), but name is not a "real" field, so it returns null.

I can hack around it by extracting the last segment of the URL associated with that page (which is language sensitive) but it seems like I must be missing something.

Is there some way to fetch $page->name for the $user->language setting?

 

 

Screenshot from 2017-04-13 08-12-50.png

Link to comment
Share on other sites

Thanks. I hadn't seen those functions.

Any idea why it doesn't return a language-specific name by default? The URL is language-specific by default, so $page->localUrl() isn't really needed as I can get that value just by using $page->url.

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...