If you set that to "rtl" on a table (or probably better on the html/body tag, since the entire page is mort likely supposed to be served that way), the browser reverses the order of the columns...
I'm still curious about my previous question since I think we miss some kind of extension/helper (depending if you're using Razor or XSLT) that can return the selected culture of the root node - so I'm guessing what you're doing is just naming the root nodes according to the sites culture, right? It's not razor that returns the selected culture on the root node?
Usually when I need this I add a setting on the root node, where the language can be selected. But it's a bit annoying and would be awesome if we could just get it returned from the setting we have already made :)
Yes, my rootnodes are named after my language settings:
en-Us (hostname: localhost/en-us)
he-IL (hostname: localhost/he-il)
I think this helper method for determining the culture of the rootnode would be a very good idea, as it would make it unnessery to query for it in Razor or Xslt.
programmaticaly detecting language version
Hi,
Currently I'm working on a multilanguage website (en - he)
Because the Hebrew language reads right to left (RTL) I need to reverve the field columns of a table that is programmaticaly generated (in Razor).
So the heading columns "Name", "Value" should reverse order to "Value", "Name" when the Hebrew version of the page is shown.
Therefore my question, I there a way to programmaticaly determine the language context in which the page is shown?
Thanks,
Anthony
Found the solution:
just query for the root of the current page:
var root = Model.AncestorOrSelf.Where("NodeTypeAlias == \"Homepage\"");
Then you can conditionally generate the table with the columns in the right order:
if (root.Name == "en-Us")
{
<table>
<tr>
<th>@Dictionary["name"]</th><th>@Dictionary["value"]</th>
</tr>
<tr>
<td>@Dictionary["Full Name"]:</td><td>@formModel.FullName</td>
</tr>
<tr>
<td>@Dictionary["Email"]:</td><td>@formModel.Email</td>
</tr>
<tr>
<td>@Dictionary["Your question"]:</td>
<td>@formModel.Question</td>
</tr>
</table>
}
Hope this code can help others who are building multilingual websites.
Anthony
Hi Anthony
Is the name of your root nodes for each language the language code, like en-Us?
/Jan
Hi Anthony,
Are you aware of the dir attribute in HTML?
If you set that to "rtl" on a table (or probably better on the html/body tag, since the entire page is mort likely supposed to be served that way), the browser reverses the order of the columns...
/Chriztian
Hi Chriztian,
Thanks a lot for the tip. I tested it out with the css attribute direction:rtl; and it works fine :)
greetings,
Anthony
Hi Anthony
I'm still curious about my previous question since I think we miss some kind of extension/helper (depending if you're using Razor or XSLT) that can return the selected culture of the root node - so I'm guessing what you're doing is just naming the root nodes according to the sites culture, right? It's not razor that returns the selected culture on the root node?
Usually when I need this I add a setting on the root node, where the language can be selected. But it's a bit annoying and would be awesome if we could just get it returned from the setting we have already made :)
/Jan
Hi Jan,
Yes, my rootnodes are named after my language settings:
en-Us (hostname: localhost/en-us)
he-IL (hostname: localhost/he-il)
I think this helper method for determining the culture of the rootnode would be a very good idea, as it would make it unnessery to query for it in Razor or Xslt.
greetings,
Anthony
is working on a reply...