More in this section

Forums / Developing with Sitefinity / News Title Localization does not work

News Title Localization does not work

3 posts, 0 answered
  1. Tobias
    Tobias avatar
    11 posts
    Registered:
    02 Mar 2009
    21 Apr 2009
    Link to this post
    Hello,

    i created a multi language news. Also i created a usercontrol to display the news title.
    Here is the code of the usercontrol.
            Telerik.News.NewsManager newsManager = new Telerik.News.NewsManager("News"); 
            IList listOfNewsItems = newsManager.Content.GetContent("Publication_Date desc"); 
     
            if (listOfNewsItems.Count > 0) 
            { 
     
                HtmlTable table = new HtmlTable(); 
                table.CellPadding = 0; 
                table.Border = 0; 
                table.CellSpacing = 0; 
     
                foreach (Telerik.Cms.Engine.IContent newsItem in listOfNewsItems) 
                { 
                    if (newsItem.Status != Telerik.Cms.Engine.ContentStatus.Published) 
                        continue
     
                    HtmlTableRow row = new HtmlTableRow(); 
                     
                    HtmlTableCell cell_Date = new HtmlTableCell(); 
                    cell_Date.NoWrap = true
                    cell_Date.VAlign = "top"
                    Label lbl_date = new Label(); 
                    lbl_date.Text = ((DateTime)newsItem.GetMetaData("Publication_Date")).ToString("dd.MM.yyyy - "); 
                    cell_Date.Controls.Add(lbl_date); 
     
                    HtmlTableCell cell_Title = new HtmlTableCell(); 
                    cell_Title.Style.Add(HtmlTextWriterStyle.PaddingLeft, "4px"); 
                    HyperLink link = new HyperLink(); 
                    link.Text = newsItem.GetMetaData("Title").ToString(); 
     
                    cell_Title.Controls.Add(link); 
     
                    // for testing! 
                    Label lbl = new Label(); 
                    lbl.Text = newsItem.Content.ToString(); 
                    cell_Title.Controls.Add(lbl); 
     
                    table.Controls.Add(row); 
                    row.Controls.Add(cell_Date); 
                    row.Controls.Add(cell_Title); 
                } 
                newsContainer.Controls.Add(table); 
            }  

    The Problem is, that the news title is always shown in the last saved language in the sitefinity backend.
    In other words: if i change the backend language to english and edit and save the content, than call the page which shows the news in my usercontrol and selected language is eg. german, the news title is shown in english.

    I have no clue what i'm doing wrong.

    Greetings
    Tobias

  2. Georgi
    Georgi avatar
    3583 posts
    Registered:
    28 Oct 2016
    21 Apr 2009
    Link to this post
    Hi Tobias,

    Could you please make sure that you have enabled the localization for the Title metafield? This is done in the web.config file:
     <add key="News.Title"  
      valueType="ShortText"  
      visible="True"  
      searchable="True"  
      sortable="True"  
      defaultValue="" 
      localizable="True" /> 

    Kind regards,
    Georgi
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  3. Tobias
    Tobias avatar
    11 posts
    Registered:
    02 Mar 2009
    21 Apr 2009
    Link to this post
    Hello Georg,

    you are right, i missed that.
    Sorry.

    Greetings Tobias
Register for webinar
3 posts, 0 answered