Variable relms/namespaces++<br><br>New names for variable functions--<br><br>Variable registry with defaults in a DB--<br><br>Variable defaults in hooks+- (not sure)<br><br>This is MHO.<br><br>Robin<br><br><div><span class="gmail_quote">
On 5/3/07, <b class="gmail_sendername">Gabor Hojtsy</b> <<a href="mailto:gabor@hojtsy.hu">gabor@hojtsy.hu</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi,<br><br>To be able to translate variables to multiple languages in Drupal<br>nicely, we would need a small conceptual change, which would benefit all<br>of the Drupal developers, so I am posting the call here in hopes we have
<br>someone or a small group to pick this task up.<br><br>**We need a central place to define variable defaults**<br><br>Simple! Now whenever you need a variable, you do<br><br> variable_get('my_fine_var', 'my_default_value');
<br><br>The problem with this is that you need to repeat this multiple times,<br>and of course there is a chance you need to modify it later on, so you<br>need to find all places a variable is used. Not good. Remember the
<br>changes from bluemarine to garland, we have been fixing theme_default<br>errors for days, finding out places where the variable was used...<br><br>So we need a central place to define variable defaults. For Drupal 6<br>
this is enough now:<br><br> hook_settings() {<br> return array(<br> 'my_fine_var' => 'my_default_value',<br> );<br> }<br><br>Have fun with naming it hook_settings(), as far as I see, it is an
<br>appropriate name, and not taken at the moment :) So Drupal can do a<br>module_invoke_all() on hook_settings() and collect defaults to all<br>variables from the modules defining them. It gets easier and shorter to<br>use variables:
<br><br> variable_get('my_fine_var');<br><br>We can either cache the default vars as returned by the callback in the<br>variable_get() function, or in the database among other variables, you<br>get the idea. It is important to have all variables defined in
<br>hook_settings(), even if the default value is an empty string or array.<br><br>Don't care yet about how this fits into translatable variables, because<br>we can only follow up on that if this gets done. So someone please grab
<br>this issue and run with it ;)<br><br>Gabor<br></blockquote></div><br><br clear="all"><br>-- <br>Robin Monks<br>@ <a href="http://www.civicspacelabs.org">www.civicspacelabs.org</a><br>@ <a href="http://www.gmking.org">
www.gmking.org</a><br><br>Fax: (419) 791-8076<br><br>"Some people, when confronted with a problem, think "I know, I'll use regular expressions." Now they have two problems." ~IRC