aboutsummaryrefslogtreecommitdiffstats
path: root/include/functions_user.inc.php
diff options
context:
space:
mode:
Diffstat (limited to 'include/functions_user.inc.php')
-rw-r--r--include/functions_user.inc.php34
1 files changed, 34 insertions, 0 deletions
diff --git a/include/functions_user.inc.php b/include/functions_user.inc.php
index 41321a587..25dc3efda 100644
--- a/include/functions_user.inc.php
+++ b/include/functions_user.inc.php
@@ -497,4 +497,38 @@ SELECT name
return $groupname;
}
+
+/**
+ * return the file path of the given language filename, depending on the
+ * availability of the file
+ *
+ * in descending order of preference: user language, default language,
+ * PhpWebGallery default language.
+ *
+ * @param string filename
+ * @return string filepath
+ */
+function get_language_filepath($filename)
+{
+ global $user, $conf;
+
+ $directories =
+ array(
+ PHPWG_ROOT_PATH.'language/'.$user['language'],
+ PHPWG_ROOT_PATH.'language/'.$conf['default_language'],
+ PHPWG_ROOT_PATH.'language/'.PHPWG_DEFAULT_LANGUAGE
+ );
+
+ foreach ($directories as $directory)
+ {
+ $filepath = $directory.'/'.$filename;
+
+ if (file_exists($filepath))
+ {
+ return $filepath;
+ }
+ }
+
+ return false;
+}
?> \ No newline at end of file