Here at Blue Fish, we are huge fans of the ExpressionEngine add-on called Single Entry created by Viget Labs. This nifty little add-on makes it so that you can only have a single entry for a channel. This is great for Channels that you may not want the client posting multiple entries in. Perfect examples are channels like Homepage, Contact Us, About and so on.

Recently, we were tasked with builiding a multi-lingual site for the Texas Sea Grant. They wanted the ability to have translations in English and Spanish. Even though there are a few add-ons and one native way of doing multilingual sites we chose to use Transcribe by EE Harbor. Transcribe is a wonderful humongous add-on that handles multiple languages in a simple but robust way. It allows you to post multiple entries, one for each language. With that, though, we were going to run into a problem. We wanted to use Single Entry on the site as well but the duplicate entry way of handling language translations was not going to jive with Single Entry. For this particular site we are using Single Entry for the Contact Us, a Branding Guide page and an Advisory Committee listing page, to name a few. We asked ourselves "Selves, how are we going to make Single Entry and Transcribe work?". Fortunately, the answer was right in front of us.

Transcribe adds the language abbreviation to the first segment in the url for each language you create. For example, 'sp' would be added to the url (http://texasseagrant.org/sp) when a person views the Spanish Language side of the site. Reading through the Transcribe docs we noticed Dynamic Field Replacement. The docs state that DFR is useful for RTL (Right to Left) languages by creating a new field where needed. So we thought we could use this method for our client's site... Nope. We found that the Dynamic Field Replacement method wouldn't work due to Transcribe still needing to create a new entry.

Next, we thought about the abbreviation in the URL that Transcribe adds. The question was "How is it added without it breaking the segment structure of ExpressionEngine?". After sending the team at EEHarbor a support request regarding this, we learned that Transcribe doesn't break the ExpressionEngine segment structure but simply adds the language abbreviation to the url.

So the simple solution to use Single Entry with Transcribe was to create the single entry channel and in the custom field group for that channel, create 2 fields, one for English and one for Spanish. Then, within the template use a simple if:else conditional, like below:

{if transcribe:language_abbreviation == 'sp'}{title__sp}{if:else}{title}{/if}

Translating that into simple terms, if the language abbreviation of 'sp' is in segment_1, then Transcribe will show the custom field we created (this is using the same technique suggested by the Transcribe docs with the double underscore). A simple solution that allows us to continue the use of the Single Entry add-on on a multi-lingual site using Transcribe. And sometimes the simplest solution is the best.