November Happy Hour will be moved to Thursday December 5th.
November Happy Hour will be moved to Thursday December 5th.
Hi,
It's xpath, so I guess something like this should work:
<%= Translate("/pagetype[name=MyPage]/property[name=MyProperty]/caption") %>
Thanks Johan,
but that displays [Missing text '/pagetype[name=MyPage]/property[name=MyProperty]/caption' for 'Swedish'] even though I have entered it in swedish.
@Html.Translate("/pagetype[name=MyPage]/property[name=MyProperty]/caption")
It should be like this:
@Html.Translate("/pagetype[@name='MyPage']/property[@name='MyProperty']/caption")
Thanks Sergii,
that isn't working either though. =(
[Missing text '/pagetype[@name='MyPage']/property[@name='MyProperty']/caption' for 'Swedish']
Could it be that there needs to be something before "/pagetype..." to specify the path to the language file?
Yes, you have to specify the whole path. We could only guess the parts you posted here ;)
But that doesn't seem right? What if I have a language file for each language, I don't think I should need to check which language is currently used and then write the path to that specific file, right?
You don't need to specify the language part, "/languages/language/", but everything after that.
That wasn't what I meant.
Lets say I have two files in my languages directory, Translations_en.xml, Translations_sv.xml.
When we're talking about specifying the whole path, does that include the file name? Do I need to check which language is currently in use and specify the correct language file?
Perhaps an example would clear out any confusions? =)
When we said the path, we meant the path within the xml file. You can read about it here http://en.wikipedia.org/wiki/XPath.
But you can leave out the first two nodes, "/languages/language/", because EPi selects those automatically.
Yeah that's how I have been doing it.
I just saw that I left out a piece from the path.
@Html.Translate("/pagetype[@name='MyPage']/property[@name='MyProperty']/caption")
should be
@Html.Translate("/pagetypes/pagetype[@name='MyPage']/property[@name='MyProperty']/caption")
Lets say I have something like this in a language file,
How do I get the caption and help from the pagetype property using the LocalizationService?