The two functions in core/standard.inc should be moved into their respective locations...

Follow-up Issues

#1862202: Objectify the language system
#2004506: Move standard_country_list() to Drupal\Core\Locale\Country
#1730834: Remove language() indirection/static cache, consistently use 'language' (factory) service on container
#2010542: Remove variable 'language_types' in favor of configuration object system.language.types
#1550866: Remove obsolete drupal_language_initialize()

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

nick_schuch’s picture

Status: Active » Needs review
FileSize
23.83 KB

Initial patch.

- standard.inc is now locale.inc
- standard_language_list() is now Language::getStandardLanguageList()

Status: Needs review » Needs work

The last submitted patch, 1845034-1-move-standard.patch, failed testing.

sandykadam’s picture

Status: Needs work » Needs review
FileSize
23.8 KB

@nick_schuch,

Your above patch is good but missing static definition in function. I have applied the changes in patch, it should now work.

Status: Needs review » Needs work
Issue tags: -code cleanup, -Framework Initiative

The last submitted patch, 1845034-2-added-missing-static-defination.patch, failed testing.

sandykadam’s picture

Status: Needs work » Needs review

Status: Needs review » Needs work
Issue tags: +code cleanup, +Framework Initiative

The last submitted patch, 1845034-2-added-missing-static-defination.patch, failed testing.

sandykadam’s picture

Again made some minor changes for incorrect locale.inc include & static definition changes.

sandykadam’s picture

Component: system.module » language system
Status: Needs work » Needs review
FileSize
16.79 KB

re-submitting patch file

Status: Needs review » Needs work
Issue tags: -code cleanup, -Framework Initiative

The last submitted patch, 1845034-8-resolved-static-defination-and-include-changes.patch, failed testing.

sandykadam’s picture

Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch, 1845034-8-resolved-static-defination-and-include-changes.patch, failed testing.

sandykadam’s picture

Status: Needs work » Needs review

Status: Needs review » Needs work
Issue tags: +code cleanup, +Framework Initiative

The last submitted patch, 1845034-8-resolved-static-defination-and-include-changes.patch, failed testing.

nick_schuch’s picture

Status: Needs work » Needs review
FileSize
18.89 KB

Looks like the last 2 patches weren't saved in UTF-8.

Status: Needs review » Needs work

The last submitted patch, 1845034-14-resolved-static-defination-and-include-changes.patch, failed testing.

nick_schuch’s picture

Status: Needs work » Needs review

Looks like the last 2 patches weren't saved in UTF-8.

nick_schuch’s picture

Status: Needs review » Needs work
Issue tags: -code cleanup, -Framework Initiative

The last submitted patch, 1845034-14-resolved-static-defination-and-include-changes.patch, failed testing.

nick_schuch’s picture

Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch, 1845034-14-resolved-static-defination-and-include-changes.patch, failed testing.

sandykadam’s picture

Status: Needs work » Needs review

Status: Needs review » Needs work
Issue tags: +code cleanup, +Framework Initiative

The last submitted patch, 1845034-14-resolved-static-defination-and-include-changes.patch, failed testing.

RobLoach’s picture

Status: Needs work » Needs review
FileSize
17.02 KB

Status: Needs review » Needs work

The last submitted patch, 1845034.patch, failed testing.

RobLoach’s picture

Status: Needs work » Needs review
FileSize
18.4 KB
RobLoach’s picture

Title: Move core/includes/standard.inc out of core/includes » Convert standard.inc to Drupal\Core\Language
Issue tags: +PHPUnit Blocker
plach’s picture

I think the original idea behind standard.inc was avoiding to load unnecessary code on every request. The current patch defeats this purpose. What about just making standard.inc an autoloadable Standard class?

RobLoach’s picture

I think the original idea behind standard.inc was avoiding to load unnecessary code on every request.

Static functions won't cause any performance issues. The places where Language::getStandardLanguages() is used, the class is already being used too, so the function is already loaded. The Languages list should live in Language, since it's a list of languages.

You're right the countries could benefit from this though! Where do you think it should go?

  1. Drupal\Core\Language\Country?
  2. Drupal\Core\Language\Countries?
  3. Drupal\Core\Utility\Countries?
plach’s picture

Issue tags: +D8MI, +language-base

Static functions won't cause any performance issues.

That function is used very rarely: loading it on every request seems a waste of memory to me.

You're right the countries could benefit from this though! Where do you think it should go?

Well, Language is singular, hence for consistency I'd go for Drupal\Core\Utility\Country although I recall there was a non irrelevant discussion behind the standard.inc name (not surprisingly :), which in D7 was iso.inc. Not sure whether we want to retain the "standard" terminology somewhere, possibily in the package name.

Gábor Hojtsy’s picture

Yeah, core/lib/Drupal/Core/Language/Language.php is loaded on every page request on every single Drupal 8 site. I'm not sure of the diff of memory use with the added method, if we want to make our code cleaner and take this (small?) penalty, then so be it. Just be aware of it.

plach’s picture

If we want to have clean code we can use the Language package: this is what it's there for :)
Sticking every language-related bit of code in the Language class does not look particularly clean to my eyes. In fact #1862202: Objectify the language system is moving the language_list() implementation into the LanguageManager class. If we don't want a dedicated class, then I'd say the language manger is the place.

RobLoach’s picture

Status: Needs review » Needs work

Language list to move into Drupal\Core\Language\LanguageManager
Countries to move into Drupal\Core\Utility\Country

Sounds reasonable to me. Any objections?

YesCT’s picture

Issue tags: +medium

sounds reasonable to me also.
patch will be like #25 but to those locations proposed in #32. (not quite a novice task, so tagging medium. anyone can tackle making a patch for this)

I see this patch is also updating the script too. #1068840: core/includes/standard.inc contains inaccurate country data good.

plach’s picture

Any objections?

No strong ones.

RobLoach’s picture

Status: Needs work » Needs review
FileSize
16.47 KB

Let's move standard_country_list() to a follow up:
#2004506: Move standard_country_list() to Drupal\Core\Locale\Country

plach’s picture

Status: Needs review » Needs work

LanguageManager::getLanguageList() will be name of the method used to retrieve the installed language list (see #1862202: Objectify the language system). I'd suggest to rename it to LanguageManager::getStandardLanguageList(). Aside from that looks good to me, thanks.

RobLoach’s picture

Status: Needs work » Needs review
FileSize
16.53 KB
plach’s picture

Status: Needs review » Reviewed & tested by the community

RTBC If green. Thanks!

plach’s picture

@YestCT:

Can you direct someone to the follow-up Rob linked in #35? It should be fairly easy.

plach’s picture

@RobLoach:

One last-minute thought: should we instantiate the LanguageManager instead of using a static method? Right now we are hardcoding the implementation instead of relying on the DIC.

Status: Reviewed & tested by the community » Needs work
Issue tags: -code cleanup, -Framework Initiative, -D8MI, -language-base, -medium, -PHPUnit Blocker

The last submitted patch, 1845034.patch, failed testing.

plach’s picture

Status: Needs work » Needs review

#37: 1845034.patch queued for re-testing.

Status: Needs review » Needs work
Issue tags: +code cleanup, +Framework Initiative, +D8MI, +language-base, +medium, +PHPUnit Blocker

The last submitted patch, 1845034.patch, failed testing.

RobLoach’s picture

Status: Needs work » Needs review
RobLoach’s picture

Status: Needs review » Needs work

The last submitted patch, 1845034.patch, failed testing.

plach’s picture

Status: Needs work » Needs review

#37: 1845034.patch queued for re-testing.

Now git should be back.

Status: Needs review » Needs work
Issue tags: +code cleanup, +Framework Initiative, +D8MI, +language-base, +medium, +PHPUnit Blocker

The last submitted patch, 1845034.patch, failed testing.

Cameron Tod’s picture

Assigned: Unassigned » Cameron Tod
Status: Needs work » Needs review
FileSize
16.54 KB

This should fix the fails, but I think we should probably move this into the DIC as suggested in #40.

Will work on it.

Cameron Tod’s picture

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

+1 on RTBC

alexpott’s picture

Status: Reviewed & tested by the community » Needs work
Issue tags: +Needs reroll

Needs a reroll

curl https://drupal.org/files/1845034-language-core-service-49.patch | git a
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 16939  100 16939    0     0  14877      0  0:00:01  0:00:01 --:--:-- 17571
error: patch failed: core/includes/install.core.inc:8
error: core/includes/install.core.inc: patch does not apply
Gábor Hojtsy’s picture

Status: Needs work » Reviewed & tested by the community
FileSize
16.55 KB

The fail to apply was just around the use XZY; lines in install.core.inc. Easy reroll :) Should only be committed after green of course.

alexpott’s picture

Status: Reviewed & tested by the community » Fixed

Committed 56f4362 and pushed to 8.x. Thanks!

Gábor Hojtsy’s picture

Woot, thanks!

plach’s picture

Added a change notice for this:

https://drupal.org/node/2019333

larowlan’s picture

Issue tags: -Needs reroll

Updating tags

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

Anonymous’s picture

Issue summary: View changes

adding list of followups to summary