Mod Adk Portal (2.1.1)

Adk portal is a portal integrated to SMF, with multiple extensions and features.
The portal is aimed at simple and intuitive to the Administrator.
It has all the characteristics of portal, in addition to having a great set of downloads, system of internal pages, etc.

Mod Adk Seo (3.0)

Adk Seo is an internal system of SMF to improve your ranking.
It has powerful features to appear on the top of major search engines.
With this product, you can change your urls, choose your format, encouraging social activity on your site, place their own sitemaps, etc.
Mod Adk Blog (3.0)

Adk blog is an internal system of SMF to help encourage business users.
This product will create a space where your users can use as your own blog, creating categories, entries, and managing your comments.


Tener diferentes idiomas en tu web (Multi Language)


Board:

Tutoriales para tu Web

Topic:

Tener diferentes idiomas en tu web (Multi Language)


Description:

Tutoriales que no tengan que ver con smf, sino para tu web.

Author Topic: Tener diferentes idiomas en tu web (Multi Language)  (Read 1007 times)

0 Members and 1 Guest are viewing this topic.

Tener diferentes idiomas en tu web (Multi Language)

Tener diferentes idiomas en tu web (Multi Language)
« on: September 10, 2010, 01:51:48 PM »
Bueno, hoy snailx me habia pedido un favor, para saber como tener la web en diferentes idiomas, y me puse a investigar un poquito, y como te lo que hago lo comparto :D Aca les voy a explicar como tener una web con diferentes idiomas.

Antes que nada aclaro, esto no tiene nada que ver con smf, ya que smf permite manejar diferentes idiomas, esto es por si tienen una web hecha por ustedes.

Lo que vamos a hacer es crear una carpeta que se llame languagefolder... y vamos a meter dos archivos, uno idioma.espanol.php y el otro idioma.english.php. Aclaro que podemos agregar todos los idiomas que querramos.

En el archivo idioma.espanol.php vamos a tener este codigo:
Code: [Select]
<?php

$text['lucas_is_great'] = 'Esto es un texto en espanol';

?>


y en el archivo idioma.english.php:
Code: [Select]
<?php

$text['lucas_is_great'] = 'This is a text in english';

?>


Luego nuestro archivo principal va a tener el siguiente contenido:
Code: [Select]
<?php

//Abrimos las sessiones que se yo
session_start();

//Explico un poco,
/*Lo que vamos a checkear primero es si se esta solicitando un nuevo idioma
Si se esta solicitando, verificamos que el idioma exista tambien*/
if(!empty($_REQUEST['language']) && file_exists('languagefolder/idioma.'.$_REQUEST['language'].'.php'))
{
/*Entonces lo que vamos a hacer aca, es decir que apartir de ahora, 
nuestro idioma por defecto es este, al menos que se solicite cambiarlo de vuelta*/
$_SESSION['language'] = $_REQUEST['language'];
//y esto lo vamos a usar despues
$language $_REQUEST['language'];
}
//Sino se solicito ningun idioma, verificamos si quedo guardado en nuestra session
elseif(isset($_SESSION['language']))
//Lo mismo que antes, esto para despues
$language $_SESSION['language'];
//Y por ultimo, si nada de lo anterior se cargo, cargamos el idioma language, que seria el idioma por defecto
else
$language 'espanol';

//Ven? ahora usamos esa variable de antes
require_once('languagefolder/idioma.'.$language.'.php');


//Ejecutamos el texto en nuestro idioma
echo '<strong>'.$text['lucas_is_great'].'</strong>';

//Ahora la seleccion de idioma
echo'
<div style="float: right;">
<a href="index.php?language=espanol">
<img src="images/espanol.png" alt="" />
</a>
<a href="index.php?language=english">
<img src="images/english.png" alt="" />
</a>
</div>'
;

?>


si verifican tienen todo explicado paso a paso, lo que hace este script es cambiar el idioma y si por ejemplo tenemos español y cambiamos a ingles... este sera nuestro idioma por mas que sigamos navegando.

Pueden descargar la demo aca:
http://www.smfpersonal.net/down/165-multi-language-website.html

lucas-ruroken

  • *
  • Posts: 8114



Sorry visitor. To access the SMF Personal answers, you need to Register or Login.

Atte. SMF Personal

Tags

 


 
Application Parser To Mod

It is a system developed by SMF Personal, similar to parse smf, but with the difference that it not only show us the steps to install mods but also show us the steps to uninstall and update mods.
The mods that can be analyzed are obviously those who are raised in SMF Personal.
Section Mods

In this section you will find all mods done by the staff and users of SMF Personal.
The mods are displayed in a simple and easy to read.
Section Tutorials

In this section you will find all the tutorials made by our staff and users of SMF Personal.
The tutorials are displayed in a simple and easy to read.

SMF 2.0.2 | SMF © 2011, Simple Machines | Adk Portal 2.1.1 © SMF personal  & Adk Seo 3.0
This site is not affiliated with or endorsed by Simple Machines