Skip to content

Instantly share code, notes, and snippets.

@JonasEriksson
Created October 3, 2016 09:52
Show Gist options
  • Save JonasEriksson/40ae2364a081f0f3b755ffef9918361e to your computer and use it in GitHub Desktop.
Save JonasEriksson/40ae2364a081f0f3b755ffef9918361e to your computer and use it in GitHub Desktop.
Display different translations based on Mura site content directory structure.
<!--- Multilanguage sites often are structed with a "directory" structure of www.apple.com/se or www.apple.com/de for different languages.
If your site uses this option in Mura (either a folder or page named accordingly (en, de, se, ...) with other pages below this), the following might be a simple solution for using
templates for page layouts or components. --->
<!--- Mura Translations is a great plugin, but sometimes only a few small sections need to be translated, this is where is is one of probably many options --->
<!--- Note: The following commented out line is only required once per page, you could set this in the header for simplicity. --->
<!--- <cfset currentURL = "#CGI.SERVER_NAME#" & "#CGI.PATH_INFO#"> --->
<cfif currentURL CONTAINS '/en'> <!-- display english language -->
<h3>This should show on the english "site".</h3>
<cfelseif currentURL CONTAINS '/de' OR currentURL CONTAINS '/at'> <!-- display german language -->
<h3>This should show on the german and austrian "site".</h3>
<cfelse> <!-- display default language -->
<h3>This should show on whatever your default language "site" is.</h3>
</cfif>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment