Unidad 1 Aplicaciones web de escritorio CFGM. Aplicaciones web.
Internacionalización de aplicaciones web.
Transcript of Internacionalización de aplicaciones web.
![Page 1: Internacionalización de aplicaciones web.](https://reader036.fdocuments.ec/reader036/viewer/2022062419/55831b36d8b42a3c658b4b14/html5/thumbnails/1.jpg)
Iñtërnâçiônàlizæçiøn deaplicaciones web
Pedro Hernández.Blog: http://blog.phpleo.com/twitter: @phpleo
![Page 2: Internacionalización de aplicaciones web.](https://reader036.fdocuments.ec/reader036/viewer/2022062419/55831b36d8b42a3c658b4b14/html5/thumbnails/2.jpg)
¿Por qué aplicaciones como Facebook o Twitter pueden llegar a tantos usuarios?
http://www.flickr.com/photos/marmotte73/2485775993/
![Page 3: Internacionalización de aplicaciones web.](https://reader036.fdocuments.ec/reader036/viewer/2022062419/55831b36d8b42a3c658b4b14/html5/thumbnails/3.jpg)
“Internacionalización: Adaptar las aplicaciones a diferentes idiomas y culturas”
http://www.flickr.com/photos/russelljsmith/3747387/
![Page 4: Internacionalización de aplicaciones web.](https://reader036.fdocuments.ec/reader036/viewer/2022062419/55831b36d8b42a3c658b4b14/html5/thumbnails/4.jpg)
i18n
![Page 5: Internacionalización de aplicaciones web.](https://reader036.fdocuments.ec/reader036/viewer/2022062419/55831b36d8b42a3c658b4b14/html5/thumbnails/5.jpg)
Cultura del usuario
en_US
ISO 639-1(Idioma)
3166-1(País)
es_ES
en_GB
es
es_AR
![Page 6: Internacionalización de aplicaciones web.](https://reader036.fdocuments.ec/reader036/viewer/2022062419/55831b36d8b42a3c658b4b14/html5/thumbnails/6.jpg)
Detectando la cultura del usuario
• Cabecera HTTP Accept-Language (no es muy fiable).
• Geolocalización de la IP.
![Page 7: Internacionalización de aplicaciones web.](https://reader036.fdocuments.ec/reader036/viewer/2022062419/55831b36d8b42a3c658b4b14/html5/thumbnails/7.jpg)
Usando la Internacionalización
http://www.flickr.com/photos/torek/857931903/
![Page 8: Internacionalización de aplicaciones web.](https://reader036.fdocuments.ec/reader036/viewer/2022062419/55831b36d8b42a3c658b4b14/html5/thumbnails/8.jpg)
Cultura en la Url
http://www.mysite.com/es/acerca-de/http://www.mysite.com/es-es/acerca-de/
http://en.mysite.com/about/http://en-us.mysite.com/about/
• Almacenamiento en cache.• Indexado en motores de búsqueda (SEO).
![Page 9: Internacionalización de aplicaciones web.](https://reader036.fdocuments.ec/reader036/viewer/2022062419/55831b36d8b42a3c658b4b14/html5/thumbnails/9.jpg)
Información textual en la base de datos
![Page 10: Internacionalización de aplicaciones web.](https://reader036.fdocuments.ec/reader036/viewer/2022062419/55831b36d8b42a3c658b4b14/html5/thumbnails/10.jpg)
Traducción de la interfaz
• Mostrar etiquetas, mensajes y la navegación en diferentes idiomas.
• Herramientas:– Diccionarios.– Gettext.– XLIFF.– r3.
![Page 11: Internacionalización de aplicaciones web.](https://reader036.fdocuments.ec/reader036/viewer/2022062419/55831b36d8b42a3c658b4b14/html5/thumbnails/11.jpg)
Herramientas para I18N la Interfaz
http://www.flickr.com/photos/jamingray/935197028/
![Page 12: Internacionalización de aplicaciones web.](https://reader036.fdocuments.ec/reader036/viewer/2022062419/55831b36d8b42a3c658b4b14/html5/thumbnails/12.jpg)
Diccionarios
$lang = array( 'nombre' => 'Name', 'apellidos' => 'Last name', 'email' => 'E-mail' );
<?php echo $lang[‘nombre’]; ?><?php echo $lang[‘apellidos’]; ?><?php echo $lang[‘email’]; ?>
lang/en_US.php templates/index.php
![Page 13: Internacionalización de aplicaciones web.](https://reader036.fdocuments.ec/reader036/viewer/2022062419/55831b36d8b42a3c658b4b14/html5/thumbnails/13.jpg)
Gettext
• Biblioteca GNU de i18n.• Archivo .po (texto plano) compilado en un
archivo binario .mo.• Función de traducción: _(‘’)
![Page 14: Internacionalización de aplicaciones web.](https://reader036.fdocuments.ec/reader036/viewer/2022062419/55831b36d8b42a3c658b4b14/html5/thumbnails/14.jpg)
Gettext
#: templates/index.php:15msgid “Nombre“msgstr “Name“
#: templates/index.php:16msgid “Apellidos“msgstr “Last name“
#: templates/index.php:17msgid “E-mail“msgstr “E-mail“
en_US.po
<?php echo _(‘Nombre’); ?><?php echo _(‘Apellidos’); ?><?php echo _(‘E-mail’); ?>
templates/index.phplang/en_US.mo
![Page 15: Internacionalización de aplicaciones web.](https://reader036.fdocuments.ec/reader036/viewer/2022062419/55831b36d8b42a3c658b4b14/html5/thumbnails/15.jpg)
XLIFF
• XLIFF (XML Localization Interchange File Format).
• Formato estándar basado en XML.• Función de traducción: __(‘’)• Archivo xml:
messages.[codigo_de_idioma].xmlmessages.en_US.xml
![Page 16: Internacionalización de aplicaciones web.](https://reader036.fdocuments.ec/reader036/viewer/2022062419/55831b36d8b42a3c658b4b14/html5/thumbnails/16.jpg)
XLIFF
<?xml version="1.0" ?><xliff version="1.0"> <file orginal="global" source-language=“es_ES" datatype="plaintext"> <body> <trans-unit id="1"> <source>Nombre</source> <target>Name</target> </trans-unit> <trans-unit id="2"> <source>Apellidos</source> <target> Last name </target> </trans-unit> </body> </file></xliff>
lang/messages.en_US.xml
![Page 17: Internacionalización de aplicaciones web.](https://reader036.fdocuments.ec/reader036/viewer/2022062419/55831b36d8b42a3c658b4b14/html5/thumbnails/17.jpg)
r3
• Utilizado por Yahoo.
• Función de traducción: <r3:trans>hello</r3:trans> vs __(‘hello’)
![Page 18: Internacionalización de aplicaciones web.](https://reader036.fdocuments.ec/reader036/viewer/2022062419/55831b36d8b42a3c658b4b14/html5/thumbnails/18.jpg)
• Español: Guiando la web hacia su máximo potencial…�
• Alemán: Alle Möglichkeiten des Web erschließen…
• Chino: 引å‘网络的全部潜能…�
• Ãrabe: � ...لإيصال الشبكة المعلوماتية إلىأقصى إمكانياتها
![Page 19: Internacionalización de aplicaciones web.](https://reader036.fdocuments.ec/reader036/viewer/2022062419/55831b36d8b42a3c658b4b14/html5/thumbnails/19.jpg)
http://www.flickr.com/photos/sedah/3203954495/
Juego de carácteres (charset) &codificación (encoding)
![Page 20: Internacionalización de aplicaciones web.](https://reader036.fdocuments.ec/reader036/viewer/2022062419/55831b36d8b42a3c658b4b14/html5/thumbnails/20.jpg)
Juego de carácteres
• Probablemente se usó ISO-8859-1 (ISO-Latin-1).
• ISO-8859-1: € en lugar de €• Familia ISO-8859 sólo contienen 255
caracteres.
![Page 21: Internacionalización de aplicaciones web.](https://reader036.fdocuments.ec/reader036/viewer/2022062419/55831b36d8b42a3c658b4b14/html5/thumbnails/21.jpg)
http://www.flickr.com/photos/mumpfpuffel/2763886252/
![Page 22: Internacionalización de aplicaciones web.](https://reader036.fdocuments.ec/reader036/viewer/2022062419/55831b36d8b42a3c658b4b14/html5/thumbnails/22.jpg)
Uniformizar• Apache:
AddDefaultCharset utf-8
• MySQL:create database `midb`character set utf8 collate utf8_unicode_ci;
• HTML:<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
• Clientes y editores por defecto "editando y guardando" en UTF8.
![Page 23: Internacionalización de aplicaciones web.](https://reader036.fdocuments.ec/reader036/viewer/2022062419/55831b36d8b42a3c658b4b14/html5/thumbnails/23.jpg)
• Español: Guiando la web hacia su máximo potencial…
• Alemán: Alle Möglichkeiten des Web erschließen…
• Chino: 引发网络的全部潜能…
• Árabe: ... إلىأقصى المعلوماتية الشبكة إليصالإمكانياتها
![Page 24: Internacionalización de aplicaciones web.](https://reader036.fdocuments.ec/reader036/viewer/2022062419/55831b36d8b42a3c658b4b14/html5/thumbnails/24.jpg)
Gracias.
Pedro Hernández.Blog: http://blog.phpleo.com/twitter: @phpleo