1. I have, as human beeing, a problem with reading somthing like undefined index '519a' its nice and short but u have to be a smart ass to get it that it has somthing to do with forum and viewthread.php ... espechaily if a fusion based site is not the only project u r involved with.
solution: well assorted index names like 'forum_viewthread_blablabla' would make clearer where the trouble comes from, if a file is there, u could do a full text search on localefiles for like 'forum_viewthread_' to get the right one thats missing some localisation on the chosen language.
2. on the contrary, why php fusion is still sticking to files localisation wise?
woulnt it be better having a locales table on the database, featuring alphanumeric indexes for like
package eg. 'forum' and
part eg. 'viewthread' and the
key storing 'blablabla'
having that its easy to make some sort of:
[syntaxhighlighter brush=php,first-line=1,highlight=0,collapse=false,html-script=false]
function populate_the_locale_array_from_database_table_foo_function($package,$part=FALSE,$key=FALSE,$fallback_to_en=TRUE) {
global $locale;
if (!LOCALESET || !package) {
echo '
<br />LOCALE ERROR: locales selection failed, language or package not set for the language \''.$lang.'\' or/and package \''.$package.'\'.';
} else {
$conditions = 'locale_package = "'.$package.'"';
if ($part) $conditions .= ' AND locale_part="'.$part.'"';
if ($key) $conditions .= ' AND locale_key="'.$key.'"';
$result = dbquery('
SELECT *
FROM '.DB_PREFIX.'locales
WHERE '.$conditions
);
if (!dbrows($result)) {
// that can happen by typos or missing database entrys and we all want know that one(s)!
echo '
<br />LOCALE NOTICE: No locales found for '.$conditions.'.';
} else {
while($data = dbarray($result)) {
$name = $data['locale_package'].'_'. $data['locale_part'].'_'.$data['locale_key'];
$locale[$name] = $data['locale_value_'.LOCALESET];
if (!$locale[$name]) {
if (!$fallback_to_en) {
// spam me with freakin notice(s)!
echo '
<br />LOCALE NOTICE: No locale found for '.$name.' in laguage '.LOCALESET.'.';
} else {
// just be quiet and fallback to en without notice!
$locale[$name] = $data['locale_value_English'];
}
}
}
}
}
}
[/syntaxhighlighter]
adressing it instead of including localisation files.
than wee just needs a another backend site thats allowing to create and remove additional colums for additional languages and can put the blank fields on screen to fill them ... would be just perfect for keeping translations updated, finding whats missing by not having all that stupid notices or/and left blank texts over the whole site!
current localesfiles could be easiely inserted on a table by taking the file name like viewthread as part considering its package as forum and putting its current keys like 519 as keys getting for a language $lang the following:
[syntaxhighlighter brush=php,first-line=1,highlight=0,collapse=false,html-script=false]
$lang = 'English';
$package = 'forum';
$part = 'viewtread';
$key = '519';
$current_locale_string = $locale[$key];
dbquery('INSERT INTO '.DB_PREFIX.'locales
SET locale_package='.$package .',
locale_part='.$part.',
locale_key='.$key.',
locale_value_'.$lang.'="'.$current_locale_string.'"'
![wink](../../images/smiley/wink.png)
;
[/syntaxhighlighter]
replaceing $locale['519'] with $locale['forum_viewtread_519'] on the code and using locales_from_db function just secondary after the file include until evrything is considired as transfered properly.