You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

35 lines
812 B

7 years ago
7 years ago
7 years ago
  1. <?php
  2. /**
  3. * 다국어 언어 스트링을 출력합니다.
  4. * @param $key
  5. */
  6. function langs($key) {
  7. $CI = &get_instance();
  8. if( ! $langs = $CI->cache->get('site_language') )
  9. {
  10. $result = $CI->db->get('localize')->result_array();
  11. $accept_lang = $CI->site->config('accept_languages');
  12. $accept_lang = explode(',', $accept_lang);
  13. foreach($accept_lang as $val) {
  14. $langs[$val] = array();
  15. }
  16. foreach( $result as $row )
  17. {
  18. foreach($accept_lang as $ln) {
  19. $langs[$ln][ $row['loc_key'] ] = $row['loc_value_'.$ln];
  20. }
  21. }
  22. $CI->cache->save('site_language', $langs);
  23. }
  24. if( isset($langs[LANG][$key]) ) {
  25. return $langs[LANG][$key];
  26. }
  27. else {
  28. return '';
  29. }
  30. }