Voy a aprovechar que en Venezuela estamos en época de besibol para darle un batazo a la mierda de computadora esta, y luego me doy otro por animal.
Éstas son las horas que todavía sigo con esta
porquería de código y nada que arranca. He estado intentándolo durante todo el santo día. Me encuentro casi en el mismo punto que al inicio: los datos aparecen ordenados hasta que me encuentro con las malditas líneas repetidas; ahí se desbarata todo y no hallo la forma de ordenarlas una encima de otra. Estoy dando vueltas en círculo.
Éste es el más reciente intento:
Código PHP:
Ver original<?php
$archivo = str_replace( basename($_SERVER['PHP_SELF']) , '' , $_SERVER['SCRIPT_FILENAME']) . '/lang/prueba.po'; $leer = file($archivo, FILE_IGNORE_NEW_LINES
); $html = null;
$txt = null;
foreach($leer as $l) {
switch($txt[0]) {
case 'msgid':
$html .='<h3>'. $l .'</h3>' . "\n";
break;
case 'msgstr':
$html .='<p>'. $l .'</p>' . "\n";
break;
case 'msgstr[0]':
$html .='<p>'. $l .'</p>' . "\n";
break;
case 'msgid_plural':
$html .='<h3>'. $l .'</h3>' . "\n";
break;
case 'msgstr[1]':
$html .='<p>'. $l .'</p>' . "\n";
break;
}
}
echo $html;
?>
Así debería quedar la cosa: el texto en azul debería ir en la posición indicada.
Anexo archivo de prueba por si acaso:
Código PHP:
Ver original# Translation of WordPress 2.9.2.
# Copyright (C) 2010 WordPress
# This file is distributed under the same license as the WordPress package.
# FIRST AUTHOR <EMAIL@ADDRESS>, 2010.
#
msgid ""
msgstr ""
"Project-Id-Version: WordPress 2.9.2 en español (v1.0)\n"
"POT-Creation-Date: 2010-02-15 17:47+0000\n"
"PO-Revision-Date: 2010-02-16 01:12+0100\n"
"Last-Translator: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=n !=1;\n"
"X-Poedit-Language: Spanish\n"
"X-Poedit-Country: SPAIN\n"
"X-Poedit-SourceCharset: utf-8\n"
#: wp-admin/edit-attachment-rows.php:207
msgid "Get permalink"
msgstr "Obtener enlace permanente"
#: wp-admin/edit-attachment-rows.php:226
#: wp-admin/upload.php:434
msgid "No media attachments found."
msgstr "No hay archivos que mostrar."
#: wp-admin/edit-category-form.php:14
msgid "You do not have sufficient permissions to edit categories for this blog."
msgstr "No tienes permisos para editar las categorías del blog."
#: wp-admin/edit-category-form.php:80
#: wp-admin/edit-link-category-form.php:27
#: wp-admin/includes/template.php:266
msgid "Update Category"
msgstr "Actualizar categoría"
#: wp-admin/edit-comments.php:114
#, php-format
msgid "Edit Comments on “%s”"
msgstr "Editar comentarios en “%s”"
#: wp-admin/edit-comments.php:116
msgid "Edit Comments"
msgstr "Editar comentarios"
#: wp-admin/edit-comments.php:151
#, php-format
msgid "%s comment approved"
msgid_plural "%s comments approved"
msgstr[0] "%s comentario aprobado"
msgstr[1] "%s comentarios aprobados"
#: wp-admin/edit-comments.php:155
#, php-format
msgid "%s comment marked as spam."
msgid_plural "%s comments marked as spam."
msgstr[0] "%s comentario ha sido marcado como spam"
msgstr[1] "%s comentarios han sido marcados como spam"
#: wp-admin/edit-comments.php:157
#: wp-admin/edit-comments.php:166
#: wp-admin/edit-pages.php:170
#: wp-admin/edit.php:171
#: wp-admin/includes/image-edit.php:56
#: wp-admin/includes/media.php:1243
#: wp-admin/includes/template.php:2384
#: wp-admin/includes/template.php:2387
#: wp-admin/upload.php:210
#: wp-includes/js/tinymce/langs/wp-langs.php:213
#: wp-includes/js/tinymce/wp-mce-help.php:209
msgid "Undo"
msgstr "Deshacer"
#: wp-admin/edit-comments.php:160
#, php-format
msgid "%s comment restored from the spam"
msgid_plural "%s comments restored from the spam"
msgstr[0] "El comentario %s ha sido restaurado."
msgstr[1] "Los comentarios %s han sido restaurados."
#: wp-admin/edit-comments.php:164
#, php-format
msgid "%s comment moved to the trash."
msgid_plural "%s comments moved to the trash."
msgstr[0] "%s comentario ha sido mandado a la papelera."
msgstr[1] "%s comentarios han sido enviados a la papelera."