Use the standard _manifest_exclude rather than a specific solution (merged from branches/gsoc)

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@42574 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Ingo Schommer 2007-09-25 21:56:45 +00:00
parent fad2ab3eda
commit a0723f23f9

View File

@ -418,8 +418,8 @@ class i18n extends Controller {
'my_MM' => 'Burmese (Myanmar)', 'my_MM' => 'Burmese (Myanmar)',
'myv_RU' => 'Erzya (Russia)', 'myv_RU' => 'Erzya (Russia)',
'na_NR' => 'Nauru (Nauru)', 'na_NR' => 'Nauru (Nauru)',
'nb_NO' => 'Norwegian Bokmål (Norway)', 'nb_NO' => 'Norwegian Bokm<EFBFBD>l (Norway)',
'nb_SJ' => 'Norwegian Bokmål (Svalbard and Jan Mayen)', 'nb_SJ' => 'Norwegian Bokm<EFBFBD>l (Svalbard and Jan Mayen)',
'nd_ZW' => 'North Ndebele (Zimbabwe)', 'nd_ZW' => 'North Ndebele (Zimbabwe)',
'ndc_MZ' => 'ndc (Mozambique)', 'ndc_MZ' => 'ndc (Mozambique)',
'ne_NP' => 'Nepali (Nepal)', 'ne_NP' => 'Nepali (Nepal)',
@ -791,7 +791,8 @@ class i18n extends Controller {
// Create folder for lang files // Create folder for lang files
$langFolder = $baseDir . '/' . $module . '/lang'; $langFolder = $baseDir . '/' . $module . '/lang';
if(!file_exists($baseDir. '/' . $module . '/lang')) { if(!file_exists($baseDir. '/' . $module . '/lang')) {
mkdir($langFolder); mkdir($langFolder, 02775);
touch($baseDir. '/' . $module . '/lang/_manifest_exclude');
} }
// Open the English file and write the Master String Table // Open the English file and write the Master String Table
@ -917,16 +918,26 @@ class i18n extends Controller {
return i18n::$currentlocale; return i18n::$currentlocale;
} }
/**
* Include a locale file determined by module name and locale
*
* @param string $module Module that contains the locale file
* @param string $locale Locale to be loaded
*/
static function include_locale_file($module, $locale) {
if (file_exists($file = Director::getAbsFile("$module/lang/$locale.php"))) include_once($file);
}
/** /**
* Includes all available language files for a certain defined locale * Includes all available language files for a certain defined locale
* *
* @param string $locale All resources from any module in locale $locale will be loaded * @param string $locale All resources from any module in locale $locale will be loaded
*/ */
static function include_by_locale($locale) { static function include_by_locale($locale) {
if (file_exists($file = Director::getAbsFile("cms/lang/$locale.php"))) include_once($file); $topLevel = scandir(Director::baseFolder());
$topLevel = array_diff(scandir(Director::baseFolder()),array('cms'));
foreach($topLevel as $module) { foreach($topLevel as $module) {
if (file_exists($file = Director::getAbsFile("$module/lang/$locale.php"))) { if (file_exists(Director::getAbsFile("$module/_config.php")) &&
file_exists($file = Director::getAbsFile("$module/lang/$locale.php"))) {
include_once($file); include_once($file);
} }
} }