Uploaded image for project: 'eZ Publish / Platform'
  1. eZ Publish / Platform
  2. EZP-30030

As a Developer I want to use SA-aware Repository to load translated Content Type labels

    XMLWordPrintable

    Details

      Description

      Description

      So far we've solved issues with displaying proper Content Type translation in Content View/Edit modes (and other contexts) by reloading Content Type for user-preferred language.

      We believe that instead of loading it for every needed part of the system, it could be changed in a global manner for AdminUI, by the means of SiteAccess-aware Repository, by setting proper language context, as it was designed for that purpose also.

      Spec

      Some sketch of idea to solve it for ezplatform-admin-ui package:

      eZ\Publish\API\Repository\ContentTypeService: '@ezpublish.siteaccessaware.service.content_type'
      
      class UserLanguagePreferenceListener implements EventSubscriberInterface
      {
          // ...
          public function onKernelRequest(GetResponseEvent $event): void
          {
              $languages = $this->userLanguagePreferenceProvider->getPreferredLanguages();
      
              if (empty($languages)) {
                  return;
              }
      
              $this->languageResolver->setContextLanguage(
                  $languages[0]
              );
          }
      }
      

        Attachments

          Activity

            People

            Assignee:
            Unassigned
            Reporter:
            andrzej.longosz@ez.no Andrzej Longosz
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated: