Translation

Mar 10, 2015 at 5:02 PM
Hello,
is it possible to replace a string property with a custom class property for translation?

I tried to create a new class like this
namespace MrCMS.Entities
{
    public class Translation : SiteEntity
    {
        protected Translation()
        {
            
        }
        [AllowHtml]
        public virtual string Value_IT { get; set; }
        [AllowHtml]
        public virtual string Value_EN { get; set; }
        [AllowHtml]
        public virtual string Value_FR { get; set; }
        [AllowHtml]
        public virtual string Value_DE { get; set; }

        public virtual string Value(string Language)
        {
            switch (Language.ToLower())
            {
                case "en":
                    return Value_EN;
                case "fr":
                    return Value_FR;
                case "de":
                    return Value_DE;
                default:
                    return Value_IT;
            }
        }
    }
}
and then I replaced, for example, the string property "Name" in Document.cs with my custom one:
public virtual Translation Name { get; set; }
Could it be a possible and correct choice?

I just would like to know if i'm on the right way.

thank you very much,
Andrea
Coordinator
Mar 13, 2015 at 11:54 AM
Proper multilingual integration is something we plan to do in the not to distant future.

In the mean time, we recommend using the multi-site feature of Mr CMS do do this. E.G you could set up:

fr.mydomain.com
de.mydomain.com

etc

And then on each of these just add pages in the specific language.

For development perposes there is a property in web.config appSettings called debugSiteId:

<add key="debugSiteId" value="1" />

You can use this to change between sites to set each one up.

You can also use the clone site functionality. Get your first site set up as you like it, clone it and then translate it.
Mar 13, 2015 at 11:56 AM
ok,
thank you very much.

Andrea