If you are developing your project or site using .Net 3.5 means then you can use Resource files and you can use "culture" which is a part of .Net 3.5 for implementing mulilingual sites.
Please go through forums for implementing multilingual using .Net 3.5 , its very easy and the best way when compared of using db or xml...etc..
Please do not forget to click Mark As Answer on the post that helped you.
Regards,
K.Sivakumar
Marked as answer by reven_gr on Nov 09, 2009 12:49 PM
Private Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
Me.Culture = "en-us"
Me.UICulture = "en-us"
End Sub
Private Sub Button2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button2.Click
Me.Culture = "el-gr"
Me.UICulture = "el-gr"
End Sub
you must change Culture before InitializeCulture event:
Protected Overrides Sub InitializeCulture()
If Array.IndexOf(Request.Form.AllKeys, "Button1") > -1 Then
Me.Culture = "en-us"
Me.UICulture = "en-us"
ElseIf Array.IndexOf(Request.Form.AllKeys, "Button2") > -1 Then
Me.Culture = "el-gr"
Me.UICulture = "el-gr"
End If
MyBase.InitializeCulture()
End Sub
reven_gr
Member
376 Points
320 Posts
multilanguage
Nov 09, 2009 06:26 AM|LINK
hi there,
i would like to make a multilanguage site.
so i thought to make a table of words in different languages and select according to the language selection.
for example:
EN - FR - IT ...
word1 word1 word1 ...
word2 word2 word2 ...
..................................
What is the best way to do so?
make an xml, an html, a vb file or something else?
any ideas?
thanks
Steelymar
All-Star
15283 Points
2239 Posts
Re: multilanguage
Nov 09, 2009 06:54 AM|LINK
read this:
http://www.codeproject.com/Kb/aspnet/localizationByVivekTakur.aspx
http://support.microsoft.com/kb/893663
Stefan Uzunov
MCTS: .NET Framework 3.5 ASP.NET Applications
sivagates05
Member
127 Points
59 Posts
Re: multilanguage
Nov 09, 2009 06:55 AM|LINK
hi reven_gr
If you are developing your project or site using .Net 3.5 means then you can use Resource files and you can use "culture" which is a part of .Net 3.5 for implementing mulilingual sites.
Please go through forums for implementing multilingual using .Net 3.5 , its very easy and the best way when compared of using db or xml...etc..
Regards,
K.Sivakumar
vipuldonga
Contributor
3753 Points
692 Posts
Re: multilanguage
Nov 09, 2009 06:56 AM|LINK
hi,
best way is to store into the database. so whenever page load you can get the which language is and base on that you can fecth all teh record
Vipul Donga
Mark it as an answer, if it helped
if (MyAnswer)
MarkAsAnswer();
else
Repsonse.Write("correct me where i am wrong");
reven_gr
Member
376 Points
320 Posts
Re: multilanguage
Nov 09, 2009 07:44 AM|LINK
<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="Default.aspx.vb" Inherits="language._Default" culture="auto" meta:resourcekey="PageResource1" uiculture="auto" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server"> <meta http-equiv="Content-Type" content="text/html;charset=utf-8" /> <title>Untitled Page</title> </head> <body> <form id="form1" runat="server"> <div> <asp:Button ID="Button1" Runat="server" meta:resourceKey = "ButtonResource1" Text="English Button" /> <asp:Button ID="Button2" Runat="server" meta:resourcekey = "ButtonResource2" Text="Greek Button" /> <asp:Label ID="Label1" runat="server" Text ="testX" meta:resourcekey="LabelResource1"> </asp:Label> </div> </form> </body> </html>and two resx files
Default.aspx.en-us.resx
where i have set
LabelResource1.Text = test
PageResource1.Title = English Page
accordingly to
Default.aspx.el-gr.resx
and
in code behind
Private Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click Me.Culture = "en-us" Me.UICulture = "en-us" End Sub Private Sub Button2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button2.Click Me.Culture = "el-gr" Me.UICulture = "el-gr" End Subbut the language is not changing...
What am i doing wrong?
thanks
Steelymar
All-Star
15283 Points
2239 Posts
Re: multilanguage
Nov 09, 2009 08:08 AM|LINK
you must change Culture before InitializeCulture event:
Protected Overrides Sub InitializeCulture()
If Array.IndexOf(Request.Form.AllKeys, "Button1") > -1 Then
Me.Culture = "en-us"
Me.UICulture = "en-us"
ElseIf Array.IndexOf(Request.Form.AllKeys, "Button2") > -1 Then
Me.Culture = "el-gr"
Me.UICulture = "el-gr"
End If
MyBase.InitializeCulture()
End Sub
<asp:Label ID="Label1" runat="server" Text="<%$ Resources:LabelResource1 %>" ></asp:Label>
Stefan Uzunov
MCTS: .NET Framework 3.5 ASP.NET Applications
reven_gr
Member
376 Points
320 Posts
Re: multilanguage
Nov 09, 2009 08:19 AM|LINK
i am getting:
Parser Error Message: The resource object with key 'LabelResource1' was not found.
any ideas?
thanks
Steelymar
All-Star
15283 Points
2239 Posts
Re: multilanguage
Nov 09, 2009 08:25 AM|LINK
my mistake
<asp:Label ID="Label1" runat="server" Text="<%$ Resources:LabelResource1.Text %>" ></asp:Label>
but you can use and meta:resourcekey="LabelResource1"
Stefan Uzunov
MCTS: .NET Framework 3.5 ASP.NET Applications
reven_gr
Member
376 Points
320 Posts
Re: multilanguage
Nov 09, 2009 08:50 AM|LINK
unfortunatly it has the same problem
The resource object with key 'LabelResource1.Text' was not found.
i have in both resx files the LabelResource1.Text
meta:resourcekey="LabelResource1.Text" do not throught error but still is not changing.
any ideas?
thanks
raorane.swag...
Member
57 Points
44 Posts
Re: multilanguage
Nov 09, 2009 09:01 AM|LINK
plz correct it like this
meta:resourcekey="LabelResource1"
Swagat A. Raorane.