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

Taxonomies are not translated #1371

Closed
joaojoyce opened this Issue Apr 4, 2017 · 3 comments

Comments

Projects
None yet
2 participants
@joaojoyce

joaojoyce commented Apr 4, 2017

Hi,

I'm using Stamic v. 2.5.7

Expected behaviour

I'm trying to show all entries in a taxonomy by doing the following:

        {{taxonomy:clinical_case_type  show="all" }}
            <div>
                <h3>{{ title }}</h3>
                <a href="{{ url }}" >View</a>
            </div>
        {{/taxonomy:clinical_case_type}}

But my content shows in the default locale.
To try and fix this I have created a new tag taxonomy_switch to force the translation:

    public function index()
    {
        $url       = $this->get('url', URL::getCurrent());
        $lang      = $this->get('lang',site_locale());
        $term      = $this->get('term','url');

        $uri = URL::getDefaultUri(site_locale(), $url);
        return Content::whereUri($uri)->in($lang)->get($term);
    }

But I still get some errors because sometimes I can't get the URI.

Actual behaviour

I believe the code bellow should work fine!
But if there is some custom tag as workaround I would use it.

        {{taxonomy:clinical_case_type  show="all" }}
            <div>
                <h3>{{ title }}</h3>
                <a href="{{ url }}" >View</a>
            </div>
        {{/taxonomy:clinical_case_type}}
@jasonvarga

This comment has been minimized.

Member

jasonvarga commented Apr 5, 2017

How have you translated your taxonomy term?

@joaojoyce

This comment has been minimized.

joaojoyce commented Apr 7, 2017

We have:

  1. Created a Taxonomy in the backoffice
  2. Attributed a simple fieldset (title text and template).
  3. Created new terms and translated them.

When we try to do:

        {{taxonomy:clinical_case_type  show="all" }}
            <div>
                <h3>{{ title }}</h3>
                <a href="{{ url }}" >View</a>
            </div>
        {{/taxonomy:clinical_case_type}}

Neither of the terms get translated.

To fix it we have tried to build custom tags. Should this functionality work out of the box?

@jasonvarga

This comment has been minimized.

Member

jasonvarga commented Apr 13, 2017

Fixed for next release. Good catch!

Here's the patch if you want to apply it right now.

image

$this->terms = $this->terms->localize($this->get('locale', site_locale()));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment