Problem/Motivation
Locale module still has a bunch of legacy include files. As part of the core-wide initiative #3097045: [META] Provide modern replacements for and deprecate the legacy include files this issue focuses on Locale module.
Include files
locale.batch.inc#3581303: [pp-2] Convert locale batch callbacks- locale_translation_batch_version_check
- locale_translation_batch_status_check
- locale_translation_batch_status_finished
- locale_translation_batch_fetch_download
- locale_translation_batch_fetch_import
- locale_translation_batch_fetch_finished
- File management #3577671: Modernize locale file handling
- locale_translation_http_check
- locale_translation_download_source
locale.bulk.inc- batch related #3581303: [pp-2] Convert locale batch callbacks
- locale_translate_batch_import_files
- locale_translate_batch_build
- locale_translate_batch_import
- locale_translate_batch_import_save
- locale_translate_batch_refresh
- locale_translate_batch_finished
- locale_config_batch_update_components
- locale_config_batch_build
- locale_config_batch_update_default_config_langcodes
- locale_config_batch_set_config_langcodes deprecated
- locale_config_batch_update_config_translations
- locale_config_batch_refresh_name deprecated
- locale_config_batch_finished
- File management #3577671: Modernize locale file handling
- locale_translate_get_interface_translation_files
- locale_translate_file_create
- locale_translate_file_attach_properties
- locale_translate_delete_translation_files
locale.compare.inc- #3037031: Convert locale.compare.inc to a service (note 1)
- locale_translation_flush_projects
- locale_translation_build_projects
- locale_translation_project_list
- _locale_translation_prepare_project_list
- locale_translation_default_translation_server
- locale_translation_check_projects
- locale_translation_check_projects_batch
- locale_translation_batch_status_build
- _locale_translation_batch_status_operations
- locale_translation_check_projects_local
locale.fetch.inc#3572339: Modernize locale.fetch.inc- Already deprecated
locale.pages.inc- Already deprecated
locale.translation.inc- #3569328: Modernize locale.translations.inc
- Already deprecated
Module file
- 15 Constants see: #2831617: [pp-2] Deprecate global constants in locale module
- locale_get_plural #2660338: [pp-3] locale_get_plural call in PluralTranslatableString is wrong
- Locale system - to be created
- locale_system_set_config_langcodes
- locale_system_update
- locale_system_remove
- locale submit callbacks - to be created
- locale_form_language_admin_add_form_alter_submit
- locale_form_language_admin_edit_form_alter_submit
- locale_system_file_system_settings_submit
- #3037156: Create locale import history service
- locale_translation_get_file_history
- locale_translation_update_file_history
- locale_translation_file_history_delete
- locale status - to be created
- locale_translation_get_status
- locale_translation_status_save
- locale_translation_status_delete_languages
- locale_translation_status_delete_projects
- locale_translation_clear_status
- locale various - to be created
- locale_translation_use_remote_source
- locale_string_is_safe
- locale_translatable_language_list
- locale_js_translate
- locale_translation_language_table
- locale_is_translatable
- locale underscore - to be created
- _locale_refresh_translations
- _locale_refresh_configuration
- _locale_strip_quotes
- _locale_parse_js_file
- _locale_invalidate_js
- _locale_rebuild_js
Constants
There are several manual require_once and loadInclude.
locale.translation.inc is manually required by:
- locale.batch.inc
- locale.compare.inc
- locale.fetch.inc
Using moduleHandler there are many cross includes.
- batch
- includes bulk
- bulk
- compare
- fetch
- compare
- module
- bulk
- compare
- fetch
- translation
- translation
- compare
- fetch
Locale related, but not in scope
- #1834298: Unify name space in Locale module (note 2)
- #2935189: Complete docblock comments in Gettext component. (note 3)
- #1861360: Refactor localization update test so people can just enable the test module to test
- #2965866: Refactor LocaleUpdateBase to allow locale kernel tests
- #2927222: Move cache invalidation to event out of TranslateEditForm::submitForm()
- #2875279: Update core modules to use the new batch builder
Note 1: Part of #1577902: [META] Remove all usages of drupal_static() & drupal_static_reset()
Note 2: Part of #2999721: [META] Deprecate the legacy include files before Drupal 9
Note 3: Part of #1861442: [meta] Review of Drupal\Component\GetText files
Steps to reproduce
Take one file at a time deprecate and move all functions to .module
Deprecate file
Work on constants separately
Start with translations.inc since it is manually required three times.
This will break the chain fastest.
Comments
Comment #2
sutharsan commentedComment #3
sutharsan commentedComment #4
andypostBatches could use #2875279: Update core modules to use the new batch builder
Comment #5
gábor hojtsyFantastic collection. Locale has a lot of history ;) I think chipping away at this in manageable pieces is the best strategy. Hopefully we have enough existing test coverage to ensure refactored things still work. Also we need to identify in each case which parts are "API" and therefore need a full-on @deprecated/@trigger_error treatment. Hopefully most are not.
Comment #6
gábor hojtsyReparenting constants to this one, since its parent has been fixed for a while.
Comment #7
sutharsan commentedI'm working on a spreadsheet to identify procedural functions of Locale module that could be considered candidates for conversion.
But Google has changed its interface and I can't find a way to share the content publicly.Slack or mail me your email and I will grand you access.Comment #8
gábor hojtsy#2927222: Move cache invalidation to event out of TranslateEditForm::submitForm() has been clarified. I removed this issue as it's parent, but maybe it is still related. No clear cut lines here :D
Comment #9
sutharsan commentedThis spreadsheet list all procedural functions of Locale module (not hooks, not preprocess) which may be involved in modernizing. I'm looking at functions that naturally belong together or share enough ground to be grouped together.
https://docs.google.com/spreadsheets/d/1rK4HuF_8fLuHdkspOKXBoJNt7eo-V6NN...
DM me for access.
Comment #10
sutharsan commentedComment #11
sutharsan commentedAdding references to related issues to make discovering this issue easier.
Comment #12
andypostMoving to 9.4/10
Used to check old issues and found great schema #1189184-200: OOP & PSR-0-ify gettext .po file parsing and generation
Author is Gábor Hojtsy)
Comment #17
nicxvan commentedComment #18
nicxvan commentedComment #19
nicxvan commentedComment #20
nicxvan commentedComment #21
nicxvan commentedComment #22
nicxvan commentedComment #23
claudiu.cristeaComment #24
nicxvan commentedComment #25
nicxvan commentedComment #26
nicxvan commentedComment #27
andypostComment #28
nicxvan commentedComment #29
nicxvan commentedComment #30
nicxvan commentedComment #31
nicxvan commentedComment #32
nicxvan commentedComment #33
nicxvan commentedComment #34
nicxvan commentedComment #35
nicxvan commentedComment #36
nicxvan commentedComment #37
nicxvan commentedComment #38
nicxvan commentedComment #39
dcam commentedWhile reviewing #3586472: locale_string_is_safe fails on valid safe html I noted that
Drupal\Tests\locale\Kernel\LocaleStringIsSafeTest::testLocaleStringIsSafe()can be converted to a Unit test whenlocale_string_is_safe()is moved from the.modulefile into a class. I assume it isn't already a Unit test because of the global procedural function calls.