aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--doc/ChangeLog10
-rw-r--r--include/functions.inc.php25
2 files changed, 35 insertions, 0 deletions
diff --git a/doc/ChangeLog b/doc/ChangeLog
index b3d898ad6..4c6b71d8c 100644
--- a/doc/ChangeLog
+++ b/doc/ChangeLog
@@ -1,3 +1,13 @@
+2005-06-21 Pierrick LE GALL
+
+ * 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).
+
2005-06-11 Pierrick LE GALL
* errors and informations boxes : management centralized in
diff --git a/include/functions.inc.php b/include/functions.inc.php
index ce64148a7..2b1668de9 100644
--- a/include/functions.inc.php
+++ b/include/functions.inc.php
@@ -753,4 +753,29 @@ SELECT element_id
mass_inserts(CADDIE_TABLE, array('element_id','user_id'), $datas);
}
}
+
+/**
+ * returns the element name from its filename
+ *
+ * @param string filename
+ * @return string name
+ */
+function get_name_from_file($filename)
+{
+ return str_replace('_',' ',get_filename_wo_extension($filename));
+}
+
+/**
+ * returns the corresponding value from $lang if existing. Else, the key is
+ * returned
+ *
+ * @param string key
+ * @return string
+ */
+function l10n($key)
+{
+ global $lang;
+
+ return (isset($lang[$key])) ? $lang[$key] : $key;
+}
?>