#1
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.
Topic Starter
  • GendrixonEvgeny
  • Rank: YAF Camper
  • Reputation:
    Friendly
    65%
  • Joined: 05/11/2017
  • Posts: 25
#2
Originally Posted by: GendrixonEvgeny

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😛laceHolder runat="server" Visible='<%# YafContext.Current.IsGuest %>'>
Select Language: <asp😕inkButton runat="server" id="english" OnClick="english_OnClick">
                          <img src="Content/images/flags/us.png" title="Select English"/>
                    </asp😕inkButton> &nbsp;
                    <asp😕inkButton runat="server" id="russian" OnClick="russian_OnClick">
                        <img src="Content/images/flags/ru.png" title="Select Russian"/>
                    </asp😕inkButton>
</asp😛laceHolder>
    <YAF:Forum runat="server" ID="forum" BoardID="1">
    </YAF:Forum>
    </url:Form>
</body>
</html>



UserPostedImage
  • tha_watcha
  • Rank: YAF.NET Project Lead
  • Reputation:
    Exalted
    100%
  • 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: 06/03/2010
  • Posts: 4,003
  •  Germany
  • Thanks: 74 times
  • Was thanked: 1207 time(s) in 1032 post(s)
#3
Thank you! You are the best!)
Only until it is clear where this symbol came from))) http :// prntscr. com/hx68yk
Topic Starter
  • GendrixonEvgeny
  • Rank: YAF Camper
  • Reputation:
    Friendly
    65%
  • Joined: 05/11/2017
  • Posts: 25
#4
Originally Posted by: GendrixonEvgeny

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



Remove the &nbsp:
UserPostedImage
  • tha_watcha
  • Rank: YAF.NET Project Lead
  • Reputation:
    Exalted
    100%
  • 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: 06/03/2010
  • Posts: 4,003
  •  Germany
  • Thanks: 74 times
  • Was thanked: 1207 time(s) in 1032 post(s)
#5
Originally Posted by: tha_watcha

Originally Posted by: GendrixonEvgeny

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
Topic Starter
  • GendrixonEvgeny
  • Rank: YAF Camper
  • Reputation:
    Friendly
    65%
  • Joined: 05/11/2017
  • Posts: 25
#6
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😛laceHolder runat="server" Visible='<%# YafContext.Current.IsGuest %>'>
Select Language: <asp😕inkButton runat="server" id="english" OnClick="english_OnClick"><img src="Content/images/flags/us.png" title="Select English"/></asp😕inkButton>
                 &nbsp;<asp😕inkButton runat="server" id="russian" OnClick="russian_OnClick"><img src="Content/images/flags/ru.png" title="Select Russian"/></asp😕inkButton>
</asp😛laceHolder>
    <YAF:Forum runat="server" ID="forum" BoardID="1">
    </YAF:Forum>
    </url:Form>
</body>
</html>

UserPostedImage
  • tha_watcha
  • Rank: YAF.NET Project Lead
  • Reputation:
    Exalted
    100%
  • 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: 06/03/2010
  • Posts: 4,003
  •  Germany
  • Thanks: 74 times
  • Was thanked: 1207 time(s) in 1032 post(s)
#7
Originally Posted by: tha_watcha

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😛laceHolder runat="server" Visible='<%# YafContext.Current.IsGuest %>'>
Select Language: <asp😕inkButton runat="server" id="english" OnClick="english_OnClick"><img src="Content/images/flags/us.png" title="Select English"/></asp😕inkButton>
                 &nbsp;<asp😕inkButton runat="server" id="russian" OnClick="russian_OnClick"><img src="Content/images/flags/ru.png" title="Select Russian"/></asp😕inkButton>
</asp😛laceHolder>
    <YAF:Forum runat="server" ID="forum" BoardID="1">
    </YAF:Forum>
    </url:Form>
</body>
</html>



Yes it works. Thank you very much!

Update:

<asp😕inkButton runat="server" id="english" OnClick="english_OnClick"><img src="Content/images/flags/us.png" title="Select English"/></asp😕inkButton>
&nbsp;<asp😕inkButton runat="server" id="russian" OnClick="russian_OnClick"><img src="Content/images/flags/ru.png" title="Select Russian"/></asp😕inkButton>

TO

<asp😕inkButton runat="server" id="english" OnClick="english_OnClick"><img src="../Content/images/flags/us.png" title="Select English"/></asp😕inkButton>
&nbsp;<asp😕inkButton runat="server" id="russian" OnClick="russian_OnClick"><img src="../Content/images/flags/ru.png" title="Select Russian"/></asp😕inkButton>
Topic Starter
  • GendrixonEvgeny
  • Rank: YAF Camper
  • Reputation:
    Friendly
    65%
  • Joined: 05/11/2017
  • Posts: 25
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.

About Us

The YAF.NET is an open source .NET forum project. YAF.NET is supported by an team of international developers who are build community by building community software.

Powered by Resharper Donate with PayPal button

Project Twitter Updates

Copyright © YetAnotherForum.NET & Ingo Herbote. All rights reserved