api.yalflangswitch.php 748 B

123456789101112131415161718192021222324252627282930313233343536
  1. <?php
  2. /**
  3. * Just a basic YALF language switcher class that illustrates how your application
  4. * live-locale switching can work.
  5. */
  6. class YalfLangSwitch {
  7. /**
  8. * Yep!
  9. */
  10. public function __construct() {
  11. //nothing to see here!
  12. }
  13. /**
  14. * Preloads available locale list and
  15. *
  16. * @global object $system
  17. *
  18. * @return void
  19. */
  20. public static function render() {
  21. global $system;
  22. $result = '';
  23. $allLocales = rcms_scandir($system::LANG_PATH);
  24. if (!empty($allLocales)) {
  25. foreach ($allLocales as $io => $each) {
  26. $result .= wf_Link('?yalfswitchlocale=' . $each, $each) . ' ';
  27. }
  28. }
  29. return($result);
  30. }
  31. }