Hmmm VB.NET.. I thought I spoke with you about this when I was in Mauritius. :) Its pretty late so the following is off the top of my head and I'm not really a VB guy so will tackle it from a C# angle and leave it to you to convert.
In c# you do it like this to load a dictionary item given you know the culture ID of the current node that you are looking at. So the first thing you need to do is establish what the culture of the domain that you are looking at is. I cant remember what forum post I got this from but its sound. The following assumes that you only have one domain assigned to each of your language roots of the site.
This will retrieve the domains collection for the current node that you are looking at. I break out of the loop early once I find an item you could probably go about it differently if you had multiple domains assigned to a root.
var domains = umbraco.library.GetCurrentDomains(currentNode.Id); if (domains != null)
{
foreach (var d in domains)
{ //this is the languageId of the current node
langId = d.Language.id; //this is the culture code eg en-US if you need it for other localization stuff
langAlias = d.Language.CultureAlias;
break;
}
}
Once you know the language ID you can go about retrieving your key from code. The string you pass the DictionaryItem is the name of the key you created in the backoffice.
var yourTranslation = new umbraco.cms.businesslogic.Dictionary.DictionaryItem("The dictionary key string").Value(langId);
Again sorry for not having the VB equiv but I am sure you can take this and build a VB version pretty easy.
Sorry for replying only now. Manage to do it in VB itself. YES you did !!! but since we already implemented it before so why not try to make it happened and use the same usercontrol !!! :)
Dictionary Item in VB userControl
Hi everyone,
I have a userControl in VB which works perfectly until the client decided to convert the website to a multilingual website.
Anyone can explain how do i get to add dictionaryItem to my userControl, i already added the umbraco.dll reference.
//fuji
Hmmm VB.NET.. I thought I spoke with you about this when I was in Mauritius. :) Its pretty late so the following is off the top of my head and I'm not really a VB guy so will tackle it from a C# angle and leave it to you to convert.
In c# you do it like this to load a dictionary item given you know the culture ID of the current node that you are looking at. So the first thing you need to do is establish what the culture of the domain that you are looking at is. I cant remember what forum post I got this from but its sound. The following assumes that you only have one domain assigned to each of your language roots of the site.
This will retrieve the domains collection for the current node that you are looking at. I break out of the loop early once I find an item you could probably go about it differently if you had multiple domains assigned to a root.
Once you know the language ID you can go about retrieving your key from code. The string you pass the DictionaryItem is the name of the key you created in the backoffice.
Again sorry for not having the VB equiv but I am sure you can take this and build a VB version pretty easy.
Hi Pete,
Sorry for replying only now. Manage to do it in VB itself. YES you did !!! but since we already implemented it before so why not try to make it happened and use the same usercontrol !!! :)
I guess its always good to know both!!
Thanks for the reply
//Fuji
is working on a reply...