Add conditionals compatibility

Pascal's Avatar

Pascal

24 Jan, 2012 10:33 PM via web

Hi,

I am using a multilingual module and I need to add conditionals or global variables for translating the breadcrumb. I tried using if and else statements and {variables} but no luck. Is it compatible with those or can it be made compatible?

Thanks.

  1. Support Staff 2 Posted by Stephen Lewis on 25 Jan, 2012 09:07 PM

    Stephen Lewis's Avatar

    Hi Pascal,

    Multi-language support was a big question during the development of Crumbly.

    I chatted with a few people familiar with multi-lingual sites, and everybody had a different way of doing things.

    The lack of a standard "EllisLab approved" approach for implementing a multi-language site in ExpressionEngine meant that I couldn't realistically implement it in Crumbly.

    I'd really like to address this though, so would appreciate it if you could tell me a bit more about what you're trying to achieve, and how you've organised the multi-lingual aspects of your site.

    Also, you mentioned a "multilingual module": could you expand on that please?

    Thanks,
    Stephen

  2. 3 Posted by Pascal on 26 Jan, 2012 11:10 PM

    Pascal's Avatar

    I replied to your questions, but it doesn't seem to appear...

  3. 4 Posted by Pascal on 26 Jan, 2012 11:14 PM

    Pascal's Avatar

    Hi Stephen,

    I am using a translating module called Biber. I would link to it, but I think it will not post my comment if I do.

    I use if and else statements to show the translation depending on what language the user has chosen and I can also use {variables} to show the word in the chosen language.

    This is why I would need to be able to somehow use conditionals or {variables} in Crumbly.

    Thanks.

  4. Support Staff 5 Posted by Stephen Lewis on 29 Jan, 2012 11:56 AM

    Stephen Lewis's Avatar

    Hi Pascal,

    Right, now I understand how Biber works, and what you need. Unfortunately, there's no neat way of doing this in Crumbly.

    Crumbly provides its own conditionals, so you could check the current URL segment being processed (for example), but I don't really know how that's going to help you. The only "solution" I can think of involves hard-coding the non-English equivalents of your breadcrumb segments. For example:

    {!-- URL is http://example.com/destinations/hotels/ritz-carlton --}
    {!-- Main template --}
    {if '{language_code}' == 'es'}{embed='_inc/_nav_crumbs_es'}{/if}
    
    {!-- _nav_crumbs_es --}
    {exp:crumbly:breadcrumbs custom_url:pattern='template_group/template/entry'}
        {if breadcrumb_segment == 'destinations'}Destinos
        {if:elseif breadcrumb_segment == 'hotels'}Hoteles
        {if:else}{breadcrumb_title}{/if}
    {/exp:crumbly:breadcrumbs}
    

    That would work (I think), but it's hardly elegant. Let me know how you get on.

    Cheers,
    Stephen

Reply to this discussion

Internal reply

Formatting help or Preview

Attached Files

You can attach files up to 10MB

Five times two is what?

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.