..:: MX Studio Fóruns ::..: Paginas com idioma portugues/inglês usando XML - ..:: MX Studio Fóruns ::..

Jump to content

Publicidade




Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Paginas com idioma portugues/inglês usando XML

#1 User is offline   xanburzum 

  • Group: Administrador
  • Posts: 2076
  • Joined: 04-November 08

Posted 04 September 2009 - 08:35 PM



CÓDIGO
<%
'Função para Montar o XML de acordo com o idioma
function f_sDescricaoIdioma(sNomeArquivoXML,sTag,sNomeIdioma)
    Dim objMainXML
    Dim objXml
    Dim oRetorno

    set objMainXML=Server.CreateObject("microsoft.xmldom")
    objMainXML.async=False
    objMainXML.load(server.MapPath("Idiomas/" & sNomeIdioma & "/" & sNomeArquivoXML))

    set objXml=objMainXML.documentElement

    if typename(objXml) = "IXMLDOMElement" then 'Verifica se o objeto é um arquivo xml
        set oRetorno = objXml.selectSingleNode(sTag)
    
        if TypeName(oRetorno) = "IXMLDOMElement" then 'Verifica se o código atribuído na variável "sTag" existe no documento XML.
            f_sDescricaoIdioma = oRetorno.text
        else
            f_sDescricaoIdioma = "NA"            
        end if
    else
        f_sDescricaoIdioma = "NA"
    end if            
    
    set objMainXML= nothing
    set objXml=nothing
    set oRetorno=nothing    
end function
%>


pagina default

CÓDIGO
<%@ Language=VBScript %>
<!--#include file="f_sDescricaoIdioma.asp"-->
<%
Dim sNomeIdioma
if Request("Idioma") = "" then
    sNomeIdioma = "Portugues" 'Idioma Padrão
else
    sNomeIdioma = Request("Idioma")
end if

%>
<html>
    <head><title>..:: Site Multi-Idioma ::..</title></head>    
    <body topmargin="0" leftmargin="0">
        <table border="0" cellpadding="0" cellspacing="0" width="100%" height="100%">
            <tr height="100px" bgcolor="orange">
                <Td colspan="2"><font color="white" size="6">Site Multi-Idioma<font><br><a href="PaginaPrincipal.asp?Idioma=Portugues">Português</a> / <a href="PaginaPrincipal.asp?Idioma=Ingles">Inglês</a></td>
            </tr>
            <tr bgcolor="white" align="center">
                <td width="15%">
                    <table border="0" cellpadding="4" cellspacing="4" width="100%" height="100%">
                        <tr height="30px" bgcolor="#f1f1f1">
                            <td><%=f_sDescricaoIdioma("PaginaPrincipal.asp.xml","labels/label[@id='LB_001']",sNomeIdioma)%></td>
                        </tr>
                        <tr height="30px" bgcolor="#f1f1f1">
                            <td><%=f_sDescricaoIdioma("PaginaPrincipal.asp.xml","labels/label[@id='LB_002']",sNomeIdioma)%></td>
                        </tr>
                        <tr height="30px" bgcolor="#f1f1f1">
                            <td><%=f_sDescricaoIdioma("PaginaPrincipal.asp.xml","labels/label[@id='LB_003']",sNomeIdioma)%></td>
                        </tr>
                        <tr height="30px" bgcolor="#f1f1f1">
                            <td><%=f_sDescricaoIdioma("PaginaPrincipal.asp.xml","labels/label[@id='LB_004']",sNomeIdioma)%></td>
                        </tr>
                        <tr height="30px" bgcolor="#f1f1f1">
                            <td><%=f_sDescricaoIdioma("PaginaPrincipal.asp.xml","labels/label[@id='LB_005']",sNomeIdioma)%></td>
                        </tr>
                        <tr height="30px" bgcolor="#f1f1f1">
                            <td><%=f_sDescricaoIdioma("PaginaPrincipal.asp.xml","labels/label[@id='LB_006']",sNomeIdioma)%></td>
                        </tr>
                        <tr height="30px" bgcolor="#f1f1f1">
                            <td><%=f_sDescricaoIdioma("PaginaPrincipal.asp.xml","labels/label[@id='LB_007']",sNomeIdioma)%></td>
                        </tr>
                        <tr height="30px" bgcolor="#f1f1f1">
                            <td><%=f_sDescricaoIdioma("PaginaPrincipal.asp.xml","labels/label[@id='LB_008']",sNomeIdioma)%></td>
                        </tr>
                    </table>
                </td>
                <td width="85%">
                </td>
            </tr>    
        </table>
    </body>
</html>


xml portugues
CÓDIGO
<?xml version="1.0" encoding="ISO-8859-1" ?>
- <internationalization>
  <language id="linguagem">PORTUGUES</language>
  <resource>PaginaPrincipal.asp.xml</resource>
- <labels>
  <label id="LB_001">Página Principal</label>
  <label id="LB_002">Produtos</label>
  <label id="LB_003">Seviços</label>
  <label id="LB_004">Clientes</label>
  <label id="LB_005">Portifólio</label>
  <label id="LB_006">Contato</label>
  <label id="LB_007">Usuário</label>
  <label id="LB_008">Senha</label>
  </labels>
- <messages>
  <message id="MS_001">Campo de preenchimento obrigatório!</message>
  </messages>
  </internationalization>


ingles
CÓDIGO
<?xml version="1.0" encoding="ISO-8859-1" ?>
- <internationalization>
  <language id="linguagem">INGLES</language>
  <resource>PaginaPrincipal.asp.xml</resource>
- <labels>
  <label id="LB_001">Home</label>
  <label id="LB_002">Products</label>
  <label id="LB_003">Services</label>
  <label id="LB_004">Customers</label>
  <label id="LB_005">Portifólio</label>
  <label id="LB_006">Contact</label>
  <label id="LB_007">Username</label>
  <label id="LB_008">Password</label>
  </labels>
- <messages>
  <message id="MS_001">Fill in the mandatory fields!</message>
  </messages>
  </internationalization>

0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic



Publicidade




1 User(s) are reading this topic
0 membro(s), 1 visitante(s) e 0 membros anônimo(s)