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.

User /Error messages in diffeerent languges

October 15, 2011 5:43am

Subscribe [2]
  • #1 / Oct 15, 2011 5:43am

    hjbollinger

    14 posts

    I’m not sure whether I missed someting or if it is simply not possible out of the box in ee.
    I developed a multilanguage site in ee (directories de/en/fr in the root with htaccess and index.php ) - I think it now gives a nice ux.
    Where I struggled were the user messages/system messages in the three languages. In the cp you can choose the frontend lang. But only one and actually we need quite often 3 or more (at least here in Switzerland 😊 ). I had to do it with csm but I think this is not really ideal as you have to find all the possible system messages (ACT) and handle this with a 3rd party addon.
    Is there no native way in ee?

  • #2 / Oct 24, 2011 10:23pm

    John St-Amand

    865 posts

    System messages in EE are somewhat limited, so I suspect CSM is much closer to providing you with a solution than EE would natively.  Because CSM allows you to define regular templates for the message to be displayed, and as a result regular EE tags may be used in the template, you could create a channel to hold the system messages themselves and then get clever with the display of the message based on your language segment.  Yes, it does mean you need to know what all the messages are and then create alt language versions of each, but really you’d have to do that anyway since EE doesn’t provide you with the translations of those system messages.

    It would be great if they provided a list of the native messages somewhere so you know what all of them are and you could create different language versions of them, along with a segment number or something.  I’ve not tried this, but if you knew what the exact text of every english error was, you could create a channel of errors that includes a field for “english text”, and then when you display another language, let’s say french, you could point to one system message template with an entries tag in it searching for the an entry with content that matches and display the french equivalent.

    So in the CSM template:

    {if segment_2 == "en"}{content}{/if}
    
    {if segment_2 != "en"}
    {exp:channel:entries channel="errors" limit="1" search:error_en="{content}"}
    
    {error_{segment_2}}
    
    {/exp:channel:entries}
    
    {/if}

    I’ve not tried this, but I have a suspicion it might work.  But i have no idea whether it would be easy or difficult to find/collect a list of all system messages that would be character-perfect permitting a search like this to work.  It also may be that the content variable is required in the template, which may complicate things slightly - though you could in the non-english version still include is and simply put it in a div that is set to display: none.

    This is just an untested idea for my part.  I’d be curious to know if you try it and whether it works.  It would be easy enough to test with a common system message like “you are now logged in” or something.  It may be a legacy issue as well though - particularly if Ellis Lab were to change so much as a character in a system message with future updates to EE.

    Hope this helps.

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

ExpressionEngine News!

#eecms, #events, #releases