Welcome Guest! To enable all features please
Login or Register.
Hello. Thank you for this wonderful product! I have a question. Is it possible to change the language for non-registered users? My forum for example is visited from different countries, and the default language is Russian. I would like to make English and Russian on the main page.
Hello. Thank you for this wonderful product! I have a question. Is it possible to change the language for non-registered users? My forum for example is visited from different countries, and the default language is Russian. I would like to make English and Russian on the main page.
At the moment guest users can not change the language, but you could add a simple language selection to the default.aspx
<%@ Page Language="C#" AutoEventWireup="true" ValidateRequest="false" Inherits="YAF.ForumPageBase" %>
<%@ Register TagPrefix="YAF" Assembly="YAF" Namespace="YAF" %>
<%@ Register TagPrefix="url" Namespace="Intelligencia.UrlRewriter" Assembly="Intelligencia.UrlRewriter" %>
<script runat="server">
protected void english_OnClick(object sender, EventArgs e)
{
YafContext.Current.Get<YafBoardSettings>().Language = "english.xml";
Response.Redirect(Request.RawUrl);
}
protected void russian_OnClick(object sender, EventArgs e)
{
YafContext.Current.Get<YafBoardSettings>().Language = "russian.xml";
Response.Redirect(Request.RawUrl);
}
</script>
<!doctype html>
<html lang="en">
<head id="YafHead" runat="server">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta http-equiv="x-ua-compatible" content="ie=edge"><meta id="YafMetaScriptingLanguage" http-equiv="Content-Script-Type" runat="server"
name="scriptlanguage" content="text/javascript" />
<meta id="YafMetaStyles" http-equiv="Content-Style-Type" runat="server" name="styles"
content="text/css" />
<meta id="YafMetaDescription" runat="server" name="description" content="Yet Another Forum.NET -- A bulletin board system written in ASP.NET" />
<meta id="YafMetaKeywords" runat="server" name="keywords" content="Yet Another Forum.net, Forum, ASP.NET, BB, Bulletin Board, opensource" />
<title></title>
</head>
<body id="YafBody" runat="server" style="margin: 0; padding: 5px">
<asp:HyperLink runat="server" id="BannerLink" >
<img src="~/forumlogo.jpg" runat="server" alt="logo" style="border: 0;" id="imgBanner" />
</asp:HyperLink>
<br />
<url:Form id="form1" runat="server" enctype="multipart/form-data">
<asp:PlaceHolder runat="server" Visible='<%# YafContext.Current.IsGuest %>'>
Select Language: <asp:LinkButton runat="server" id="english" OnClick="english_OnClick">
<img src="Content/images/flags/us.png" title="Select English"/>
</asp:LinkButton>
<asp:LinkButton runat="server" id="russian" OnClick="russian_OnClick">
<img src="Content/images/flags/ru.png" title="Select Russian"/>
</asp:LinkButton>
</asp:PlaceHolder>
<YAF:Forum runat="server" ID="forum" BoardID="1">
</YAF:Forum>
</url:Form>
</body>
</html>

Thank you! You are the best!)
Only until it is clear where this symbol came from))) http :// prntscr. com/hx68yk
Edited by user
2018-01-07T11:58:25Z
|
Reason: Not specified
Thank you! You are the best!)
Only until it is clear where this symbol came from))) http :// prntscr. com/hx68yk
Remove the  :
Thank you! You are the best!)
Only until it is clear where this symbol came from))) http :// prntscr. com/hx68yk
Remove the  :
I tried http :// prntscr. com/hx6jlm
Edited by user
2018-01-07T12:39:29Z
|
Reason: Not specified
change it to...
<%@ Page Language="C#" AutoEventWireup="true" ValidateRequest="false" Inherits="YAF.ForumPageBase" %>
<%@ Register TagPrefix="YAF" Assembly="YAF" Namespace="YAF" %>
<%@ Register TagPrefix="url" Namespace="Intelligencia.UrlRewriter" Assembly="Intelligencia.UrlRewriter" %>
<script runat="server">
protected void english_OnClick(object sender, EventArgs e)
{
YafContext.Current.Get<YafBoardSettings>().Language = "english.xml";
Response.Redirect(Request.RawUrl);
}
protected void russian_OnClick(object sender, EventArgs e)
{
YafContext.Current.Get<YafBoardSettings>().Language = "russian.xml";
Response.Redirect(Request.RawUrl);
}
</script>
<!doctype html>
<html lang="en">
<head id="YafHead" runat="server">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta http-equiv="x-ua-compatible" content="ie=edge"><meta id="YafMetaScriptingLanguage" http-equiv="Content-Script-Type" runat="server"
name="scriptlanguage" content="text/javascript" />
<meta id="YafMetaStyles" http-equiv="Content-Style-Type" runat="server" name="styles"
content="text/css" />
<meta id="YafMetaDescription" runat="server" name="description" content="Yet Another Forum.NET -- A bulletin board system written in ASP.NET" />
<meta id="YafMetaKeywords" runat="server" name="keywords" content="Yet Another Forum.net, Forum, ASP.NET, BB, Bulletin Board, opensource" />
<title></title>
</head>
<body id="YafBody" runat="server" style="margin: 0; padding: 5px">
<asp:HyperLink runat="server" id="BannerLink" >
<img src="~/forumlogo.jpg" runat="server" alt="logo" style="border: 0;" id="imgBanner" />
</asp:HyperLink>
<br />
<url:Form id="form1" runat="server" enctype="multipart/form-data">
<asp:PlaceHolder runat="server" Visible='<%# YafContext.Current.IsGuest %>'>
Select Language: <asp:LinkButton runat="server" id="english" OnClick="english_OnClick"><img src="Content/images/flags/us.png" title="Select English"/></asp:LinkButton>
<asp:LinkButton runat="server" id="russian" OnClick="russian_OnClick"><img src="Content/images/flags/ru.png" title="Select Russian"/></asp:LinkButton>
</asp:PlaceHolder>
<YAF:Forum runat="server" ID="forum" BoardID="1">
</YAF:Forum>
</url:Form>
</body>
</html>

change it to...
<%@ Page Language="C#" AutoEventWireup="true" ValidateRequest="false" Inherits="YAF.ForumPageBase" %>
<%@ Register TagPrefix="YAF" Assembly="YAF" Namespace="YAF" %>
<%@ Register TagPrefix="url" Namespace="Intelligencia.UrlRewriter" Assembly="Intelligencia.UrlRewriter" %>
<script runat="server">
protected void english_OnClick(object sender, EventArgs e)
{
YafContext.Current.Get<YafBoardSettings>().Language = "english.xml";
Response.Redirect(Request.RawUrl);
}
protected void russian_OnClick(object sender, EventArgs e)
{
YafContext.Current.Get<YafBoardSettings>().Language = "russian.xml";
Response.Redirect(Request.RawUrl);
}
</script>
<!doctype html>
<html lang="en">
<head id="YafHead" runat="server">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta http-equiv="x-ua-compatible" content="ie=edge"><meta id="YafMetaScriptingLanguage" http-equiv="Content-Script-Type" runat="server"
name="scriptlanguage" content="text/javascript" />
<meta id="YafMetaStyles" http-equiv="Content-Style-Type" runat="server" name="styles"
content="text/css" />
<meta id="YafMetaDescription" runat="server" name="description" content="Yet Another Forum.NET -- A bulletin board system written in ASP.NET" />
<meta id="YafMetaKeywords" runat="server" name="keywords" content="Yet Another Forum.net, Forum, ASP.NET, BB, Bulletin Board, opensource" />
<title></title>
</head>
<body id="YafBody" runat="server" style="margin: 0; padding: 5px">
<asp:HyperLink runat="server" id="BannerLink" >
<img src="~/forumlogo.jpg" runat="server" alt="logo" style="border: 0;" id="imgBanner" />
</asp:HyperLink>
<br />
<url:Form id="form1" runat="server" enctype="multipart/form-data">
<asp:PlaceHolder runat="server" Visible='<%# YafContext.Current.IsGuest %>'>
Select Language: <asp:LinkButton runat="server" id="english" OnClick="english_OnClick"><img src="Content/images/flags/us.png" title="Select English"/></asp:LinkButton>
<asp:LinkButton runat="server" id="russian" OnClick="russian_OnClick"><img src="Content/images/flags/ru.png" title="Select Russian"/></asp:LinkButton>
</asp:PlaceHolder>
<YAF:Forum runat="server" ID="forum" BoardID="1">
</YAF:Forum>
</url:Form>
</body>
</html>
Yes it works. Thank you very much!Update:
<asp:LinkButton runat="server" id="english" OnClick="english_OnClick"><img src="Content/images/flags/us.png" title="Select English"/></asp:LinkButton>
<asp:LinkButton runat="server" id="russian" OnClick="russian_OnClick"><img src="Content/images/flags/ru.png" title="Select Russian"/></asp:LinkButton>
TO
<asp:LinkButton runat="server" id="english" OnClick="english_OnClick"><img src="
../Content/images/flags/us.png" title="Select English"/></asp:LinkButton>
<asp:LinkButton runat="server" id="russian" OnClick="russian_OnClick"><img src="
../Content/images/flags/ru.png" title="Select Russian"/></asp:LinkButton>
Edited by user
2018-01-07T13:16:05Z
|
Reason: Not specified
Forum Jump
- You cannot post new topics in this forum.
- You cannot reply to topics in this forum.
- You cannot delete your posts in this forum.
- You cannot edit your posts in this forum.
- You cannot create polls in this forum.
- You cannot vote in polls in this forum.
Important Information:
The YAF.NET Support Forum uses cookies. By continuing to browse this site, you are agreeing to our use of cookies.
More Details
Close