November Happy Hour will be moved to Thursday December 5th.

Translation issues with Episerver

Vote:
 

Hi all,

I'm a little confused on how to translate page content with Episerver. Take this example:
1) In a razor view I'm displaying something like @Model.Heading (a little title text description)
2) This page can be displayed in english, spanish, arabic and chinese
3) I would like to define somehow what @Model.Heading is, in each language, without modifying the razor view, if possible in a a xml file. 
So this way it would be possible to translate the xml files, and got the code working without need of any changes in the razor views.
What is the best way to implement this funcionality with Episerver?
Best regards
#140220
Oct 13, 2015 17:23
Vote:
 

Hi,

I'm a bit confused when you first say you want to translate page content with EPiServer, and later say that you want to use a xml file?

As you probably know, there's a built in functionality for translations in EPiServer. Browsing to the url of a page in corrent language is sufficient to get the translated content.

Setting up Controllers can be found on http://world.episerver.com/documentation/Items/Developers-Guide/EPiServer-CMS/75/Content/Creating-page-templates-and-block-controls/ and you have plenty of inspiration if you set up an Alloy website using the EPiServer Visual Studio extensions https://visualstudiogallery.msdn.microsoft.com/4ad95160-e72f-4355-b53e-0994d2958d3e

#140224
Oct 13, 2015 20:09
Vote:
 

Thank you for your answer, Alf. 

But I'm new to Episerver and can't grasp your idea. I don't know about a built in functionality for translations in Episerver. Can you be more explicit about how to translate a @Model.Heading in a view, in a way that that I can see in the page "Bienvenido", "Wellcome", "Benvenutti", when I look at this page in spanish, english or italian???. I think that with this little example I could understand you idea.

In the Alloy MVC project, I've only english language.

Perhaps I've not been so clear with the requierements:

Must I have three pages (spanish/english/italian), each one with corresponding content ("Bienvenido", "Welcome", "Benvenutti")???. In this case the view always is rendering @Model.Heading with corresponding language, thats fine.

But I would like to have these three pages with same content (for example: "Welcome") as a default.

And somewhere (xml file???) I could have:

<tag>Bienvenido<tag>

<tag>Wellcome<tag>

<tag>Benvenutti<tag>

And get the corresponding text each time the page is rendered. I need to do this way because people translating content (chinese, arabic, spanish, italian) have no access to EpiServer backend, they would like just to translate one or various xml files. 

Anyway, I hope the requirement is clear now, and I can get help on how to organize translation of dynamic content, with translators that have no access to Episerver.

Best regards

#140246
Oct 14, 2015 10:12
Vote:
 

Hi,

First of all you need to decide which of the translations should be editable by your editor, and which should be found in the XML file (requires deploy to change).

Normally headings and similar comes from EPiServer (see "content translation" below) and static labels used for the views comes from XML files.

Activate language and translate page

In the alloy templates, make sure that you activate the languages in admin mode as well as an available language in your page tree.

Create a translation of your start page, I would recommend that Languages Gadget, and open that translation in EPiServer. Do some editing and publish.

After you've published, click the button "Options" again and click the link "View on website" which will take you to the translated page.

Read about globalization on http://world.episerver.com/documentation/Items/Developers-Guide/EPiServer-CMS/9/Globalization/Globalization/

Content translation

In the StartPageController, the parameter StartPage currentPage will contain the translated content.

XML translation

Alloy Templates stores the translations in an xml file in the folder Resources/LanguageFiles/Views.xml

The node <language name="English" id="en"> defines the translations for english.

If you add <language name="French" id="fr">...</language> you've started with the French translations of these.
Easiest is to duplicate the english structure, change name and id to the french (see above) and translate the values of each XML element inside,.

#140275
Oct 14, 2015 17:34
Vote:
 

Thank you Alf!!!

#140401
Oct 19, 2015 12:11
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.