Pasar WordPress a Español modificando el locale.php

Actualización: para los que tienen WordPress 3, el locale.php correcto para pasar las fechas de wp a español pueden encontrarlo en WordPress 3, fechas en español.

En todos los sitios que tengo, tengo la instalación original de Wp, en inglés, Lo unico que cambio es el locale.php (el archivo que contiene las fechas) por uno traducido que tengo.Esto es para que las fechas no se vean en inglés.
Tal vez a muchos le sirva, asi que se los subo en un .txt, lo van a tener que renombrar a .php y subirlo a la carpeta /wp-includes, o sino crean un nuevo documento en texto plano, copian el código de más abajo, lo pegan y le ponen locale.php.

PHP:
  1. <?php
  2. class WP_Locale {
  3.  
  4.     var $weekday;
  5.  
  6.     var $weekday_initial;
  7.  
  8.     var $weekday_abbrev;
  9.  
  10.     var $month;
  11.  
  12.     var $month_abbrev;
  13.  
  14.     var $meridiem;
  15.  
  16.     var $text_direction = 'ltr';
  17.  
  18.     var $locale_vars = array('text_direction');
  19.  
  20.     function init() {
  21.         $this->weekday[0] = __('Domingo');
  22.         $this->weekday[1] = __('Lunes');
  23.         $this->weekday[2] = __('Martes');
  24.         $this->weekday[3] = __('Miercoles');
  25.         $this->weekday[4] = __('Jueves');
  26.         $this->weekday[5] = __('Viernes');
  27.         $this->weekday[6] = __('Sabado');
  28.  
  29.         $this->weekday_initial[__('Domingo')]    = __('S_Domingo_initial');
  30.         $this->weekday_initial[__('Lunes')]    = __('M_Lunes_initial');
  31.         $this->weekday_initial[__('Martes')]   = __('T_Martes_initial');
  32.         $this->weekday_initial[__('Miercoles')] = __('W_Miercoles_initial');
  33.         $this->weekday_initial[__('Jueves')]  = __('T_Jueves_initial');
  34.         $this->weekday_initial[__('Viernes')]    = __('F_Viernes_initial');
  35.         $this->weekday_initial[__('Sabado')]  = __('S_Sabado_initial');
  36.  
  37.         foreach ($this->weekday_initial as $weekday_ => $weekday_initial_) {
  38.             $this->weekday_initial[$weekday_] = preg_replace('/_.+_initial$/', '', $weekday_initial_);
  39.         }
  40.  
  41.  
  42.         $this->weekday_abbrev[__('Domingo')]    = __('Dom');
  43.         $this->weekday_abbrev[__('Lunes')]    = __('Lun');
  44.         $this->weekday_abbrev[__('Martes')]   = __('Mar');
  45.         $this->weekday_abbrev[__('Miercoles')] = __('Mie');
  46.         $this->weekday_abbrev[__('Jueves')]  = __('Jue');
  47.         $this->weekday_abbrev[__('Viernes')]    = __('Vie');
  48.         $this->weekday_abbrev[__('Sabado')]  = __('Sab');
  49.  
  50.  
  51.         $this->month['01'] = __('Enero');
  52.         $this->month['02'] = __('Febrero');
  53.         $this->month['03'] = __('Marzo');
  54.         $this->month['04'] = __('Abril');
  55.         $this->month['05'] = __('Mayo');
  56.         $this->month['06'] = __('Junio');
  57.         $this->month['07'] = __('Julio');
  58.         $this->month['08'] = __('Agosto');
  59.         $this->month['09'] = __('Septiembre');
  60.         $this->month['10'] = __('Octubre');
  61.         $this->month['11'] = __('Noviembre');
  62.         $this->month['12'] = __('Diciembre');
  63.  
  64.  
  65.         $this->month_abbrev[__('Enero')] = __('Ene_Enero_abbreviation');
  66.         $this->month_abbrev[__('Febrero')] = __('Feb_Febrero_abbreviation');
  67.         $this->month_abbrev[__('Marzo')] = __('Mar_Marzo_abbreviation');
  68.         $this->month_abbrev[__('Abril')] = __('Abr_Abril_abbreviation');
  69.         $this->month_abbrev[__('Mayo')] = __('Mayo_Mayo_abbreviation');
  70.         $this->month_abbrev[__('Junio')] = __('Jun_Junio_abbreviation');
  71.         $this->month_abbrev[__('Julio')] = __('Jul_Julio_abbreviation');
  72.         $this->month_abbrev[__('Agosto')] = __('Ago_Agosto_abbreviation');
  73.         $this->month_abbrev[__('Septiembre')] = __('Sep_Septiembre_abbreviation');
  74.         $this->month_abbrev[__('Octubre')] = __('Oct_Octubre_abbreviation');
  75.         $this->month_abbrev[__('Noviembre')] = __('Nov_Noviembre_abbreviation');
  76.         $this->month_abbrev[__('Diciembre')] = __('Dic_Diciembre_abbreviation');
  77.  
  78.         foreach ($this->month_abbrev as $month_ => $month_abbrev_) {
  79.             $this->month_abbrev[$month_] = preg_replace('/_.+_abbreviation$/', '', $month_abbrev_);
  80.         }
  81.  
  82.  
  83.         $this->meridiem['am'] = __('am');
  84.         $this->meridiem['pm'] = __('pm');
  85.         $this->meridiem['AM'] = __('AM');
  86.         $this->meridiem['PM'] = __('PM');
  87.  
  88.         $trans = _c('number_format_decimals|$decimals argument for http://php.net/number_format, default is 0');
  89.         $this->number_format['decimals'] = ('number_format_decimals' == $trans) ? 0 : $trans;
  90.  
  91.         $trans = _c('number_format_decimal_point|$dec_point argument for http://php.net/number_format, default is .');
  92.         $this->number_format['decimal_point'] = ('number_format_decimal_point' == $trans) ? '.' : $trans;
  93.  
  94.         $trans = _c('number_format_thousands_sep|$thousands_sep argument for http://php.net/number_format, default is ,');
  95.         $this->number_format['thousands_sep'] = ('number_format_thousands_sep' == $trans) ? ',' : $trans;
  96.  
  97.         foreach ( (array) $this->locale_vars as $var ) {
  98.             if ( isset($GLOBALS[$var]) )
  99.                 $this->$var = $GLOBALS[$var];
  100.         }
  101.  
  102.     }
  103.  
  104.     function get_weekday($weekday_number) {
  105.         return $this->weekday[$weekday_number];
  106.     }
  107.  
  108.     function get_weekday_initial($weekday_name) {
  109.         return $this->weekday_initial[$weekday_name];
  110.     }
  111.  
  112.     function get_weekday_abbrev($weekday_name) {
  113.         return $this->weekday_abbrev[$weekday_name];
  114.     }
  115.  
  116.     function get_month($month_number) {
  117.         return $this->month[zeroise($month_number, 2)];
  118.     }
  119.  
  120.     function get_month_abbrev($month_name) {
  121.         return $this->month_abbrev[$month_name];
  122.     }
  123.  
  124.     function get_meridiem($meridiem) {
  125.         return $this->meridiem[$meridiem];
  126.     }
  127.  
  128.     function register_globals() {
  129.         $GLOBALS['weekday']         = $this->weekday;
  130.         $GLOBALS['weekday_initial'] = $this->weekday_initial;
  131.         $GLOBALS['weekday_abbrev']  = $this->weekday_abbrev;
  132.         $GLOBALS['month']           = $this->month;
  133.         $GLOBALS['month_abbrev']    = $this->month_abbrev;
  134.     }
  135.  
  136.     function WP_Locale() {
  137.         $this->init();
  138.         $this->register_globals();
  139.     }
  140. }
  141.  
  142. ?>

O descargarlo.


7 personas han opinado, ¿Vos ya lo has hecho?

  1. muy bueno. hace rato que tengo mis fechas en ingles y ahora q veo me acorde que tengo que cambiarlas :D .. gracias por el post.. muy bueno el blog. saludos

  2. Este post es realmente imprescindible para los WordPresseros.

    Gracias Neri.

  3. Me salvaste el día!, Muchas gracias!.

  4. Muy bueno muchas gracias… andaba en busqueda de algo asi, saludos

  5. Josh Arcadia

    Pienso que el 2.9x ya tiene mas info que la que usas…

  6. oye como tradusco par ala vercion 9.21 ?? porfa ayuda gracuas
    si podes escribime a mi mail.. desde ya mil gracias

  7. hola a todos! tengo un blog en dos idiomas por lo que quiero mantener la fecha en inglés y en español. ¿cómo puedo hacerlo? Al traducir la fecha, cambia el formato pero no el mes.
    saludos y gracias

Trackbacks/Pingbacks

  1. WordPress 3, fechas en español | WordPress Hacks - [...] son de habla hispana, por lo que, traducir y subir el locale.php es la mejor opción para poner WordPress ...

¿Querés comentar algo?