New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FR: Locale filter #759

Closed
andypillip opened this Issue Jun 15, 2016 · 10 comments

Comments

Projects
None yet
3 participants
@andypillip

andypillip commented Jun 15, 2016

Right now it's not possible to filter with locales, which is absolutely necessary for multilingual websites.

It's a bad user experience to get mixed contents of two languages.
Not showing anything than showing a foreign language would be better.

Right now statamic doesn't offer any filter-option for that, f.e. {{ collection:jobs locale:is="{{ locale }}" }} will not work.

Also the nav Tags would need that filter.

@jasonvarga

This comment has been minimized.

Member

jasonvarga commented Jun 22, 2016

It should use the locale data of whatever you're in. Keep in mind that if you haven't localized a field, it falls back to the default locale. Maybe that's what you're seeing?

@andypillip

This comment has been minimized.

andypillip commented Jun 23, 2016

thx Jason.

it falls back to the default locale

That's what I consider a bad user experience: Mixed languages on one site.

So it should be at least possible to deactivate that function by filtering to the current language exclusively.

@jasonvarga

This comment has been minimized.

Member

jasonvarga commented Jun 23, 2016

Okay so the 'solution' is to just make sure you have everything translated.

Are you asking for a way to show only entries that have been translated into the specified locale?

@andypillip

This comment has been minimized.

andypillip commented Jun 23, 2016

@jasonvarga yes, that's what I'm asking for. Is that possible somehow?

@jasonvarga

This comment has been minimized.

Member

jasonvarga commented Jun 23, 2016

Ok cool, just checking. We can make that happen.

@andypillip

This comment has been minimized.

andypillip commented Jun 23, 2016

@jasonvarga that'd be cool.

Related: How is it possible to provide a language switch, that switches the current page?

@jackmcdade jackmcdade changed the title from Locale filter is missing to FR: Locale filter Jun 26, 2016

@jasonvarga

This comment has been minimized.

Member

jasonvarga commented Jul 13, 2016

In the next release you'll be able to do {{ collection locale="only fr" }}, for example.

@andypillip

This comment has been minimized.

andypillip commented Aug 3, 2016

@jasonvarga nice, so "only { locale }" will filter to the current locale?

Will that filter also work on the nav-tag?

When is the next release expected?

@jasonvarga

This comment has been minimized.

Member

jasonvarga commented Aug 3, 2016

Next release is coming very soon.

The nav tag is a little different, so you will still get the fallbacks.

@jasonvarga jasonvarga closed this Aug 4, 2016

@andypillip

This comment has been minimized.

andypillip commented May 22, 2017

@jasonvarga this doesn't seem to work with 2.5.9?

I tried {{ collection:posts locale="only {locale}" }} as well as {{ collection:posts locale="only en" }}. Default locale is DE.

I created a new post from CP and didn't provide a translation. Also I checked that in the posts/en/ folder there was no file for that post.

There's no file in en, yet the post gets listed.

Thanks for checking.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment