locale.php en español

Inicio Foros Otros WordPress y similares bbPress – TalkPress locale.php en español

Etiquetado: 

Este debate contiene 3 respuestas, tiene 2 mensajes y lo actualizó  imported_Fernando hace 9 años, 5 meses.

  • Autor
    Publicaciones
  • #13165

    imported_Neri
    Participante

    <p>Recien termino de traducir el locale.php de Bbpress a español, para solo tener traducidas las fechas, porque no estoy acostumbrado al español, se los dejo pegado por si por ahí alguno lo quiere.</p>
    <p>

    Code:
    &lt;?php</p>
    <p>// Date and Time</p>
    <p>class BB_Locale {<br />
    var $weekday;<br />
    var $weekday_initial;<br />
    var $weekday_abbrev;</p>
    <p> var $month;<br />
    var $month_abbrev;</p>
    <p> var $meridiem;<br />
    var $number_format;<br />
    var $datetime_formatstring;</p>
    <p> var $text_direction = ”;<br />
    var $locale_vars = array(‘text_direction’);</p>
    <p> function init() {<br />
    // The Weekdays<br />
    $this-&gt;weekday[0] = __(‘Domingo’);<br />
    $this-&gt;weekday[1] = __(‘Lunes’);<br />
    $this-&gt;weekday[2] = __(‘Martes’);<br />
    $this-&gt;weekday[3] = __(‘Miercoles’);<br />
    $this-&gt;weekday[4] = __(‘Jueves’);<br />
    $this-&gt;weekday[5] = __(‘Viernes’);<br />
    $this-&gt;weekday[6] = __(‘Sabado’);</p>
    <p> // The first letter of each day. The _%day%_initial suffix is a hack to make<br />
    // sure the day initials are unique.<br />
    $this-&gt;weekday_initial[__(‘Domingo’)] = __(‘D_Domingo_initial’);<br />
    $this-&gt;weekday_initial[__(‘Lunes’)] = __(‘L_Lunes_initial’);<br />
    $this-&gt;weekday_initial[__(‘Martes’)] = __(‘M_Martes_initial’);<br />
    $this-&gt;weekday_initial[__(‘Miercoles’)] = __(‘M_Miercoles_initial’);<br />
    $this-&gt;weekday_initial[__(‘Jueves’)] = __(‘J_Jueves_initial’);<br />
    $this-&gt;weekday_initial[__(‘Viernes’)] = __(‘V_Viernes_initial’);<br />
    $this-&gt;weekday_initial[__(‘Sabado’)] = __(‘S_Sabado_initial’);</p>
    <p> foreach ($this-&gt;weekday_initial as $weekday_ =&gt; $weekday_initial_) {<br />
    $this-&gt;weekday_initial[$weekday_] = preg_replace(‘/_.+_initial$/’, ”, $weekday_initial_);<br />
    }</p>
    <p> // Abbreviations for each day.<br />
    $this-&gt;weekday_abbrev[__(‘Domingo’)] = __(‘Dom’);<br />
    $this-&gt;weekday_abbrev[__(‘Lunes’)] = __(‘Lun’);<br />
    $this-&gt;weekday_abbrev[__(‘Martes’)] = __(‘Mar’);<br />
    $this-&gt;weekday_abbrev[__(‘Miercoles’)] = __(‘Mie’);<br />
    $this-&gt;weekday_abbrev[__(‘Jueves’)] = __(‘Jue’);<br />
    $this-&gt;weekday_abbrev[__(‘Viernes’)] = __(‘Vie’);<br />
    $this-&gt;weekday_abbrev[__(‘Sabado’)] = __(‘Sab’);</p>
    <p> // The Months<br />
    $this-&gt;month[’01’] = __(‘Enero’);<br />
    $this-&gt;month[’02’] = __(‘Febrero’);<br />
    $this-&gt;month[’03’] = __(‘Marzo’);<br />
    $this-&gt;month[’04’] = __(‘Abril’);<br />
    $this-&gt;month[’05’] = __(‘Mayo’);<br />
    $this-&gt;month[’06’] = __(‘Junio’);<br />
    $this-&gt;month[’07’] = __(‘Julio’);<br />
    $this-&gt;month[’08’] = __(‘Agosto’);<br />
    $this-&gt;month[’09’] = __(‘Septiembre’);<br />
    $this-&gt;month[’10’] = __(‘Octubre’);<br />
    $this-&gt;month[’11’] = __(‘Noviembre’);<br />
    $this-&gt;month[’12’] = __(‘Diciembre’);</p>
    <p> // Abbreviations for each month. Uses the same hack as above to get around the<br />
    // ‘Mayo’ duplication.<br />
    $this-&gt;month_abbrev[__(‘Enero’)] = __(‘Ene_Enero_abbreviation’);<br />
    $this-&gt;month_abbrev[__(‘Febrero’)] = __(‘Feb_Febrero_abbreviation’);<br />
    $this-&gt;month_abbrev[__(‘Marzo’)] = __(‘Mar_Marzo_abbreviation’);<br />
    $this-&gt;month_abbrev[__(‘Abril’)] = __(‘Abr_Abril_abbreviation’);<br />
    $this-&gt;month_abbrev[__(‘Mayo’)] = __(‘Mayo_Mayo_abbreviation’);<br />
    $this-&gt;month_abbrev[__(‘Junio’)] = __(‘Jun_Junio_abbreviation’);<br />
    $this-&gt;month_abbrev[__(‘Julio’)] = __(‘Jul_Julio_abbreviation’);<br />
    $this-&gt;month_abbrev[__(‘Agosto’)] = __(‘Ago_Agosto_abbreviation’);<br />
    $this-&gt;month_abbrev[__(‘Septiembre’)] = __(‘Sep_Septiembre_abbreviation’);<br />
    $this-&gt;month_abbrev[__(‘Octubre’)] = __(‘Oct_Octubre_abbreviation’);<br />
    $this-&gt;month_abbrev[__(‘Noviembre’)] = __(‘Nov_Noviembre_abbreviation’);<br />
    $this-&gt;month_abbrev[__(‘Diciembre’)] = __(‘Dic_Diciembre_abbreviation’);</p>
    <p> foreach ($this-&gt;month_abbrev as $month_ =&gt; $month_abbrev_) {<br />
    $this-&gt;month_abbrev[$month_] = preg_replace(‘/_.+_abbreviation$/’, ”, $month_abbrev_);<br />
    }</p>
    <p> // The Meridiems<br />
    $this-&gt;meridiem[‘am’] = __(‘am’);<br />
    $this-&gt;meridiem[‘pm’] = __(‘pm’);<br />
    $this-&gt;meridiem[‘AM’] = __(‘AM’);<br />
    $this-&gt;meridiem[‘PM’] = __(‘PM’);</p>
    <p> // Numbers formatting<br />
    // See http://php.net/number_format</p&gt;
    <p> $trans = __(‘number_format_decimals’);<br />
    $this-&gt;number_format[‘decimals’] = (‘number_format_decimals’ == $trans) ? 0 : $trans;</p>
    <p> $trans = __(‘number_format_decimal_point’);<br />
    $this-&gt;number_format[‘decimal_point’] = (‘number_format_decimal_point’ == $trans) ? ‘.’ : $trans;</p>
    <p> $trans = __(‘number_format_thousands_sep’);<br />
    $this-&gt;number_format[‘thousands_sep’] = (‘number_format_thousands_sep’ == $trans) ? ‘,’ : $trans; </p>
    <p> // Date/Time formatting</p>
    <p> $this-&gt;datetime_formatstring[‘datetime’] = __(‘F j, Y – h:i A’);<br />
    $this-&gt;datetime_formatstring[‘date’] = __(‘F j, Y’);<br />
    $this-&gt;datetime_formatstring[‘time’] = __(‘h:i A’);</p>
    <p> $this-&gt;_load_locale_data();<br />
    }</p>
    <p> function _load_locale_data() {<br />
    $locale = get_locale();<br />
    $locale_file = BB_LANG_DIR . $locale . ‘.php’;<br />
    if ( !is_file($locale_file) )<br />
    return;</p>
    <p> include($locale_file);</p>
    <p> foreach ( $this-&gt;locale_vars as $var ) {<br />
    $this-&gt;$var = $$var;<br />
    }<br />
    }</p>
    <p> function get_weekday($weekday_number) {<br />
    return $this-&gt;weekday[$weekday_number];<br />
    }</p>
    <p> function get_weekday_initial($weekday_name) {<br />
    return $this-&gt;weekday_initial[$weekday_name];<br />
    }</p>
    <p> function get_weekday_abbrev($weekday_name) {<br />
    return $this-&gt;weekday_abbrev[$weekday_name];<br />
    }</p>
    <p> function get_month($month_number) {<br />
    return $this-&gt;month[zeroise($month_number, 2)];<br />
    }</p>
    <p> function get_month_initial($month_name) {<br />
    return $this-&gt;month_initial[$month_name];<br />
    }</p>
    <p> function get_month_abbrev($month_name) {<br />
    return $this-&gt;month_abbrev[$month_name];<br />
    }</p>
    <p> function get_meridiem($meridiem) {<br />
    return $this-&gt;meridiem[$meridiem];<br />
    }</p>
    <p> function get_datetime_formatstring($type = ‘datetime’) {<br />
    return $this-&gt;datetime_formatstring[$type];<br />
    }</p>
    <p> // Global variables are deprecated. For backwards compatibility only.<br />
    function register_globals() {<br />
    $GLOBALS[‘weekday’] = $this-&gt;weekday;<br />
    $GLOBALS[‘weekday_initial’] = $this-&gt;weekday_initial;<br />
    $GLOBALS[‘weekday_abbrev’] = $this-&gt;weekday_abbrev;<br />
    $GLOBALS[‘month’] = $this-&gt;month;<br />
    $GLOBALS[‘month_abbrev’] = $this-&gt;month_abbrev;<br />
    }</p>
    <p> function BB_Locale() {<br />
    $this-&gt;init();<br />
    $this-&gt;register_globals();<br />
    }<br />
    }</p>
    <p>function bb_gmdate_i18n( $dateformatstring, $unixtimestamp ) {<br />
    global $bb_locale;<br />
    $i = $unixtimestamp;<br />
    if ( !empty($bb_locale-&gt;month) &amp;&amp; !empty($bb_locale-&gt;weekday) ) {<br />
    $datemonth = $bb_locale-&gt;get_month( gmdate(‘m’, $i) );<br />
    $datemonth_abbrev = $bb_locale-&gt;get_month_abbrev( $datemonth );<br />
    $dateweekday = $bb_locale-&gt;get_weekday( gmdate(‘w’, $i) );<br />
    $dateweekday_abbrev = $bb_locale-&gt;get_weekday_abbrev( $dateweekday );<br />
    $datemeridiem = $bb_locale-&gt;get_meridiem( gmdate(‘a’, $i) );<br />
    $datemeridiem_capital = $bb_locale-&gt;get_meridiem( gmdate(‘A’, $i) );<br />
    $dateformatstring = ‘ ‘ . $dateformatstring;<br />
    $dateformatstring = preg_replace(&quot;/([^\])D/&quot;, &quot;\1&quot; . backslashit( $dateweekday_abbrev ), $dateformatstring);<br />
    $dateformatstring = preg_replace(&quot;/([^\])F/&quot;, &quot;\1&quot; . backslashit( $datemonth ), $dateformatstring);<br />
    $dateformatstring = preg_replace(&quot;/([^\])l/&quot;, &quot;\1&quot; . backslashit( $dateweekday ), $dateformatstring);<br />
    $dateformatstring = preg_replace(&quot;/([^\])M/&quot;, &quot;\1&quot; . backslashit( $datemonth_abbrev ), $dateformatstring);<br />
    $dateformatstring = preg_replace(&quot;/([^\])a/&quot;, &quot;\1&quot; . backslashit( $datemeridiem ), $dateformatstring);<br />
    $dateformatstring = preg_replace(&quot;/([^\])A/&quot;, &quot;\1&quot; . backslashit( $datemeridiem_capital ), $dateformatstring);</p>
    <p> $dateformatstring = substr($dateformatstring, 1, strlen($dateformatstring)-1);<br />
    }<br />
    $j = @gmdate($dateformatstring, $i);<br />
    return $j;<br />
    }</p>
    <p>function bb_get_datetime_formatstring_i18n( $type = ‘datetime’ ) {<br />
    $formatstring = bb_get_option( $type . ‘_format’ );<br />
    if ( empty($formatstring) ) {<br />
    global $bb_locale;<br />
    $formatstring = $bb_locale-&gt;get_datetime_formatstring( $type );<br />
    }<br />
    return $formatstring;<br />
    }</p>
    <p>function bb_datetime_format_i18n( $unixtimestamp, $type = ‘datetime’, $formatstring = ” ) {<br />
    if ( empty($formatstring) ) {<br />
    $formatstring = bb_get_datetime_formatstring_i18n( $type );<br />
    }<br />
    return bb_gmdate_i18n( $formatstring, bb_offset_time( $unixtimestamp ) );<br />
    }</p>
    <p>function bb_number_format_i18n($number, $decimals = null) {<br />
    global $bb_locale;<br />
    // let the user override the precision only<br />
    $decimals = is_null($decimals) ? $bb_locale-&gt;number_format[‘decimals’] : intval($decimals);</p>
    <p> return number_format($number, $decimals, $bb_locale-&gt;number_format[‘decimal_point’], $bb_locale-&gt;number_format[‘thousands_sep’]);<br />
    }</p>
    <p>?&gt;<br />

    </p>

  • #29118

    imported_Fernando
    Participante

    Buen trabajo Neri pero ¿por qué no creaste el MO y optaste por traducir a pelo el locale?. Lo malo de este método ya sabes que es las actualizaciones.

    P.D.: ¿es el de la RC1?

  • #29124

    imported_Neri
    Participante

    No traducí todo porque quiero conocer más el código de bbpress y esa es una buena forma de hacerlo, en cuanto a la versión, es la estable, la que se descarga de /latest.zip

  • #29133

    imported_Fernando
    Participante

    🙂

El foro ‘bbPress – TalkPress’ está cerrado y no se permiten nuevos debates ni respuestas.

Pin It on Pinterest