Updated: Comment #0

Problem/Motivation

In #1862202: Objectify the language system the following arguments were raised:

  1. I wonder whether we really need to repeat the term "Language" in 90% of all methods on classes that are named LanguageManager already?
  2. "default locked languages" requires one to understand what Drupal understands under that term. Wasn't there a formal expression for these linguistic/language codes à la "universal languages" or "non-linguistic languages" or similar?
  3. UserAgent::getLangcode() does not really encompass what this method is doing. It's rather a UserAgent::getBestMatchingLangcode() or similar.
  4. It's not clear to me what a "selected language" is. Given the implementation, this rather seems to be a "negotiation fallback to a statically configured language"?
  5. [The parent issue] introduced some major inconsistencies between LanguageNegotiation vs. LanguageNegotiator namespaces and class names, both within plugins but also outside of plugins... The change to "negotiator" for plugins makes sense to me, but let's make sure that the whole shebang makes sense (in that follow-up) :-)
  6. All of the constants in the language classes/interfaces (including STATE_…) are poorly named, because they (1) require one to understand deep internals and (2) do not map at all to their intended purpose/meaning.

Proposed resolution

Rename classes, methods and constants to something more appropriate.

Remaining tasks

  • Evaluate whether it would make more sense to split this into smaller issues.
  • Agree on a solution.

User interface changes

None

API changes

TBD

CommentFileSizeAuthor
#4 lang.name_.4.patch49.8 KBsun
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

plach’s picture

Issue summary: View changes

Copying my answer to bullet #2 from #1862202-353: Objectify the language system:

The most relevant resource I was able to find on this matter is http://www.w3.org/International/questions/qa-no-language but it does not mention a generic name for this type of laguage codes. In the IANA subtag registry they call them "special" (see http://www.iana.org/assignments/language-subtag-registry/language-subtag...).

plach’s picture

Issue summary: View changes
tim.plunkett’s picture

Issue tags: -DX +DX (Developer Experience)
sun’s picture

Assigned: Unassigned » sun
Status: Active » Needs review
FileSize
49.8 KB

Attached patch performs the following clean-ups and adjustments:

  1. Moved language negotiation method interface + base class into Language module's plugin directory.
  2. Renamed LanguageNegotiationInterface::getLangcode() into ::negotiate().
  3. Renamed UserAgent::getBestMatchingLangcode() into ::negotiateAcceptedLanguage().
  4. Renamed LanguageNegotiationSelected into LanguageNegotiationStatic.
  5. Renamed LanguageNegotiationUrl::CONFIG_* constants into SOURCE_*.
  6. Renamed LanguageManagerInterface::getDefaultLockedLanguages() into ::getSpecialLanguages().

Status: Needs review » Needs work

The last submitted patch, 4: lang.name_.4.patch, failed testing.

plach’s picture

Issue tags: +beta target

It would really be better to have this sorted out before beta (actually this sounds beta deadline-ish to me). I will try to review this ASAP.

xjm’s picture

Version: 8.0.x-dev » 8.2.x-dev
Issue tags: -beta target

This issue was marked as a beta target for the 8.0.x beta, but is not applicable as an 8.1.x beta target, so untagging.

I've moved the issue to 8.2.x since it could be possible to implement this with BC in a minor.

Version: 8.2.x-dev » 8.3.x-dev

Drupal 8.2.0-beta1 was released on August 3, 2016, which means new developments and disruptive changes should now be targeted against the 8.3.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.3.x-dev » 8.4.x-dev

Drupal 8.3.0-alpha1 will be released the week of January 30, 2017, which means new developments and disruptive changes should now be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.4.x-dev » 8.5.x-dev

Drupal 8.4.0-alpha1 will be released the week of July 31, 2017, which means new developments and disruptive changes should now be targeted against the 8.5.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.0-alpha1 will be released the week of January 17, 2018, which means new developments and disruptive changes should now be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

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

Drupal 8.6.0-alpha1 will be released the week of July 16, 2018, which means new developments and disruptive changes should now be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

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.

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.

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.

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.

andypost’s picture

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

Drupal 9.3.0-rc1 was released on November 26, 2021, which means new developments and disruptive changes should now be targeted for the 9.4.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.0-alpha1 was released on May 6, 2022, which means new developments and disruptive changes should now be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.5.x-dev » 10.1.x-dev

Drupal 9.5.0-beta2 and Drupal 10.0.0-beta2 were released on September 29, 2022, which means new developments and disruptive changes should now be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 10.1.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch, which currently accepts only minor-version allowed changes. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.