I build a fine working translating user control. It's translating phrases and words depending on a xml source.
Nederlands.xml : (simplefied)
<?xml version="1.0" encoding="utf-8" ?>
<translation>
<words>
<this>dit</this>
<please>S.V.P.</please>
<webpage>webpagina</webpage>
<ready>klaar</ready>
<is>is</is>
<click_here>klik hier</click_here>
<to_go_further>om verder te gaan</to_go_further>
</words>
</translation>
Translator.ascx :
<%@ Control Language="VB" AutoEventWireup="false" CompileWith="translator.ascx.vb" ClassName="translator_ascx" %>
<asp:label id="translated" runat="server" />
Translator.ascx.vb :
Imports System
Imports System.data
Public Class translator_ascx
Dim lang, word As String
Dim stringArray As String()
Dim tel As Integer
Public Property Langfile() As String
Get
Return translated.Text
End Get
Set(ByVal value As String)
lang = value
End Set
End Property
Public Property Phrase() As String
Get
Return translated.Text
End Get
Set(ByVal value As String)
Dim langaugefiletoread As DataSet = New DataSet
stringArray = value.Split(" ")
For tel = 0 To stringArray.Length - 1
Try
langaugefiletoread.ReadXml(MapPath(lang))
word = langaugefiletoread.Tables("words").Rows(0).Item(stringArray(tel)).ToString()
If Asc(Left(stringArray(tel), 1)) > 64 And Asc(Left(stringArray(tel), 1)) < 91 Then
translated.Text += UCase(Left(word, 1)) & LCase(Right(word, Len(word) - 1)) & " "
Else
translated.Text += word & " "
End If
Catch
translated.Text += stringArray(tel) & " "
End Try
Next
End Set
End Property
End Class
default.aspx :
<%@ Page Language="VB" AutoEventWireup="false" CompileWith="Default.aspx.vb" ClassName="Default_aspx" Debug="true" %>
<%@ Register TagPrefix="otd" TagName="translator" Src="otd/translator.ascx" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Otd test page</title>
</head>
<body>
<form id="form1" runat="server">
<otd:translator Phrase="<a href='http://go.com'> Click_here </a>" langfile="Nederlands.xml" runat="server" /><br />
</form>
</body>
</html>
------------------------------------
This all works very fine, but de control tag is not well formed, i would like to see this:
<otd:translator langfile="Nederlands.xml" runat="server" />
<a href='http://go.com'> Click_here </a>"
</otd:translator>
-----------------------------------
But i can't get rid of the error "No literal content allowed".
Anyone a good suggestion?
Thanks in front.
imre