source: contrib/Dms/inc/inc.Language.php @ 3526

Revision 3526, 1.0 KB checked in by afernandes, 13 years ago (diff)

Ticket #1416 - Disponibilizado modulos Timesheet e DMS para a comunidade.

  • Property svn:executable set to *
Line 
1<?php
2
3function getLanguages()
4{
5        GLOBAL $settings;
6       
7        $languages = array();
8       
9        $path = $settings->_rootDir . "languages/";
10        $handle = opendir($path);
11       
12        while ($entry = readdir($handle) )
13        {
14                if ($entry == ".." || $entry == ".")
15                        continue;
16                else if (is_dir($path . $entry))
17                        array_push($languages, $entry);
18        }
19        closedir($handle);
20       
21        return $languages;
22}
23
24include $settings->_rootDir . "languages/" . $settings->_language . "/lang.inc";
25
26function getMLText($key, $replace = array())
27{
28        GLOBAL $settings, $text;
29
30        if (!isset($text[$key]))
31                return "Error getting Text: " . $key . " (" . $settings->_language . ")";
32       
33        $tmpText = $text[$key];
34        if (count($replace) == 0)
35                return $GLOBALS['phpgw']->translation->convert($tmpText,'iso-8859-1',$displayCharset);
36       
37        $keys = array_keys($replace);
38        foreach ($keys as $key)
39                $tmpText = str_replace("[".$key."]", $replace[$key], $tmpText);
40
41        return $GLOBALS['phpgw']->translation->convert($tmpText,'iso-8859-1',$displayCharset);
42}
43
44function printMLText($key, $replace = array())
45{
46
47        print getMLText($key, $replace);
48}
49
50?>
Note: See TracBrowser for help on using the repository browser.