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

    Details

    • Type: Story Story
    • Status: Closed
    • Priority: High 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')
      

        Activity

        Show
        André Rømcke added a comment - WIP PR: https://github.com/ezsystems/ezpublish-kernel/pull/2002
        Hide
        André Rømcke added a comment -

        Moving to doc.

        QA: From UI or REST perspective you should not expect any changes with this. This is purely about API usage.

        Show
        André Rømcke added a comment - Moving to doc. QA: From UI or REST perspective you should not expect any changes with this. This is purely about API usage.
        Show
        André Rømcke added a comment - Doc, proposed updates on the following pages: https://doc.ez.no/display/DEVELOPER/Internationalization https://doc.ez.no/display/DEVELOPER/ez_content_name https://doc.ez.no/display/DEVELOPER/ez_field https://doc.ez.no/display/DEVELOPER/ez_field_value https://doc.ez.no/display/DEVELOPER/ez_trans_prop https://doc.ez.no/display/DEVELOPER/Content+Rendering https://doc.ez.no/display/DEVELOPER/Browsing%2C+finding%2C+viewing
        Hide
        Dominika Kurek added a comment -

        Doc by André proofed.

        Show
        Dominika Kurek added a comment - Doc by André proofed.
        Hide
        Rui Silva (Inactive) added a comment -

        Tested and approved, and doc validated by QA for master.
        Closing jira issue, since PR is already merged..

        Show
        Rui Silva (Inactive) added a comment - Tested and approved, and doc validated by QA for master. Closing jira issue, since PR is already merged..

          People

          • Assignee:
            Unassigned
            Reporter:
            André Rømcke
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: