Changeset 793


Ignore:
Timestamp:
Jun 21, 2005, 9:25:59 PM (19 years ago)
Author:
plg
Message:
  • new function get_name_from_file to centralize the construction of displayed name from the filename
  • new function l10n which returns the corresponding value from $lang if existing. Else, the key is returned. This means that if a language item is not translated, the key is displayed instead (better than nothing).
Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/doc/ChangeLog

    r792 r793  
     12005-06-21 Pierrick LE GALL
     2
     3        * new function get_name_from_file to centralize the construction
     4        of displayed name from the filename
     5
     6        * new function l10n which returns the corresponding value from
     7        $lang if existing. Else, the key is returned. This means that if a
     8        language item is not translated, the key is displayed instead
     9        (better than nothing).
     10
    1112005-06-11 Pierrick LE GALL
    212
  • trunk/include/functions.inc.php

    r777 r793  
    754754  }
    755755}
     756
     757/**
     758 * returns the element name from its filename
     759 *
     760 * @param string filename
     761 * @return string name
     762 */
     763function get_name_from_file($filename)
     764{
     765  return str_replace('_',' ',get_filename_wo_extension($filename));
     766}
     767
     768/**
     769 * returns the corresponding value from $lang if existing. Else, the key is
     770 * returned
     771 *
     772 * @param string key
     773 * @return string
     774 */
     775function l10n($key)
     776{
     777  global $lang;
     778
     779  return (isset($lang[$key])) ? $lang[$key] : $key;
     780}
    756781?>
Note: See TracChangeset for help on using the changeset viewer.