Home
Search

Start | Blogs | Umbraco | Translate checkboxes

2020-02-10

Umbraco

How to translate checkboxes in a block in Umbraco V7

We have a block containing a checkbox with the name "ElementarySchool" and another one with the name "LeisureHome":

A screenshot of a block with properties.

 

We want to translate them on the page that uses the block, to Swedish. It currently looks like this:

 

The "Tags" property containing the block is named "ExampleBlockArea" and has the alias "exampleBlockArea".

The document type containing the "Tags" property is named "ExamplePage" and has the alias "examplePage".

In order to translate the checkbox properties we go to the uSync backoffice.config file.

We create a DictionaryItem for the ExamplePage called "ExamplePage", within that a DictionaryItem for the Tags property called "exampleBlockArea", within that a DictionaryItem for each of the checkboxes, called "elementarySchool" and "leisureHome" respectively. Final code will look like this:

<DictionaryItem Key="ExamplePage">
    <Value LanguageId="1520" LanguageCultureAlias="en-US"><![CDATA[This is an example page]]></Value>
    <Value LanguageId="3" LanguageCultureAlias="sv-SE"><![CDATA[Detta är en exempelsida]]></Value>
    <DictionaryItem Key="exampleBlockArea">
        <Value LanguageId="3" LanguageCultureAlias="sv-SE"><![CDATA[Taggar]]></Value>
        <DictionaryItem Key="elementarySchool">
            <Value LanguageId="3" LanguageCultureAlias="sv-SE"><![CDATA[‎‎‎‎‎‎‏‏‎‏‏‎Grundskola]]></Value>
        </DictionaryItem>
        <DictionaryItem Key="leisureHome">
            <Value LanguageId="3" LanguageCultureAlias="sv-SE"><![CDATA[‎‎‎‎‎‎‏‏‎‏‏‎Fritidshem]]></Value>
        </DictionaryItem>
    </DictionaryItem>
</DictionaryItem>


The final result of the page will look like this:

A picture of the translated checkbox properties

(I realize now that I have mixed Swedish and English in my example, my bad. Too tired to change now though).