RM.Localization and new List and Blog ?

Topics: Localization, Writing modules
May 5, 2014 at 7:30 PM
Edited May 5, 2014 at 7:36 PM
Orchard 1.81

try to use RM.Localization ...
all content types (pages , menus, projections etc) are working fine except new list and blogs.

Question to Sipke : what is difference between new and old lists and blogs in terms of localization ?

and please don't forget about this list issue


https://orchard.codeplex.com/workitem/20448
Jun 9, 2014 at 7:46 PM
Ok, Sipke is tooo busy...

The answer is simple with one word.
And the word is "Aliases" :)

Question to Jetski :

Could you replase GetCurrentContentItem() in ...\Services\CultureService.cs in your RM module in order to localize List and Blog.
The code is not optimize (I am not c-guy:) but is working
        public IContent GetCurrentContentItem()
        {
            var values = _orchardServices.WorkContext.HttpContext.Request.RequestContext.RouteData.Values;

            object v = values.TryGetValue("area", out v) && string.Equals("Contents", v as string, StringComparison.OrdinalIgnoreCase) ? v : null;

            if (v== null)
                v = values.TryGetValue("area", out v) && string.Equals("Containers", v as string, StringComparison.OrdinalIgnoreCase) ? v : null;


            v = v != null && values.TryGetValue("controller", out v) && string.Equals("Item", v as string, StringComparison.OrdinalIgnoreCase) ? v : null;
            v = v != null && values.TryGetValue("action", out v) && string.Equals("Display", v as string, StringComparison.OrdinalIgnoreCase) ? v : null;
            int id = v != null && values.TryGetValue("id", out v) && int.TryParse(v as string, out id) ? id : 0;


            if (v == null)
            {
                v = values.TryGetValue("area", out v) && string.Equals("Orchard.Blogs", v as string, StringComparison.OrdinalIgnoreCase) ? v : null;
                v = v != null && values.TryGetValue("controller", out v) && string.Equals("Blog", v as string, StringComparison.OrdinalIgnoreCase) ? v : null;
                v = v != null && values.TryGetValue("action", out v) && string.Equals("Item", v as string, StringComparison.OrdinalIgnoreCase) ? v : null;
                id = v != null && values.TryGetValue("blogId", out v) && int.TryParse(v as string, out id) ? id : 0;

            }



            //int id = v != null && values.TryGetValue("id", out v) && int.TryParse(v as string, out id) ? id : 0;
            if (id > 0) return _orchardServices.ContentManager.Get(id);
            return null;
        }