Problem/Motivation

The existing vocabulary translation is ignored for page titles at "entity.taxonomy_vocabulary.overview_form" and "entity.taxonomy_vocabulary.reset_form" routes.

Steps to reproduce:

  1. Drupal 8.6.10/8.7.x fresh install with standard profile
  2. Enable the locale, config_translation and language modules.
  3. As admin user, add any language at /admin/config/regional/language, for instance, Spanish
  4. Add a translation for the just added language to the Tags taxonomy vocabulary at /admin/structure/taxonomy/manage/tags/translate
  5. Go to the Tags vocabulary overview in the new language at /***LANGUAGE_PREFIX***/admin/structure/taxonomy/manage/tags/overview. The page title will show the vocabulary name in english, ignoring the existing translation for the current language

Proposed resolution

Enable the "with_config_overrides" option for the "taxonomy_vocabulary" parameter.

Remaining tasks

Review patch.

User interface changes

None

API changes

None

Data model changes

None

Release notes snippet

None

Issue fork drupal-3037157

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

manuel.adan created an issue. See original summary.

manuel.adan’s picture

manuel.adan’s picture

Issue summary: View changes
manuel.adan’s picture

Issue summary: View changes

Version: 8.7.x-dev » 8.8.x-dev

Drupal 8.7.0-alpha1 will be released the week of March 11, 2019, which means new developments and disruptive changes should now be targeted against the 8.8.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Anas_maw’s picture

I can confirm patch in #2 works for me.

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.0-alpha1 will be released the week of October 14th, 2019, which means new developments and disruptive changes should now be targeted against the 8.9.x-dev branch. (Any changes to 8.9.x will also be committed to 9.0.x in preparation for Drupal 9’s release, but some changes like significant feature additions will be deferred to 9.1.x.). For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.9.x-dev » 9.1.x-dev

Drupal 8.9.0-beta1 was released on March 20, 2020. 8.9.x is the final, long-term support (LTS) minor release of Drupal 8, which means new developments and disruptive changes should now be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

tanubansal’s picture

After adding patch #2, its showing translated page title on /fr/admin/structure/taxonomy/manage/tags/overview
RTBC +1

mayurjadhav’s picture

Able tp apply patch on 9.1.x and patch works as expected. +1 for RTBC.

Version: 9.1.x-dev » 9.2.x-dev

Drupal 9.1.0-alpha1 will be released the week of October 19, 2020, which means new developments and disruptive changes should now be targeted for the 9.2.x-dev branch. For more information see the Drupal 9 minor version schedule and the Allowed changes during the Drupal 9 release cycle.

Abhijith S’s picture

FileSize
53.62 KB
48.07 KB

Applied patch #2 and it works fine.The translated vocabulary name is showing after applying this patch.

Before patch;
before

After patch:
after

Abhijith S’s picture

Status: Needs review » Reviewed & tested by the community
larowlan’s picture

Status: Reviewed & tested by the community » Needs work
Issue tags: +Bug Smash Initiative, +Needs tests

As this is a bug, we need a test demonstrating that this is resolved.

Also, I don't believe this is the correct fix.

The issue here is that \Drupal\taxonomy\Controller\TaxonomyController::vocabularyTitle is not loading the correct entity context in the same way that \Drupal\Core\Entity\Controller\EntityController::title is.

I wonder if we should just use \Drupal\Core\Entity\Controller\EntityController::title instead and deprecate \Drupal\taxonomy\Controller\TaxonomyController::vocabularyTitle instead of duplicating all that code.

sudiptadas19 made their first commit to this issue’s fork.

sudiptadas19’s picture

Status: Needs work » Needs review

Fix translation issues, added test file. Available in MR395. Please review.

siddhant.bhosale’s picture

Assigned: Unassigned » siddhant.bhosale
SpadXIII’s picture

Status: Needs review » Reviewed & tested by the community

This looks like it's fixed with merge request 395.
The added test looks straightforward enough.

catch’s picture

Status: Reviewed & tested by the community » Needs work
Issue tags: -Needs tests

MR is showing 'custom commands failed'. Removing 'needs tests' tag since tests have been added.

mohit_aghera made their first commit to this issue’s fork.

mohit_aghera’s picture

Assigned: siddhant.bhosale » Unassigned
Status: Needs work » Needs review

Resolving phpcs issues for the further progress of the issue.

Version: 9.2.x-dev » 9.3.x-dev

Drupal 9.2.0-alpha1 will be released the week of May 3, 2021, which means new developments and disruptive changes should now be targeted for the 9.3.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Rinku Jacob 13’s picture

FileSize
55.44 KB
56.42 KB

Verified and tested patch #2 for drupal 9.3.x-dev version. Patch applied successfully and looks good to me.Adding screenshot for the reference.
Need +1 RTBC

joachim’s picture

Status: Needs review » Needs work

Tests are failing; also see my comment on the MR.

mohit_aghera’s picture

Status: Needs work » Needs review

@joachim
Updated following points:
- Remove vocabularyTitle() method.
- Fix test cases. Test cases are passing on local now.
- Remove deprecated method calls.

joachim’s picture

Status: Needs review » Reviewed & tested by the community

Great, thanks!

xjm’s picture

Saving issue credits.

Removing credit for unneeded screenshots in #24. There were already screenshots on the issue demonstrating the fix, so a second set isn't needed. What was needed at that point was fixing phpcs errors, and reviewing the latest code changes since the previous approach. Thanks! (I've left credit for #12 as #9 did not include a "before" screenshot for comparison.)

xjm’s picture

xjm’s picture

xjm’s picture

Status: Reviewed & tested by the community » Needs work

NW for the above small points of feedback on the MR.

It would be good to also post a test-only patch or separate MR to demonstrate the test coverage of the added test.

Thanks everyone for working on this bug!

phenaproxima made their first commit to this issue’s fork.

phenaproxima’s picture

Status: Needs work » Needs review

OK, addressed all of @xjm's points as best I could. Back to review!

tim.plunkett’s picture

Status: Needs review » Reviewed & tested by the community

Thanks! I think that is sufficient.

xjm’s picture

Attaching a test-only patch as per #31.

phenaproxima’s picture

At @xjm's request, opened #3221140: Don't call mb_strtolower() when generating machine names in Taxonomy tests to deal with the (seemingly unnecessary) mb_strtolower() calls strewn across Taxonomy's test suite.

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 35: taxonomy-3037157-35-FAIL.patch, failed testing. View results

phenaproxima’s picture

Status: Needs work » Reviewed & tested by the community

Fail patch failed. Back to RTBC.

xjm’s picture

+++ b/core/modules/taxonomy/tests/src/Functional/VocabularyTranslationTest.php
@@ -55,4 +70,50 @@ public function testVocabularyLanguage() {
+    // Assert that the name label is displayed on the translation form with the right value.
...
+    // Assert that the right name label is displayed on the taxonomy term overview page. The
+    // translations are created in this test; therefore, the assertions do not
+    // use t(). If t() were used then the correct langcodes would need to be
+    // provided.
...
+    // Assert that the right name label is displayed on the taxonomy reset page. The
+    // translations are created in this test; therefore, the assertions do not
+    // use t(). If t() were used then the correct langcodes would need to be
+    // provided.

Ahoy, this is what happens when we use GitLab's UI and don't have the 80-character line anymore. These comments need to be rewrapped.

xjm’s picture

Status: Reviewed & tested by the community » Needs work
phenaproxima’s picture

Status: Needs work » Reviewed & tested by the community

Done. Since it's literally just whitespace changes, restoring RTBC.

  • xjm committed cfca6ce on 9.3.x
    Issue #3037157 by phenaproxima, sudiptadas19, mohit_aghera, xjm, manuel....
xjm’s picture

Status: Reviewed & tested by the community » Fixed

There was another 80-char thing which I thought we had a rule for, which is the array multiline format. Multivalue arrays are supposed to be put on multiple lines if the line is over 80:

diff --git a/core/modules/taxonomy/tests/src/Functional/VocabularyTranslationTest.php b/core/modules/taxonomy/tests/src/Functional/VocabularyTranslationTest.php
index f36bd973c7..ac321c34cb 100644
--- a/core/modules/taxonomy/tests/src/Functional/VocabularyTranslationTest.php
+++ b/core/modules/taxonomy/tests/src/Functional/VocabularyTranslationTest.php
@@ -14,7 +14,11 @@ class VocabularyTranslationTest extends TaxonomyTestBase {
   /**
    * {@inheritdoc}
    */
-  protected static $modules = ['content_translation', 'language', 'config_translation'];
+  protected static $modules = [
+    'content_translation',
+    'language',
+    'config_translation',
+  ];
 
   /**
    * {@inheritdoc}

That was straightforward enough to fix on commit. Committed to 9.3.x only since it introduces a deprecation for an internal API. Thanks!

  • xjm committed dbcc1a3 on 9.3.x
    Issue #3037157 followup by xjm: Fix multi-line array format.
    

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

smustgrave credited akoe.

smustgrave credited yo30.

smustgrave’s picture

Closed https://www.drupal.org/project/drupal/issues/2924408 as a duplicate of this. Moved over credit.