Technical support This forum is closed.
Version 1.x > Technical support > HOWTO: Retrieve available languages of a node View modes: 
User avatar
Member
Member
wtijsma - 12/27/2004 5:29:58 PM
   
HOWTO: Retrieve available languages of a node
Problem: How do I retrieve the available translations of the current page/node, to display and link to the specific culture?

User avatar
Guest
admin - 12/28/2004 3:14:58 PM
   
Re: HOWTO: Retrieve available languages of a node
Hi Wiebe,

Here's the answer to the first question - how to retrieve the available translations of the current page/node:

1) Create a new query in the Development module, for the CMS.Culture document template and call it "SelectLanguageVersions". Use the following SQL code:

select *
from cms_tree
where aliaspath in
(
select '/' + culturecode + '##WHERE##'
from cms_culture
)

2) Put a QueryRepeater control on your page and in the page code behind, please set the WhereCondition property to the current path:

QueryRepeater1.WhereCondition = Request.QueryString["aliaspath"].Replace("'", "''");

Then you need to modify the ItemTemplate of the QueryRepeater as you do in standard ASP.NET Repeater so that it displays the links.


How to display the links to particular language version:
The path of the document doesn't contain the language version, so you cannot link to the document directly. However you can do this:

1) Create a new page "CultureRedirect.aspx" that will receive one parameter: aliaspath (full path including the culture code). It will change the Session("CMSPreferredCulture") variable to appropriate culture and redirect user back to the appropriate page.

2) Generate links to this page in format href="CultureRedirect.aspx?aliaspath=<nodealiaspath>"

Should you need any help with this, please let me know.


User avatar
Guest
admin - 12/28/2004 3:23:13 PM
   
Re: HOWTO: Retrieve available languages of a node
... we will add a method returning all language versions in version 1.6 so that it is easier next time.