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

get_content does not display localized results #989

Closed
zenboy4ever opened this Issue Sep 26, 2016 · 3 comments

Comments

Projects
None yet
4 participants
@zenboy4ever

zenboy4ever commented Sep 26, 2016

Expected behaviour

{{ get_content from="{ segment_1 }" }}{{ title }}... should display localized value

Actual behaviour

The English value is displayed

Steps to reproduce

{{ get_content from="{ segment_1 }" }}{{ title }}...

Server configuration

Operating system:

Web server:
Ubuntu
PHP version:
7.0
Statamic version:
2.1.9
Updated from an older Statamic or fresh install:
Updated

Note:
get_content does work correctly if the values are in an array and retrieved using a tag pair

@rrelmy

This comment has been minimized.

rrelmy commented Dec 21, 2016

{{ parent }} is also affected

The problem is down deep inside the ContentService class, the uri and uriExists both use the default locale.

Both methods should probably use the current locale and accept an optional parameter $locale to overwrite it.

@jackmcdade

This comment has been minimized.

Member

jackmcdade commented Mar 17, 2017

I believe this is fixed, can you guys confirm?

@jasonvarga jasonvarga closed this Jun 6, 2017

@rrelmy

This comment has been minimized.

rrelmy commented Aug 17, 2017

Can we reopen this?

ContentService always use default_locale() as example in uriExists.
This leads to problems when the slug is different in the secondary locale.

The code in the original issue still breaks

{{ get_content from="{ segment_1 }" }}
    {{ title }}
{{ /get_content }}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment