ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Idea for multilingual {title}

April 19, 2012 4:38am

Subscribe [4]
  • #1 / Apr 19, 2012 4:38am

    DoctorLove

    38 posts

    Hey,

    we have a lot of multilingual websites running.
    When translations needs to be happen 1 on 1, we place the different language fields in the same channel. eg activity_channel

    We use in the publish tab Title as the default language and add other fields.
    So in the template we have the following tags

    {title}  (= default language)
    {activity_title_fr}
    {activity_title_de}
    {activity_title_en}

    In the template we need to check for the default language and output {title} otherwise it’s {activity_title_{segment_1}}
    But I’d like to have just {title} and based on the segment in the uri, the correct value will be set.
    And also do the same for category_title.

    I tried already with a plugin, but there I can only output the tags and not the values, due parsing order, or am I missing something?
    Do I need to look into hooks? Anyone other insights? More than welcome!

    kind regards,
    Vic

     

  • #2 / Apr 19, 2012 4:46am

    DoctorLove

    38 posts

    eg. of the code we use now between channel:entries tag

    {if {segment_1} == 'nl'}
        <h1>{title}</h1>
    {if:else}
        <h1>{activity_title_{segment_1}}</h1>
    {/if}
  • #3 / Apr 19, 2012 4:52am

    e-man

    1816 posts

    I suggest you check out this wiki article:
    http://expressionengine.com/wiki/Multi_language_site_alternative

    That’s how I’ve been doing most of my multi-language sites for the past few years, and it fits what you’re describing above.

    There’s also a fairly new module from EE Harbor called Transcribe which could be helpful, haven’t tried it out yet though:
    http://eeharbor.com/transcribe

  • #4 / Apr 19, 2012 5:01am

    DoctorLove

    38 posts

    Thanks Erwin,

    we follow more or less the same approach now…

    But I was just wondering if there exists an addon to just place {title} and that the parsing will set the value based on the uri.
    So you can omit the condition.

    <h2 class="title">{if country_code != "en"}{{country_code}_title}{if:else}{title}{/if}</h2>

    and just place

    <h2 class="title">{title}</h2>

    I came up with the following plugin, which output the right tag, but I doesn’t get parsed, because of the parsing order.

    {exp:multilang:title channel="activity"}

    Just thinking out loud here, maybe looking for a better or nicer solution… 😊


    grtz
    Vic

  • #5 / Apr 19, 2012 5:05am

    e-man

    1816 posts

    Not sure I see the problem, your default language has a country_code too, even if you’re not using the /fr/ or /en/ segment.

  • #6 / Apr 19, 2012 5:12am

    DoctorLove

    38 posts

    It’s more about the fields I define in the channel.

    I don’t create a new field for the default language and use the standard Title in the publish tab.

    So for “nl” as default language, I use the default Title field and for the other language I’ve created new fields
    eg. activity_title_fr, activitiy_title_en, activity_title_de

    So for nl I can’t say {activity_title_{segment_1}}

    I CAN make a new field for nl, but rather don’t want that, maybe I need to! 😊

    regards
    Vic

  • #7 / Apr 19, 2012 5:24am

    e-man

    1816 posts

    Ah I see, well I always add a field for the default language as well, the {title} only serves for finding things in the cp 😊

  • #8 / Apr 19, 2012 5:43am

    DoctorLove

    38 posts

    Seems that will be the way to go…
    Always found it a bit dumb to fill in the title twice, but we can solve that with a specific fieldtype.

    So you also duplicate the url_title field for the default language?
    Or don’t you use translated uri’s?

    regards,
    Vic

  • #9 / Apr 19, 2012 6:54am

    e-man

    1816 posts

    No translated urls, indeed.

  • #10 / Apr 19, 2012 2:15pm

    Shane Eckert

    7174 posts

    Hey vicrau,

    I am glad to see that e-man was able to help you out!

    Is there anything else I can do for you?

    Cheers,

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases