statamic-fetch icon indicating copy to clipboard operation
statamic-fetch copied to clipboard

Problem with locales

Open Burans opened this issue 5 years ago • 3 comments

Hi! I've been using Fetch for a while without any problems. Yesterday I added a second locale to a site and got into some issues.

  • Primary locale works fine.
  • I'm using Fetch to output JSON in a script tag with{{ fetch pages="{ url }" }}
  • I can access the correct localised data with/!/Fetch/page/default-slug?locale=en (en is the secondary locale in my case.)
  • But /!/Fetch/page/localised-slug gives an error Page [localised-slug] not found.

Is this the intended behaviour? Shouldn't Fetch work with localised slugs also?

Thanks!

Burans avatar Jul 24 '19 13:07 Burans

I got it partly working by {{ fetch pages="{default locales url}" locale="{current locale}"}} but now all assets have wrong urls. They should stay /assets/img/image.jpg but they become /locale/assets/img/image.jpg.

Any help greatly appreciated! Thanks!

Burans avatar Jul 25 '19 06:07 Burans

Hi @Burans, apologies for the late reply.

Locale-support was added to Fetch at a later stage by popular demand and hasn't been well tested/maintained if I'm honest...

Unfortunately, I won't be able to help here any time soon. Hope you find a solution/workaround for your issue!

aryehraber avatar Jul 30 '19 14:07 aryehraber

@Burans I think this is normal behaviour inside Statamic and can be easily fixed with a symlink -> https://docs.statamic.com/localization#locales (search symlink)

felixtosh avatar Apr 14 '20 10:04 felixtosh