how to change the webpar container title localized?

sarathlal s asked on April 29, 2014 04:06

How can i change Webpart conatiner tile according to language selection?

Eg: In eglish my title hould be- restaurants and in czech it should be - restaurace.

Please help. How can i solve this?

If any other method is available please help

Correct Answer

Alexander Kontsevoy answered on April 29, 2014 15:28

Hi Sarathlal. I don't sure, but if I understood you correct you asked about webpart localization. If Am I right, you must do next steps: 1. Go to "Site Manager - Development - UI Cultures - All Cultures"; 2. Press "Pencil" icon on any culture that not assigned by default; 3. Press "New string" button at the next step 4. If you did all correct before you can see fields with names: "Key", "Text" for every culture and "default text" for culture assigned by default; 5. Fill all of this fields; 6. Copy "Key" data before save; 7. Press Save; 8. Got to "CMS Desk - Content - Design" and open webpart, that you like to localize; 9. In "web part title" field past copied in step 6 "key" field data between {$$}. For example, if your key has name RestarauntKey, you must enter {$RestarauntKey$} 10. Press "ok".

Now, if you try to switch between cultures in Kentico CMS, web part must to switch title according selected culture. This method works in Kentico 6 and Kentico 7. I tested it while write this short help. I didn't tested it on Kentico 8. But, it should works I hope.

If you want localize Web part container title (not web part title), you must do next: 1. Go to "Site Manager - Development - Web part containers"; 2. Press "new container" button; 3. from the right side of "Display name" field press icon with "Localize" pop-up help 4. In the pop-up window enter appropriate data into appropriate fields; 5. Press "ok" and "Save" them Honestly, I didn't test this method. But this must works. This's about Kentico 6 and Kentico 7.

Best regards Alexander

0 votesVote for this answer Unmark Correct answer

Recent Answers


Brenden Kehren answered on April 29, 2014 08:23 (last edited on April 29, 2014 08:23)

You'd have to go to the webpart you want to have the title localized and on the System properties tab, select the ContainerTitle property and change the control from a Textbox to a Localizable text box.

0 votesVote for this answer Mark as a Correct answer

Yehuda Lando answered on April 29, 2014 15:20

I never tried it, but try {% GetResourceString("ResourceStringKey") %}

0 votesVote for this answer Mark as a Correct answer

Alexander Kontsevoy answered on April 29, 2014 15:49 (last edited on December 10, 2019 02:30)

Short P. S. about K# in web part title localization. Next code works perfect in Kentico 6. I don't have multilang projects on K-7 and K-8 now. So, you must test it

In the web part "title" field press little triangle and in new window past this code

{% if (CurrentCulture == "en-US") {"Header in English"} else {"Header in French"}|(identity)GlobalAdministrator%}

Alexander

0 votesVote for this answer Mark as a Correct answer

Brenden Kehren answered on April 29, 2014 16:30

By default the web part container TITLE is NOT localized. You have to change the field as I mentioned to get full functionality out of it.

This "If you want localize Web part container title (not web part title), you must do next: 1. Go to "Site Manager - Development - Web part containers"; 2. Press "new container" button; 3. from the right side of "Display name" field press icon with "Localize" pop-up help" will only localize the NAME of the web part container and has nothing to do with the actual TITLE of the container.

One workaround would be to replace the {%ContainerTitle%} macro with your resource string macro {$LocalizedResourceString$}. The bad part is you have to enter the keys in the Localization module by an administrative person. With the option I mentioned, these keys will be added "automatically" by the content editor.

1 votesVote for this answer Mark as a Correct answer

sarathlal s answered on May 1, 2014 23:10

Hi,

Thank you Alexander Kontsevoy, i tried the same and i got it. I followed the same step and now i got it. Thank you very much for your response Brenden Kehren.

0 votesVote for this answer Mark as a Correct answer

sarathlal s answered on May 2, 2014 01:05

Hi,

Now how can i localize strings in Master page? I have a master page with Footer elements hard coded in it. How can i localize it. I tried {$Footer-Contact$} but it shows the same "{$Footer-Contact$}" in my footer.

And i use <%# ResHelper.GetString("Footer-Contact")%>.But it is not showing anything. Please guide me

0 votesVote for this answer Mark as a Correct answer

Alexander Kontsevoy answered on May 3, 2014 13:13 (last edited on December 10, 2019 02:30)

Hi Sarathlal. No problem. You're welcome.

Is it possible to change all hard coded strings with web parts? If this possible, you can use Static Text webpart and you can use code like this for string management

{% if (CurrentCulture == "en-US") {"Header in English"} else {"Header in French"}|(identity)GlobalAdministrator%}

Best regards Alexander

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.