You could replace the default language selector by your own if you download the source code from Codeplex and take a look at the existing selectors as an example. The selectors are two user controls: LanguageSelector.ascx and LanguageSelectorForWebForm.ascx (for when web forms are used) together with their corresponding codebehinds (.ascx.cs files).
Thanks for taking an interest in this package! By the way, if you develop your own version of the selector and would like to contribute it, please feel free to create a pull request on Codeplex.
If you have downloaded the source solution from Codeplex, you need just one more thing before you can rebuild it. The project references some Umbraco dlls, and the references to them will probably be broken. I do not redistribute these dlls, since I have not built them myself but you can use the ones from your Umbraco installation.
So, to do this simply, you would need to create a folder called UmbracoBinaries inside the Dimi.Polyglot project folder and copy the dlls from your Umbraco installation there. If you still get errors due to missing references, you could just re-add the references that appear to be broken (I think they will have a yellow sign over them in Visual Studio).
Once you have managed to rebuild the project's dll, you can copy it into your Umbraco installation's bin folder (I hope that you do this on a test version first:)). If you modify files other than the binary, you need to copy those in the respective Umbraco folders, over the ones initially installed by the package.
I hope that this helps! (And that I have not confused you further:))
I'm almost getting the desired result. I'm seeing this on the website : nlfren. So it means he can find the languagues. But I'm having trouble with the links.
This is the HTML code after the website is rendered:
So the javascript I copied from your code doesn't appear to work in an anchor tag. I could really use some help with this, and I hope you understand the problem!
It seems that the javascript code entered into the href does not link to the location indicated by the this.options statement. How about adapting the this.options statement, putting it in a javascript function and calling that one from the href? Or even better, how about not using javascript at all and just rendering the whole URL that each link will point to using your C# code?
I am sorry for the delay but I am away on a trip and I have limited access to the Internet. As far as the other option is conerned, I meant that you can produce links in c# pointing directly to urls, for example a href="somepage.on.the.site" instead of creating the links in javascript using a href="javascript:location etc" like you do now. Appart from resolving your current issue, this method will also make your site run properly in the event that a visitor has disabled javascript in his or her browser. This is what I do in the source code of the package too, so you can have a look at the codebehind of the language selector control If you need an example of how to do it.
Customize language selector
So instead of having a dropdownbox, I'd like it to be plain text like this :
NL | FR | EN
How can I do this ?
Hello maarten,
You could replace the default language selector by your own if you download the source code from Codeplex and take a look at the existing selectors as an example. The selectors are two user controls: LanguageSelector.ascx and LanguageSelectorForWebForm.ascx (for when web forms are used) together with their corresponding codebehinds (.ascx.cs files).
Thanks for taking an interest in this package! By the way, if you develop your own version of the selector and would like to contribute it, please feel free to create a pull request on Codeplex.
Best regards,
Dimitri
Thanks Dimitri, I'll give it a try and post the result later !
Hi Dimitri,
I've started making some adjustments to the source code, but how do I 'rebuild' the package with my adjustments?
Thank you!
Hello Maarten,
If you have downloaded the source solution from Codeplex, you need just one more thing before you can rebuild it. The project references some Umbraco dlls, and the references to them will probably be broken. I do not redistribute these dlls, since I have not built them myself but you can use the ones from your Umbraco installation.
So, to do this simply, you would need to create a folder called UmbracoBinaries inside the Dimi.Polyglot project folder and copy the dlls from your Umbraco installation there. If you still get errors due to missing references, you could just re-add the references that appear to be broken (I think they will have a yellow sign over them in Visual Studio).
Once you have managed to rebuild the project's dll, you can copy it into your Umbraco installation's bin folder (I hope that you do this on a test version first:)). If you modify files other than the binary, you need to copy those in the respective Umbraco folders, over the ones initially installed by the package.
I hope that this helps! (And that I have not confused you further:))
cheers
Dimitri
Hi Dimitri, I'm close to finding a solution but I could really use your help.
This is the code I have so far :
I'm almost getting the desired result. I'm seeing this on the website : nlfren. So it means he can find the languagues. But I'm having trouble with the links.
This is the HTML code after the website is rendered:
So the javascript I copied from your code doesn't appear to work in an anchor tag. I could really use some help with this, and I hope you understand the problem!
Thank you in advance!
Hi Maarten,
It seems that the javascript code entered into the href does not link to the location indicated by the this.options statement. How about adapting the this.options statement, putting it in a javascript function and calling that one from the href? Or even better, how about not using javascript at all and just rendering the whole URL that each link will point to using your C# code?
Best regards,
Dimitri
I don't really understand what you mean with rendering the whole link using my C# code?
I'll give the other option a try!
Hi Dimitri,
I've tried the javascript option but I can't get it to work. Could you perhaps explain the other option more?
Thanks!
Hi maarten,
I am sorry for the delay but I am away on a trip and I have limited access to the Internet. As far as the other option is conerned, I meant that you can produce links in c# pointing directly to urls, for example a href="somepage.on.the.site" instead of creating the links in javascript using a href="javascript:location etc" like you do now. Appart from resolving your current issue, this method will also make your site run properly in the event that a visitor has disabled javascript in his or her browser. This is what I do in the source code of the package too, so you can have a look at the codebehind of the language selector control If you need an example of how to do it.
Best regards,
Dimitri
is working on a reply...