How to use Classification stores with admin translations in Pimcore
What you'll learn with this guide
You’ll learn how to implement and use classification stores in conjunction with admin translations. We will use keys for classification store group collections, groups, and key definitions titles and descriptions to later translate within admin translations.
Where to use
The most common use case would be with a multi-language application that requires you to declassify classification store information in different languages.
E.g. you have a classification store key definition that's named EF00001. For the English-speaking user, you would need to show a name for that specific key definition “Nominal current”.
But for example a German-speaking user you would need to show “Nennstrom” instead of the actual code/name of the key definition so that a user can understand what the value actually represents, and that’s where admin translations come in.
Let’s start by navigating to classification stores and creating a new store.
To create a new store simply click on the button at the top left called “Add”. I will call mine “Test” but you can of course call yours depending on your needs. Now you should have something like this.
Same as adding the initial store we have an "Add" button under each store type (Group Collections, Groups, and Key Definitions). We will create one of each.
The most important part is the naming system. For example, if we have a group collection with the name EG00001, we will set the description of the group collection as STORE_EG00001_DESC (use STORE_ prefix if we need to later on export or search translations that are connected to stores exclusively, and _DESC suffix so we know what the translation is referring to).
Key definitions have titles as well, so if we have one named EF00001 - its title would be STORE_EF00001_TITLE and the description would be STORE_EF00001_DESC. Let’s start with adding them!
Don’t forget to add relations for group collections and groups so that when you add a classification store on an object it gets all the groups/key definitions that are connected to them!
A very important note is that classification store translation keys will not be visible by default within the admin translations after only adding the stores. Here you have two options:
- Create a class and add data component > structured > classification store
- Go to admin translations and add the keys manually
In the first option, when you add a classification store field and create a new object, the classification stores that you add will automatically be added in admin translations where you can add the translations.
After you’ve added the new group collection to your object, the translation keys should be visible within your admin translations.
Here you can give them the needed translations for your languages.
Does it work?
To test out your classification store admin translations, just go to any object you’ve made or opened (object reload is needed).
Quick and final tip, to change the translation language which you see within the administration, just go to your user profile within the Pimcore admin panel in the bottom left corner right above the logout button. Go to language, pick your preferred language and save!