From: Chris W. <la...@us...> - 2005-03-24 05:00:47
|
Update of /cvsroot/openinteract/OpenInteract2/lib/OpenInteract2/I18N In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11828 Modified Files: Initializer.pm Log Message: no black voodoo magic for Teemu :-) instead of generating all the keys/values in the class assign them after the class is generated Index: Initializer.pm =================================================================== RCS file: /cvsroot/openinteract/OpenInteract2/lib/OpenInteract2/I18N/Initializer.pm,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** Initializer.pm 23 Mar 2005 19:17:57 -0000 1.15 --- Initializer.pm 24 Mar 2005 05:00:37 -0000 1.16 *************** *** 147,155 **** my $source = $all_messages->{ $lang }{SOURCE}{ $key }; $log->is_debug && ! $log->debug( ! "DUPLICATE MESSAGE KEY FOUND. Key '$key' from ", ! "'$file' was already found in message file ", ! "'$source' read in earlier. Existing key WILL NOT BE ", ! "OVERWRITTEN, which may cause odd application behavior." ); } else { --- 147,155 ---- my $source = $all_messages->{ $lang }{SOURCE}{ $key }; $log->is_debug && ! $log->debug( ! "DUPLICATE MESSAGE KEY FOUND. Key '$key' from ", ! "'$file' was already found in message file ", ! "'$source' read in earlier. Existing key WILL NOT BE ", ! "OVERWRITTEN, which may cause odd behavior." ); } else { *************** *** 183,187 **** } else { ! my ( $key, $msg ) = $line =~ /^\s*([\w\.]+)\s*=\s*(.*)$/; if ( $key ) { if ( $current_key ) { --- 183,188 ---- } else { ! # since we split on a '=' the key can have any character EXCEPT a '=' ! my ( $key, $msg ) = split( /\s*=\s*/, $line, 2 ); if ( $key ) { if ( $current_key ) { *************** *** 252,256 **** lang_class => $lang_class, base_class => $base_class, - messages => $messages, ); --- 253,256 ---- *************** *** 276,279 **** --- 276,284 ---- $log->is_debug && $log->debug( "Evaluated class $lang_class ok" ); + + $lang_class->_assign_messages( $messages ); + $log->is_debug && + $log->debug( "Assigned mesages to $lang_class ok" ); + return $lang_class; } *************** *** 289,299 **** @[% lang_class %]::ISA = qw( [% base_class %] ); sub get_oi2_lang { return '[% lang %]' } ! %Lexicon = ( ! [% FOREACH msg_key = messages.keys -%] ! '[% msg_key %]' => qq{[% messages.$msg_key %]}, ! [% END -%] ! ); 1; --- 294,307 ---- @[% lang_class %]::ISA = qw( [% base_class %] ); + %Lexicon = (); + sub get_oi2_lang { return '[% lang %]' } ! sub _assign_messages { ! my ( $class, $messages ) = @_; ! while ( my ( $key, $value ) = %{ $messages } ) { ! $Lexicon{ $key } = $value; ! } ! } 1; |