There's a problem with the system as described.
$hash is declared static, so the table is stored as a cache.
_hash() is called by _hash_to_string() and by _string_to_hash() but it
is never called with $force=true so static $hash created the first time
_hash() is called never gets refreshed.
Is the $hash static for performance reasons? If not, can we just make it
a local variable (I think).
If so, maybe we need to pass down a variable to indicate translation is
function GetConfig($type,$scope = '', $doTranslate=false)
function _hash_to_string($type,$data, $doTranslate=false)
then call $hash = $this->_hash($doTranslate);
However I'm now confused about the $scope parameter to GetConfig(). What
are the different scopes for config for?
declare a variable in the global array:
set it true on Login, Log off, User language change in profile, Global
lang change by admin
test for it in GetConfig (I spose)
something else completely! :)
Marcus Clements wrote:
> Hi Victor,
> This all makes perfect sense.
> So how about this:
> I'll keep a local copy of my changes for reference, check-out the current
> version, test my site with your new code, help with bugs if necessary,
> then start working on this stuff for potential incorporation in a future
>> On 2/13/07, Marcus Clements <marcus@...> wrote:
>>> Where I got to is here: (this is a diff of my working copy of cclib/
>>> revision 5135)
>>> But there's a lot of CCDebug lines in there just so I could work out
>>> the devil it all worked.
>>> I'm checking to see if the user lang matches the main lang and if not,
>>> iterating through the menu, calling _() (see diff extract below)
>>> It's really incomplete (tabs not done etc...) so I'm happy to update to
>>> new code base with all of Victors new stuff and make it happen there,
>>> submit a patch if that sounds useful.
>> I appreciate the approach but I thought we discussed another way...
>> we need to *remove* the _() wrappers around strings in the code that
>> are headed for config (like the menu builders, default nav tabs, etc.,
>> submit forms, etc.)
>> The call to _() is already done every time you extract a string from
>> config (search for "_(" in cc-config.php) so:
>> // English goes into config:
>> $configs->SaveConfig( 'menu', $_menu_data['items'],
>> '', false);
>> //and then the next line is:
>> $_menu_data['items'] = $configs->GetConfig('menu');
>> The current language will come out, I promise.
>> The problem is that when the build menu (nav, submit forms, etc)
>> happens and the current language isn't English you're storing a random
>> language in config (no offense intended). We need to
>> a) build and store English in the config (always!),
>> b) let the language editor pick up the strings from config for
>> c) then let the _() buried in GetConfig() do it's magic.
>> Make sense?
>> The trick is to make *sure* that the strings are all in config before
>> the language editor is called up. For example, I think the submit
>> forms wait until they are needed before they generate the 'default'
>> So the tasks are:
>> a) remove all _() from strings to be stored in config
>> b) modify all revert-type code (like menus and submit forms) to save
>> then, immediately retrieve, the config items
>> c) make sure all 'default' config string are stuff into config on
>> install and not "lazy loaded"
>> how am I doing?
>> ...and can we release 4.0 w/o this? save it for 4.1?
+44 (0)7866 316498
+34 606 053 777