• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 244
  • Last Modified:

Switch my website layout : case of the language

Hi,
i'm developing a website that support  two languages (french , arab);
As you know arabic language is from the right to left.
My problem is with this arabic version,
how can i do?
0
keviin55
Asked:
keviin55
  • 7
  • 6
1 Solution
 
ALaRivaCommented:
You can use the [dir] attribute of either the html or body tag, and set it to 'rtl' (RIGHT-TO-LEFT/Arabic) or 'ltr' (LEFT-TO-RIGHT/French).

<body dir="rtl">...yourcontent...</body>

Your divs and other controls can also be changed on an individual basis, but if you want it across the entire page, then the html or body tag would be best.

hth

- Anthony
0
 
keviin55Author Commented:

thank you It can help me,
but how can i change the value of "dir" attribute as the user's choice?
0
 
ALaRivaCommented:
How are you keeping track of their choice?
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

 
keviin55Author Commented:
the user will choose the language by clicking a button.
I do not know what to do if I made ¿¿a variable and I put in the url, or I do two differen folder:
tmysite/ar and mysite/fr yours it is to you to help me
0
 
ALaRivaCommented:
What I meant is how are you keeping track of their selection of language?

Are you storing it in a Session Variable?

*** Question needed for later ***
Are you using master page with the site?
0
 
keviin55Author Commented:
I dont not know yet how to keep track of their selection of language.
you can offer me some ideas.
yes I use a master page for my asp site .
0
 
ALaRivaCommented:
You can use a session variable for the language selection.

UNLESS, if they log in to the site then you might want to store their preference in whatever database you are using, that way they don't need to reselect their language each time.

Let me know which method you decide to go with and I can finish up the original question.
0
 
keviin55Author Commented:
the user will not login so i will use session .
0
 
ALaRivaCommented:
OK, so what you can do is set a default when the session begins (French or Arabic, you choose), and then in the master page you can do this at the top...

<%
if Session("siteLanguage") = "Arabic" Then
  strDirection = "rtl"
      else
  strDirection = "ltr"
End If
%>

... other code you may have...

<html dir="<% =strDirection %>">
______________________________________________


You might need to play with that, but that is the concept.

hth

- Anthony
0
 
keviin55Author Commented:
Thank you,
I tried this code to redirect the user but it dont works
 
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class façade : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        Session("lang") = "ar";
        Response.Redirect("test.aspx");
    }
    protected void Button2_Click(object sender, EventArgs e)
    {
        Session("lang") = "fr";
        Response.Redirect("test.aspx");

    }
}

Open in new window

0
 
ALaRivaCommented:
What happens when you click the button? Does it error?
0
 
keviin55Author Commented:
this is the error:
Compiler Error Message: CS0118: 'System.Web.UI.Page.Session'is a 'property' but is used as a 'method'
0
 
keviin55Author Commented:
Thank you fo your help it is solved .
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

  • 7
  • 6
Tackle projects and never again get stuck behind a technical roadblock.
Join Now