View more context

 

BaronGrivet

which returns the data from that object according to the Locale/ fallbacks.

BaronGrivet

But looking around the source code I can't find anything that does this.

BaronGrivet

Am I missing something, or does this sort of method not exist?

BaronGrivet

Nevermind - I've got something that works, it's just clunkier than I expected.

Chrissi

I need the same thing - can you possibly post how you did it?

blueskies

Hoping someone can point me to some docs I missed or a code snippet... I need to run a task that updates MetaDescriptions of all pages (of a specific type). We have these pages saved in 2 locales, so for one locale the MetaDescr is blabla1 and the other locale it's blabla2. How do I properly grab the published pages (I don't want to accidentally publish unpublised ones 😉 ) and update this field for both locales, then publish in each locale?

Chrissi

Can anyone help? Given a page, how can I see which locales the page is published in? (Fluent)

robbieaverill

something like this might work (untested):

  1. $page = SiteTree::get()->byID(123);
  2. $locales = Locale::get();
  3.  
  4. $localesPageIsIn = [];
  5. foreach ($locales as $locale) {
  6. if ($page->isPublishedInLocale($locale)) {
  7. $localesPageIsIn[] = $locale;
  8. }
  9. }
Chrissi

Nice! That did the trick (with if ($page->isPublishedInLocale($locale->Locale)) {)

fuzz10

Does anyone know whether it is possible to disable a locale in Fluent without actually erasing it ? I've tried unpublishing all pages, and that seems to work except it still produces "alternate" urls (both in the metatags and sitemap.xml). Erasing the 2nd locale is an option, but then I do not have to option of including the 'locale' part in the URL anymore.

tractorcow

I've started working on a locale menu for fluent. This should hopefully make it easier working on multiple locales on a single item. https://github.com/tractorcow-farm/silverstripe-fluent/pull/562

Show 1 attachment(s)
GitHub  
WIP Initial commit of new localisation menu by tractorcow · Pull Request #562 · tractorcow-farm/silverstripe-fluent

Just getting the look and feel right Not sure how to fit descriptions in. Maybe tooltips that show on hover? If I get silverstripe/silverstripe-framework#9305 merged I might work on adding JS tool...

Hide attachment content
👍 (4)
wmk

@tractorcow good to see! Thanks for improving fluent. I had a customer where I added fluent to an existing site and I thought it's not always clear for him if he's in the main language or in the translation.

tractorcow

Maybe we need to show the failovers "you are viewing the page in <locale> This page fails over from <locale1> if not localised This page fails over to <locale2, locale3> if they are not localised"