Skip to content
This repository has been archived by the owner. It is now read-only.

example in doc for locale filtering in whereTranslation scope #487

Merged
merged 1 commit into from Jun 27, 2018

Conversation

@m13z
Copy link
Contributor

commented Jun 27, 2018

The whereTranslation scope allows for a third parameter $locale that filters translations in that locale.

I needed that feature to filter slugs in specific locales.

Example:
example.com/map -> map page in english
example.com/sv/karta -> map page in swedish

The problem is that I was querying the pages model using the slug and sv/map would return (correctly) the map page instance, but that's not a correct locale/slug combination.

To make that work using the provided scope it should filter also by locale, which that third parameter enables.

I wasn't aware of it until I went into the source code to try and fix my problem, and the "fix" was already there.

Docs updated so that anybody with the same issue is aware of the option.

example in doc for locale filtering in whereTranslation scope
The whereTranslation scope allows for a third parameter in the signature.
Added an example in the readme so that reader is aware of it.

@Gummibeer Gummibeer merged commit 5a63ed1 into dimsav:master Jun 27, 2018

1 check passed

continuous-integration/styleci/pr The analysis has passed
Details
@Gummibeer

This comment has been minimized.

Copy link
Collaborator

commented Jun 27, 2018

@m13z thanks for this PR!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
2 participants
You can’t perform that action at this time.