Welcome Guest! To enable all features please Login or Register.
Options
View
Go to last post Go to first unread
Offline GendrixonEvgeny  
#1 Posted : Sunday, January 7, 2018 12:29:33 AM(UTC)
GendrixonEvgeny


Rank: YAF Camper

Reputation:

Joined: 11/5/2017(UTC)
Posts: 25

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.
Sponsor
Offline tha_watcha  
#2 Posted : Sunday, January 7, 2018 8:28:33 AM(UTC)
tha_watcha


Rank: YAF.NET Project Lead

Reputation:

Medals: Medal of Honor: Portal Puzzle Master: Portal Puzzle Master for DNNMedal of Honor Key: Given to pillars of the community who are key players in the YAF community and project.DNN Master: DNN Module ManBug Killer Medal of Honor: Medal for being a kick-ass bug killer!Medal of Honor for the Support King: Support King! Amazing asset to the YAF.NET Community.

Joined: 3/6/2010(UTC)
Posts: 3,821
Germany

Thanks: 70 times
Was thanked: 1174 time(s) in 1004 post(s)
Originally Posted by: GendrixonEvgeny Go to Quoted Post
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

Code:
<%@ 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> &nbsp;
                    <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>


Offline GendrixonEvgeny  
#3 Posted : Sunday, January 7, 2018 11:43:27 AM(UTC)
GendrixonEvgeny


Rank: YAF Camper

Reputation:

Joined: 11/5/2017(UTC)
Posts: 25

Thank you! You are the best!)
Only until it is clear where this symbol came from))) http :// prntscr. com/hx68yk

Edited by user Sunday, January 7, 2018 11:58:25 AM(UTC)  | Reason: Not specified

Offline tha_watcha  
#4 Posted : Sunday, January 7, 2018 12:30:04 PM(UTC)
tha_watcha


Rank: YAF.NET Project Lead

Reputation:

Medals: Medal of Honor: Portal Puzzle Master: Portal Puzzle Master for DNNMedal of Honor Key: Given to pillars of the community who are key players in the YAF community and project.DNN Master: DNN Module ManBug Killer Medal of Honor: Medal for being a kick-ass bug killer!Medal of Honor for the Support King: Support King! Amazing asset to the YAF.NET Community.

Joined: 3/6/2010(UTC)
Posts: 3,821
Germany

Thanks: 70 times
Was thanked: 1174 time(s) in 1004 post(s)
Originally Posted by: GendrixonEvgeny Go to Quoted Post
Thank you! You are the best!)
Only until it is clear where this symbol came from))) http :// prntscr. com/hx68yk


Remove the &nbsp:
Offline GendrixonEvgeny  
#5 Posted : Sunday, January 7, 2018 12:37:02 PM(UTC)
GendrixonEvgeny


Rank: YAF Camper

Reputation:

Joined: 11/5/2017(UTC)
Posts: 25

Originally Posted by: tha_watcha Go to Quoted Post
Originally Posted by: GendrixonEvgeny Go to Quoted Post
Thank you! You are the best!)
Only until it is clear where this symbol came from))) http :// prntscr. com/hx68yk


Remove the &nbsp:


I tried http :// prntscr. com/hx6jlm

Edited by user Sunday, January 7, 2018 12:39:29 PM(UTC)  | Reason: Not specified

Offline tha_watcha  
#6 Posted : Sunday, January 7, 2018 12:50:49 PM(UTC)
tha_watcha


Rank: YAF.NET Project Lead

Reputation:

Medals: Medal of Honor: Portal Puzzle Master: Portal Puzzle Master for DNNMedal of Honor Key: Given to pillars of the community who are key players in the YAF community and project.DNN Master: DNN Module ManBug Killer Medal of Honor: Medal for being a kick-ass bug killer!Medal of Honor for the Support King: Support King! Amazing asset to the YAF.NET Community.

Joined: 3/6/2010(UTC)
Posts: 3,821
Germany

Thanks: 70 times
Was thanked: 1174 time(s) in 1004 post(s)
change it to...

Code:
<%@ 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>
                 &nbsp;<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>
Offline GendrixonEvgeny  
#7 Posted : Sunday, January 7, 2018 1:08:42 PM(UTC)
GendrixonEvgeny


Rank: YAF Camper

Reputation:

Joined: 11/5/2017(UTC)
Posts: 25

Originally Posted by: tha_watcha Go to Quoted Post
change it to...

Code:
<%@ 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>
                 &nbsp;<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>
&nbsp;<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>
&nbsp;<asp:LinkButton runat="server" id="russian" OnClick="russian_OnClick"><img src="../Content/images/flags/ru.png" title="Select Russian"/></asp:LinkButton>

Edited by user Sunday, January 7, 2018 1:16:05 PM(UTC)  | Reason: Not specified

Rss Feed  Atom Feed
Users browsing this topic
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.

Notification

Icon
Error