Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
I have made a translation for Danish, which also changes the settings in backend when I change the language for the user in backend.
When the user e.g. use Danish and I publish the site, the weekdays in frontend are shown in Danish, but if the user in backend use English and publish the site the weekdays are changing to English.
How do I keep the weekdays in frontend in Danish or relative to the website languag no matter which language the user in backend use?
The local weekday in the XML data is a quick way to retrieve the local weekday, but its indeed limited to back-end users using the same language as front-end users.
In your case, it's not possible to pass a value from the back-end as you will always need to localize the week day by looking at the front-end users active language. It should be pretty straightforward to do so if you have .NET skills (using the DateTime object to retrieve the localization).
I will also look into soon and might be able to provide a helper Razor/XSLT method, which will ease the localization.
Btw, would you mind sending me the translation for Danish, I'll try to include it by default within next release, thanks!
lennart at thesedays dot com :-)
Yea, I could of course use Danish in backend, but it won't be the optimal way, if the site is multilingual or the backend users use different languages.I have wondered if you could use an array or something to keep the name of the weekdays in the right language instead of <xsl:value-of select="current()/weekDayLocal" />, but it's probably better to edit the .NET code.
I don't know if you can retrieve the created languages in Umbraco or how to match the translation of the opening hours and the frontend language in the best way. I have worked with .NET a few years and Umbraco about a year.
In the XSLT I have changed the currentPage to $currentPage/ancestor-or-self::root/descendant-or-self::MainMaster so the opening hours are shown on sub pages too. Else it just shows the opening hours on my masterpage, where I have placed the macro. MainMaster is the document type which have the opening hours property.
I have used the package on the page: http://d22575662.u330.surftown.dk in the right column.
Yea of course, I will send a mail with the Danish translation :)
The new version of the package (126.96.36.199) no longer saves the weekDayLocal to XML, but instead provides a helper XSLT/Razor method for localizing:
<xsl:value-of select="openingHours:LocalizeWeekday(current()/weekDay)" />
Samples are included in the package, hope this helps :-)
Thanks :) it works great..
Would it works too if you sometime in the future create a english version of the site? http://d22575662.u330.surftown.dk
Will it then get the weekday names in Danish on the Danish version and the weekday names in English on the English version of the site?
Yup, that's how it works.
If you set up a multilingual website in Umbraco and configure a language, that language will be used for localization.
If no language is configured the localization is done based on the user's language settings.
Okay cool :)
Right now I don't have set up a multilingual site and it use Danish in frontend whether I use Danish or English in backend. It's also just fine.What if it was a site in only English? Do I have to manage the hostnames then and set up the English language?
"If no language is configured the localization is done based on the user's language settings" ... do you mean the frontend users language, the browser language or how has it defined Danish as my language as default?
Yes, since you haven't configured a language, it is using the frontend users language.
If you configure English in manage hostnames, it will indeed use English for localization.
Okay, so if users from different contries visit the site, they will probably not have Danish as language?
To always have Danish I must set Danish under manage hostnames?So the language is set like e.g. the "Facebook like button" ? where it dynamic use the users language unless you have configured a static language.
On this site http://fonnesberg.com I have defined the AddThis button to use Danish on the Danish site version and English on the English site version.
Yes, if you always want Danish to appear, you will have to configure Danish under manage hostnames.
Okay thanks.. it was what I was looking for..
I think some people in Denmark might use Windows and the have installed their browser both in English.So it will be nice to always to appear the opening hours in Danish, when the rest of the text on the site is in Danish.
is working on a reply...
Write your reply to:
Image will be uploaded when post is submitted