Elsinore

User Forum

www.screenconnect.com
Welcome Guest Search | Active Topics | Log In | Register

Tag as favorite
Multiple Language support on Guest page?
skuliaxe
#1 Posted : Tuesday, November 01, 2011 12:36:14 AM
Rank: Advanced Member
Joined: 2/22/2011
Posts: 39
Location: Reykjavik
Could I possibly ask you to help me implement multiple language support on our guest page?

My preferred requirements would be:
1) Have all custom codes separated from the original files. Then just add one line in the original files to call the custom code. This makes it more upgrade save and easier.
2) Use a simple drop down list to switch between languages (resx files), using global localization to auto select the language would not work as 90% of users have Windows in English while their preferred web language is something else.
Jake Morgan
#2 Posted : Tuesday, November 01, 2011 10:47:15 PM
Rank: Administration
Joined: 4/9/2010
Posts: 859
Here you have it in "one line":

Code:
protected override void InitializeCulture() { var language = this.Request.QueryString["Language"]; if (!string.IsNullOrEmpty(language)) this.UICulture = language; }


You can put at the top of Guest.aspx inside the server script tag.

But I didn't include the dropdown. ASP.NET server controls aren't great here because the culture has to be changed so early in the page life-cycle. You could always use straight HTML select elements with some javascript.

How about just a couple of links somewhere on the page for your different languages? :

Code:

    <a href="?Language=es-ES">Spanish</a>
    <a href="?Language=en-US">English</a>


Or you can put the links on your feeder page. Or if you have users typing in URLs, you can use a different URL for each language (eg ensup.mycompany.com and desup.mycompany.com)?
skuliaxe
#3 Posted : Wednesday, November 02, 2011 11:38:24 AM
Rank: Advanced Member
Joined: 2/22/2011
Posts: 39
Location: Reykjavik
Thank you Jake.

The language switch works by adding "?Language=" to the url, but as we are using an iFrame, this is not working:
Code:
<iframe width="100%" src="http://domain.com/?Theme=Embedded" frameborder="0" scrolling="No" height="200"></iframe>


Do you have any hint´s on getting this to work when using a dropDownList in the iFrame?

At the moment I´m using this dropdown but the language is not changing:
Code:
<asp:DropDownList runat="server" ID="LanguageList" AutoPostBack="true">
          <asp:ListItem Value="is-IS" Text="Icelandic" />
          <asp:ListItem Value="en-EN" Text="English" />
    </asp:DropDownList>



Jake Morgan
#4 Posted : Wednesday, November 02, 2011 5:48:14 PM
Rank: Administration
Joined: 4/9/2010
Posts: 859
That dropdownlist isn't going to work well unless you use it to set session state or something like that. The point in the page load where we have to set the culture is way too early to interact with the dropdownlist. That's the main problem with that solution.

Your iframe URL could be something like this: http://domain.com/?Theme...edded&Language=en-US
skuliaxe
#5 Posted : Thursday, November 03, 2011 2:56:02 PM
Rank: Advanced Member
Joined: 2/22/2011
Posts: 39
Location: Reykjavik
Thanks Jake,

I ended on just having the control on the parent page by using a dropdown with a redirect to the corresponding iframe.
microbone
#6 Posted : Wednesday, March 21, 2012 2:20:19 PM
Rank: Newbie
Joined: 3/20/2012
Posts: 7
Location: Denmark
Looks interesting...

If I apply the line:
Code:
protected override void InitializeCulture() { var language = this.Request.QueryString["Language"]; if (!string.IsNullOrEmpty(language)) this.UICulture = language; }


What do I need to to now?

Somewhere on the guest.aspx place this i guess:
Code:
a href="?Language=es-ES">Spanish</a>
    <a href="?Language=en-US">English</a>


But now what where to get the strings I need to translate and how to store them?

Update:
Got the Simple Resx Editor...

saved a copy of Default.resx named da.resx.

Made some translations...

What now?
Jake Morgan
#7 Posted : Wednesday, March 21, 2012 3:13:53 PM
Rank: Administration
Joined: 4/9/2010
Posts: 859
So you should have Default.resx and Default.da.resx in your App_GlobalResources folder.

When you have a URL like "http://sc.yourcompany.com/Guest?Language=da" in your address bar, what language displays on the page?
microbone
#8 Posted : Wednesday, March 21, 2012 3:38:06 PM
Rank: Newbie
Joined: 3/20/2012
Posts: 7
Location: Denmark
This is great :)
Users browsing this topic
Guest
Tag as favorite
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.