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

As a developer I want to get translated API properties in the language I requested

    XMLWordPrintable

    Details

    • Type: Story
    • Status: Closed
    • Priority: High
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.10.0
    • Labels:
      None

      Description

      As a developer, if I specify which language to load from the API, when working with the returned API objects I expect these value objects to also take the language argument into account.

      Example

      Instead of this:

      $content = $this->contentService->loadContent(
          42,
          $this->configResolver->getParameter('languages')
      );
      
      
      $name = $content->getVersionInfo()->getName(
          $this->configResolver->getParameter('languages')[0]
      );
      // OR rather to take care of all languages: $this->translationHelper->getTranslatedContentName($content);
      
      $field = $this->translationHelper->getTranslatedField($content, 'body');
      $value = $field->value;
      

      I would prefer this:

      $content = $this->contentService->loadContent(
          42,
          $this->configResolver->getParameter('languages')
      );
      
      
      $name = $content->getVersionInfo()->getName();
      $value = $content->getFieldValue('body')
      

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              andre.romcke@ez.no André Rømcke
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: