GetResourceString in web part container

John Smith asked on December 5, 2017 17:52


I am trying to use localization as a test in a web part container but for some reason the current culture code is always en-US even though i'm on the bg-BG culture. I have the bg-BG set in the URL of the request as prefix instead of lang query string parameter. When I use a variation of this in a web part for example the culture code is updated correctly to bg-BG but not in this web part container. Does anyone know what I am missing here? Thank you in advance!

{%GetResourceString("Location", CMSContext.Current.LocalizationContext.CurrentCulture.CultureCode)%}

Recent Answers

Mariia Hrytsai answered on December 6, 2017 10:12

You can try to use localization macro {$Location$}. Please make sure that you use correct key for your resource string.

1 votesVote for this answer Mark as a Correct answer

Brenden Kehren answered on December 6, 2017 15:06 (last edited on March 24, 2018 12:16)

If you are trying to localize the property values within the UI, you need to do something else. The UI will use the language the UI is set at and not the language the site is selected to use. Meaning you'd have to change the Kentico UI to bg-BG in order for the dropdown to use the correct value. To get by this you can use this macro:

{% GetResourceString("your.custom.key", QueryString.culture) %}

The LocalizationContext object is only available on the live site and not in the UI.

2 votesVote for this answer Mark as a Correct answer

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