Pastebin is 300% more awesome when you are logged in. Sign Up, it's FREE!
Guest

WordPress Set Locale Simple Plugin

By: a guest on Apr 18th, 2012  |  syntax: PHP  |  size: 0.49 KB  |  hits: 505  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
This paste has a previous version, view the difference. Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. <?php
  2. /*
  3. Plugin Name: Set Locale
  4. Plugin URI: http://yoursite.tld
  5. Description: Sets the locale
  6. Author: Johannes Pilkahn
  7. Version: 1.0
  8. Author URI: http://tramprennen.org
  9. */
  10.  
  11. function sl_current_lang() {
  12.         $sl_uri = $_SERVER["REQUEST_URI"];
  13.         $sl_lang = array_pop( explode( '/',  $sl_uri ) );
  14.  
  15.         return $sl_lang;
  16. }
  17.  
  18. function sl_set_locale() {
  19.  
  20.         if( sl_current_lang() == 'en' ) {
  21.                 define( 'WPLANG', 'en_US' );
  22.         } else {
  23.                 define( 'WPLANG', 'el_GR' );
  24.         }
  25. }
  26.  
  27. sl_set_locale();
  28.  
  29. ?>