Problem/Motivation

\Drupal\Core\Language\LanguageManager::getDefaultLockedLanguages creates two language instances,
one for undefined, one for not specified. Sadly Language::__construct calls out to getStandardLanguageList() in order to figure out whether those langauges
have a direction, which is pointless, they will never have one.

Proposed resolution

Specify the default direction, LTR, for those two languages.

Remaining tasks

User interface changes

API changes

Data model changes

Beta phase evaluation

Reference: https://www.drupal.org/core/beta-changes
Issue category Task because its not a feature or a strict bug
Issue priority Normal because the impact is not that high performance wise
Disruption No disruption just doing a bit less work
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

dawehner’s picture

You could safe something like:

Drupal\Core\Language\Language::__construct Run #55b910f41911c Run #55b9166d6bd41 Diff Diff%
Number of Function Calls 3 3 0 0.0%
Incl. Wall Time (microsec) 245 20 -225 -91.8%
Incl. Wall Time (microsec) per call 82 7 -75 -91.8%
Excl. Wall Time (microsec) 39 20 -19 -48.7%
Incl. MemUse (bytes) 3,408 2,336 -1,072 -31.5%
Incl. MemUse (bytes) per call 1,136 779 -357 -31.5%
Excl. MemUse (bytes) -109,704 1,680 111,384 101.5%
Incl. PeakMemUse (bytes) 60,512 1,032 -59,480 -98.3%
Incl. PeakMemUse (bytes) per call 20,171 344 -19,827 -98.3%
Excl. PeakMemUse (bytes) 1,712 1,032 -680 -39.7%
dawehner’s picture

Note: 245 \mu s out of 140ms for /node/1, its small but its a small step.

sorressean’s picture

Assigned: Unassigned » sorressean
sorressean’s picture

At this point "small" is still an improvement and I'm happy to take that.
With that said, here's a patch. :)

sorressean’s picture

Status: Active » Needs review
dawehner’s picture

Issue summary: View changes
Status: Needs review » Reviewed & tested by the community

Thank you!

alexpott’s picture

Status: Reviewed & tested by the community » Needs work

Let's add this once to the $locked_language variable.

dawehner’s picture

Good catch alex!

sorressean’s picture

Didn't even catch that, thanks!

sorressean’s picture

Status: Needs work » Needs review
dawehner’s picture

Status: Needs review » Reviewed & tested by the community

Perfect

alexpott’s picture

Status: Reviewed & tested by the community » Fixed

Committed fe5ed1a and pushed to 8.0.x. Thanks!

Thanks for adding the beta evaluation to the issue summary.

  • alexpott committed fe5ed1a on 8.0.x
    Issue #2542304 by sorressean, dawehner: Define 'direction' in \Drupal\...
Gábor Hojtsy’s picture

Issue tags: +D8MI, +language-base

Status: Fixed » Closed (fixed)

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