Skip to content

Instantly share code, notes, and snippets.

@marc1706
Created March 13, 2012 09:32
Show Gist options
  • Save marc1706/2027828 to your computer and use it in GitHub Desktop.
Save marc1706/2027828 to your computer and use it in GitHub Desktop.
Check for missing language variables
<?php
/**
*
* @package Board3 Portal v2
* @copyright (c) Board3 Group ( www.board3.de )
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/
/**
* @ignore
*/
define('IN_PHPBB', true);
define('IN_PORTAL', true);
$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.' . $phpEx);
include($phpbb_root_path . 'portal/includes/constants.' . $phpEx);
$portal_root_path = PORTAL_ROOT_PATH;
// Start session management
$user->session_begin();
$auth->acl($user->data);
$user->setup();
/**
* Initial vars
*/
$lang_de = $lang_en = $lang = array();
$output = '';
$cur_file = 'mods/info_acp_portal';
/**
* now include all English language variables from specified file
*/
include($phpbb_root_path . 'language/en/' . $cur_file . '.' . $phpEx);
$lang_en = $lang;
$lang = array();
/**
* now include all German language variables from specified file
*/
include($phpbb_root_path . 'language/de/' . $cur_file . '.' . $phpEx);
$lang_de = $lang;
$lang = array();
/**
* now compare English to German language
*/
foreach($lang_en as $key => $var)
{
if (!isset($lang_de[$key]))
{
$output .= 'Language variable ' . $key . ' does not exist in the German language file, but in the English one!<br />';
}
}
/**
* now compare German to English language
*/
foreach($lang_de as $key => $var)
{
if (!isset($lang_en[$key]))
{
$output .= 'Language variable ' . $key . ' does not exist in the English language file, but in the German one!<br />';
}
}
trigger_error($output);
page_footer();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment