API changes to handle egw_ prefix in lang files

This commit is contained in:
Oscar Manuel Gómez Senovilla 2007-10-14 16:12:39 +00:00
parent 861768e0e3
commit b018b25a15
2 changed files with 8 additions and 5 deletions

View File

@ -208,7 +208,7 @@
*/ */
function getInstalledLanguages() function getInstalledLanguages()
{ {
$GLOBALS['egw']->db->query('SELECT DISTINCT lang FROM phpgw_lang'); $GLOBALS['egw']->db->query('SELECT DISTINCT lang FROM egw_lang');
while (@$GLOBALS['egw']->db->next_record()) while (@$GLOBALS['egw']->db->next_record())
{ {
$installedLanguages[$GLOBALS['egw']->db->f('lang')] = $GLOBALS['egw']->db->f('lang'); $installedLanguages[$GLOBALS['egw']->db->f('lang')] = $GLOBALS['egw']->db->f('lang');

View File

@ -40,6 +40,9 @@
define('PHP_SHLIB_PREFIX',PHP_SHLIB_SUFFIX == 'dll' ? 'php_' : ''); define('PHP_SHLIB_PREFIX',PHP_SHLIB_SUFFIX == 'dll' ? 'php_' : '');
} }
// Define prefix for langfiles (historically 'phpgw_')
define('EGW_LANGFILE_PREFIX', 'egw_');
class translation class translation
{ {
var $userlang = 'en'; var $userlang = 'en';
@ -238,10 +241,10 @@
*/ */
function add_setup($lang) function add_setup($lang)
{ {
$fn = EGW_SERVER_ROOT.'/setup/lang/phpgw_' . $lang . '.lang'; $fn = EGW_SERVER_ROOT.'/setup/lang/' . EGW_LANGFILE_PREFIX . $lang . '.lang';
if (!file_exists($fn)) if (!file_exists($fn))
{ {
$fn = EGW_SERVER_ROOT.'/setup/lang/phpgw_en.lang'; $fn = EGW_SERVER_ROOT.'/setup/lang/' . EGW_LANGFILE_PREFIX . 'en.lang';
} }
if (file_exists($fn)) if (file_exists($fn))
{ {
@ -552,7 +555,7 @@
// Visit each app/setup dir, look for a egw_lang file // Visit each app/setup dir, look for a egw_lang file
foreach($apps as $app) foreach($apps as $app)
{ {
$appfile = EGW_SERVER_ROOT . SEP . $app . SEP . 'setup' . SEP . 'phpgw_' . strtolower($lang) . '.lang'; $appfile = EGW_SERVER_ROOT . SEP . $app . SEP . 'setup' . SEP . EGW_LANGFILE_PREFIX . strtolower($lang) . '.lang';
//echo '<br>Checking in: ' . $app; //echo '<br>Checking in: ' . $app;
if($GLOBALS['egw_setup']->app_registered($app) && file_exists($appfile)) if($GLOBALS['egw_setup']->app_registered($app) && file_exists($appfile))
{ {
@ -679,7 +682,7 @@
$apps['phpgwapi'] = True; // check the api too $apps['phpgwapi'] = True; // check the api too
foreach($apps as $app => $data) foreach($apps as $app => $data)
{ {
$fname = EGW_SERVER_ROOT . "/$app/setup/phpgw_$lang.lang"; $fname = EGW_SERVER_ROOT . "/$app/setup/" . EGW_LANGFILE_PREFIX . "$lang.lang";
if (file_exists($fname)) if (file_exists($fname))
{ {