Skip to content

bcartier/LangUrl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 

Repository files navigation

#Language URL for Statamic 2

###Usage: Intended to help build a language toggle for Statamic 2. For example, in a English and French site where English is the default language, you can use {{ lang_url locale="fr" }} and {{ lang_url locale="default" }} in your templates to easily switch languages of the current page:

{{ if locale == "en" }}
  <a href="proxy.php?url=https%3A%2F%2Fgithub.com%2F%7B%7B+lang_url+locale%3D"fr" }}'>Français</a>
{{/if}

{{ if locale == "fr" }}
  <a href="proxy.php?url=https%3A%2F%2Fgithub.com%2F%7B%7B+lang_url+locale%3D"default" }}'>English</a>
{{/if}

###To Do: Detect the default language instead of requiring "default" as the locale parameter.

About

Addon for Statamic v2.5 to help build a language toggle

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages