[wp-trac] [WordPress Trac] #11379: Getting "Warning: Cannot modify header information - headers already sent by (output started at..." because of locale plugins

WordPress Trac wp-trac at lists.automattic.com
Thu Dec 10 12:13:23 UTC 2009


#11379: Getting "Warning: Cannot modify header information - headers already sent
by (output started at..." because of locale plugins
--------------------------+-------------------------------------------------
 Reporter:  waclawjacek   |       Owner:  nbachiyski
     Type:  defect (bug)  |      Status:  new       
 Priority:  normal        |   Milestone:  Unassigned
Component:  i18n          |     Version:  2.8.6     
 Severity:  major         |    Keywords:            
--------------------------+-------------------------------------------------
 I've written a plugin (to be put as wp-content/languages/pl_PL.php)
 providing additional localized features for the Polish translation of
 WordPress as I get "Warning: Cannot modify header information - headers
 already sent by (output started at..." on pages dealing with sessions (the
 reason is the filter). Here's the code:

 {{{
 <?php

 /* wp-config.php modifications */
 $wp_default_secret_key = 'wprowadz tutaj unikatowa fraze';

 /* filters */
 add_filter( 'date_i18n', 'date_declension' );

 /* functions */
 function date_declension( $date )
 {

         $month_names = array( '%Styczeń%', '%Luty%', '%Marzec%',
 '%Kwiecień%', '%Maj%', '%Czerwiec%', '%Lipiec%', '%Sierpień%',
 '%Wrzesień%', '%Październik%', '%Listopad%', '%Grudzień%' );
         $month_names_genitive = array( 'stycznia', 'lutego', 'marca',
 'kwietnia', 'maja', 'czerwca', 'lipca', 'sierpnia', 'września',
 'października', 'listopada', 'grudnia' );
         $month_names_locative = array( 'styczniu', 'lutym', 'marcu',
 'kwietniu', 'maju', 'czerwcu', 'lipcu', 'sierpniu', 'wrześniu',
 'październiku', 'listopadzie', 'grudniu' );

         /* "1 Styczeń..." -> "1 stycznia..." */
         $pattern = '%^\d{1,2}\ \w+%';
         if ( preg_match( $pattern, $date ) == 1 ) return preg_replace(
 $month_names, $month_names_genitive, $date );

         return $date;
 }

 ?>

 }}}

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/11379>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list