search
top

Pasar WordPress a Español modificando el locale.php

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.

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

O descargarlo.

Articulos relacionados:

php the_time – La hora y fecha en WordPress

php

La llamada the_time es una de las funciones en php más fáciles de entender que conozco, es la que, mediante una serie de variables, representa la fecha y hora de x archivo.

Voy a tomar de ejemplo el theme default de Wp.

Generalmente viene así:

1
<?php the_time('l, F jS, Y') ?> at <?php the_time() ?>

Lo que “imprime”; Dia de la semana, Mes Número de díaSufijo en inglés del dia del mes, año at Hora.
Ejemplo:  Saturday, November 1st, 2008 at 11:11

Las variables más comunes:

-Fechas-

l – Muestra el día de la semana, ejemplo: Lunes
F – Muestra el Mes, ejemplo: Enero
j – Muestra el número de día, ejemplo: 3
S – Imprime st, ejemplo (teniendo en cuenta una j antes): 3st
Y – Muestra el Año, ejemplo: 2009
y – Muestra el año, pero las últimas dos cifras, ejemplo: 09
z – El número de día del año, entre 0 y 365

-Hora-

a – Muestra am o pm.
A – Muesra AM o PM.
g – Muestra la hora en formato 12 horas.
G – Muestra la hora con formato de 24 horas.

Uso:

1
<? php the_time('Variables') ?>

Ejemplos de uso:
Para mostrar la fecha como se muestra en este blog:

1
<?php the_time('l j/m/Y'); ?>

Ejemplo: Viernes 8/05/2009
Más Ejemplos:

1
<?php the_time('g:i a'); ?>

Muestra: Hora:minutos am(o pm)
Ejemplo: 9:37 am

1
<?php the_time('F j, Y'); ?>

Muestra: Mes día, año
Ejemplo: Agosto 16, 2008

1
<?php the_time("l j F Y") ?>

Muestra: Día Número Mes Año
Ejemplo: Miercoles 22 Abril 2009

Hay muchísimas formas de combinar, pueden meterse más en el tema viendo la documentación en el Codex de Wp, o en Php.

Articulos relacionados:

Página 1 De 11
top