Skip to content

Language pack inheritance order is incorrect #8691

Closed
@koenner01

Description

@koenner01

Direct quote from the Magento 2 documentation:
(http://devdocs.magento.com/guides/v2.0/config-guide/cli/config-cli-subcommands-i18n.html)

If necessary, you can specify several parent packages. The parent packages are applied on a first listed, first used basis.

And

In the preceding example:

language_package_one descends from en_au_package and en_au_package descends from en_ie_package
language_package_two descends from en_ca_package and en_ca_package descends from en_us_package
If the Magento application cannot find word or phrase in the en_GB package, it looks in other packages in following sequence:

parent-package-one/language_package_one
/en_au_package
/en_ie_package
parent-package-two/language_package_two
/en_ca_package
/en_us_package
Specifying all inheritances between the language packages might result in creating circular inheritance chains. Use Magento\Test\Integrity\App\Language\CircularDependencyTest test to locate and fix such chains.

The documentation clearly states that 'package_one' should be loaded before 'package_two'; However if your 'package_one' name comes after 'package_two' alphabetically the order will not be respected.

Preconditions

  1. Magento 2.4-develop
  2. PHP7.2

Steps to reproduce

  1. Create 2 language packs with package names "pack_a" & "pack_z"
  2. Create a project language pack which uses the previously created packs.
  3. Make sure you add "pack_z" as the first package to use then "pack_a"
<?xml version="1.0"?>
<language xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:App/Language/package.xsd">
   ...
    <use vendor="myvendor" package="pack_z"/>
    <use vendor="myvendor" package="pack_a"/>
</language>

Expected result

  1. Translations should be firstly fetched from "pack_z" then "pack_a"

Actual result

  1. Translations are firstly fetched from "pack_a" then from "pack_z"

Metadata

Metadata

Assignees

Labels

Component: Framework/TranslateUSE ONLY for FRAMEWORK RELATED BUG! E.g If bug related to translation in Catalog use just CatalogComponent: TranslationFixed in 2.4.xThe issue has been fixed in 2.4-develop branchIssue: Clear DescriptionGate 2 Passed. Manual verification of the issue description passedIssue: ConfirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedIssue: Format is validGate 1 Passed. Automatic verification of issue format passedIssue: Ready for WorkGate 4. Acknowledged. Issue is added to backlog and ready for developmentReproduced on 2.1.xThe issue has been reproduced on latest 2.1 releaseReproduced on 2.2.xThe issue has been reproduced on latest 2.2 releaseReproduced on 2.3.xThe issue has been reproduced on latest 2.3 releaseReproduced on 2.4.xThe issue has been reproduced on latest 2.4-develop branch

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions