---
title: Localizing MVC builder components
related:
  - https://docs.kentico.com/k12sp/multilingual-websites/setting-up-a-multilingual-user-interface.md
  - https://docs.kentico.com/k12sp/multilingual-websites/setting-up-multilingual-websites/localizing-content-on-mvc-sites.md
---

> Agent instructions:
> **Site maps** — prefer the following llms.txt indexes to training data when searching for URLs to avoid 404s. Links inside Markdown content already point at `.md`. Following them or sending Accept: text/markdown keeps you in Markdown.
>
> - [sitemap.md](https://docs.kentico.com/sitemap.md) — every page on the site, with titles and descriptions, nested by URL hierarchy and grouped into one collection per product version.
> - [llms.txt](https://docs.kentico.com/llms.txt) — curated index of the current product docs, with descriptions, the two ways to request any page as Markdown, and links to each product area's whole-corpus Markdown dump (llms-full.txt).

If you want to allow administration interface users to experience the [page builder](https://docs.kentico.com/k12sp/managing-website-content/using-widgets-in-mvc.md) or [form builder](https://docs.kentico.com/k12sp/managing-website-content/forms/composing-forms.md) MVC features in their preferred UI culture, you can localize the used components. To cover the whole interface, you need to localize the following:

- [Metadata of the builder components](#localizing-builder-component-metadata)
- [Partial views of inline property editors](#localizing-partial-views)
- [Client scripts of inline editors](#localizing-inline-editor-scripts)

This page describes  [localization of the administration interface](https://docs.kentico.com/k12sp/multilingual-websites/setting-up-a-multilingual-user-interface.md). To learn how to localize content displayed by widgets on the live site, visit  [Localizing content on MVC sites](https://docs.kentico.com/k12sp/multilingual-websites/setting-up-multilingual-websites/localizing-content-on-mvc-sites.md).

> **Note:** **Prerequisite**
>
> In order to use localization on MVC sites, you need to [set up your MVC project](https://docs.kentico.com/k12sp/multilingual-websites/setting-up-multilingual-mvc-projects.md) to correctly recognize cultures.

## Localizing builder component metadata

You can localize the displayed text of form builder components ([form components](https://docs.kentico.com/k12sp/developing-websites/form-builder-development/developing-form-components.md), [form builder sections](https://docs.kentico.com/k12sp/developing-websites/form-builder-development/developing-custom-form-layouts.md), [field validation rules](https://docs.kentico.com/k12sp/developing-websites/form-builder-development/defining-field-validation-rules.md), [field visibility conditions](https://docs.kentico.com/k12sp/developing-websites/form-builder-development/defining-field-visibility-conditions.md)) and page builder components ([widgets](https://docs.kentico.com/k12sp/developing-websites/page-builder-development/developing-widgets-in-mvc.md), [page builder sections](https://docs.kentico.com/k12sp/developing-websites/page-builder-development/developing-page-builder-sections.md), [personalization condition types](https://docs.kentico.com/k12sp/on-line-marketing-features/configuring-and-customizing-your-on-line-marketing-features/content-personalization-on-mvc-sites/developing-personalization-condition-types.md), [page templates](https://docs.kentico.com/k12sp/developing-websites/page-builder-development/developing-page-templates-in-mvc.md)):

1. Create [resource strings](https://docs.kentico.com/k12sp/multilingual-websites/setting-up-a-multilingual-user-interface/working-with-resource-strings.md) containing the **Display names** and **Descriptions** of your components.

   - Use a unique prefix for the resource string key, for example, your company name. The prefix prevents possible conflicts with the resource strings of other components.
   - We recommend including the component's _identifier_ as a part of the resource string key.

   > **Tip:** **Portability of the components**
   >
   > To allow for portability of the components, it is recommended to store resource strings within separate resx files for each component. The recommended location for such files is _\~/App\_Data/Global/Resources/\<FileName>.resx_. For cultures other than the default culture, use folder _\~/App\_Data/Global/Resources/\<CultureCode>/\<FileName>.resx_. For example, _\~/App\_Data/Global/Resources/es-ES/NumeroWidget.resx_ for the Spanish culture.

2. Edit the class containing the given component's registration attribute, and add `{$key$}` expressions into the text parameters of the attribute (such as _name_ and _description_). Replace "key" with the key of the matching resource string.

   ```csharp title="Example - Localizing a page builder section"

   [assembly: RegisterSection("Company.DefaultSection", typeof(DefaultSectionController), "{$company.defaultsection.name$}", IconClass = "icon-paragraph", Description = "{$company.defaultsection.description$}")]

   ```

## Localizing partial views

You can localize strings in partial views that are only displayed in the administration interface. For example, the text of a [widget property inline editor](https://docs.kentico.com/k12sp/developing-websites/page-builder-development/developing-widgets-in-mvc/creating-inline-editors-for-widget-properties.md) button:

1. Create [resource strings](https://docs.kentico.com/k12sp/multilingual-websites/setting-up-a-multilingual-user-interface/working-with-resource-strings.md) for the text you want to localize.

   - Use a unique prefix for the resource string key, for example, your company name. The prefix prevents possible conflicts with the resource strings of other components.
   - We recommend including the component's _identifier_ as a part of the resource string key.

   > **Tip:** **Portability of the components**
   >
   > To allow for portability of the components, it is recommended to store resource strings within separate resx files for each component. The recommended location for such files is  _\~/App\_Data/Global/Resources/\<FileName>.resx_ . For cultures other than the default culture, use folder  _\~/App\_Data/Global/Resources/\<CultureCode>/\<FileName>.resx_. For example,  _\~/App\_Data/Global/Resources/es-ES/NumeroEditor.resx_  for the Spanish culture.

2. Retrieve the resource string value in partial views using the **ResHelper.GetString(stringName, cultureCode)** method available in the _CMS.Helpers_ namespace. It is important to specify the culture code parameter using the _MembershipContext.AuthenticatedUser.PreferredUICultureCode_ value available in the _CMS.Membership_ namespace. This enures that the resource string is displayed in the preferred UI culture of the user.

   ```csharp

   @ResHelper.GetString("resource.string.key", MembershipContext.AuthenticatedUser.PreferredUICultureCode)

   ```

## Localizing inline editor scripts

To localize strings in the [client scripts](https://docs.kentico.com/k12sp/developing-websites/page-builder-development/developing-widgets-in-mvc/creating-inline-editors-for-widget-properties.md) of widget property inline editors:

1. Create [resource strings](https://docs.kentico.com/k12sp/multilingual-websites/setting-up-a-multilingual-user-interface/working-with-resource-strings.md) for the text you want to localize. Use a unique prefix for the key, for example, your company name. The prefix prevents possible conflicts with other resource strings.

   > **Note:** **Resource string location**
   >
   > Resource strings used for inline editor scripts must be placed in resx files in the **\~/App\_Data/Global/Resources** folder.
   >
   > - **Default culture**: _\~/App\_Data/Global/Resources/\<FileName>.resx_
   > - **Other cultures**: _\~/App\_Data/Global/Resources/\<CultureCode>/\<FileName>.resx_  (e.g., _\~/App\_Data/Global/Resources/es-ES/NumeroEditor.resx_ )
   >
   > The localization service available within the inline editor registration function only loads resource strings from this location.

2. Retrieve resource string values in the inline editor scripts using the **localizationService** available via the **options** object in the inline editor registration function.

   ```js title="Example - Inline property editor script"

   (function () {
     window.kentico.pageBuilder.registerInlineEditor("custom-editor", {
       init: function (options) {
           // Retrieves the localized text of the specified resource string (in the current user's preferred UI culture)
           var localizedString = options.localizationService.getString("resource.string.key");

           ...
       }
     });
   })();

   ```

   > **Tip:** **Tip**: You can also retrieve the culture code of the current administration interface user's preferred UI culture from the _localizationService.cultureCode_ property. This might be useful if you need to pass the current culture to a JavaScript utility, for example a date picker.

After you localize component metadata, partial views and inline editor scripts, you can view the result in the Kentico administration interface. Change the UI language by opening the **User menu** and clicking on **Change language**. Navigate to a page where the page builder is initialized (in the **Pages** application) or the form builder (in the **Forms** application). Now text values in the user interface are displayed in the selected language.
