Problem/Motivation
These will be the final underscore functions.
- _locale_refresh_translations - public in LocaleJs
- _locale_refresh_configuration - Inlined in TranslateEditForm
- _locale_strip_quotes - protected in LocaleJs
- _locale_parse_js_file - public in LocaleJs
- _locale_invalidate_js - public in LocaleJs
- _locale_rebuild_js - public in LocaleJs
Steps to reproduce
Proposed resolution
_locale_rebuild_js should we make this protected and remove the parameter, the only calls outside LocaleJs and with langcode are in tests
_locale_parse_js_file should we make this protected the only calls outside of LocaleJs are in tests
_locale_invalidate_js should become public, it's called by several hooks
Remaining tasks
User interface changes
Introduced terminology
API changes
The following functions have been deprecated:
_locale_refresh_translations()_locale_refresh_configuration()_locale_strip_quotes()_locale_parse_js_file_locale_invalidate_js()_locale_rebuild_js()
The following functions have no replacement:
_locale_refresh_configuration()_locale_strip_quotes()
The following functions have a replacement:
-
Before:
_locale_refresh_translations()
After:\Drupal::service(Drupal\locale\LocaleJs)->refreshTranslations() -
Before:
_locale_invalidate_js()
After:\Drupal::service(Drupal\locale\LocaleJs)->invalidate()
The following functions have a replacement, but they are only public for testing purposes. They are marked as internal and can be changed or removed at any time in the future:
-
Before:
_locale_parse_js_file()
After:\Drupal::service(Drupal\locale\LocaleJs)->parseJsFile() -
Before:
_locale_rebuild_js()
After:\Drupal::service(Drupal\locale\LocaleJs)->rebuild()
Data model changes
Release notes snippet
Issue fork drupal-3618358
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
- 3618358-pp-1-deprecate-remaining
changes, plain diff MR !16849
Comments
Comment #2
nicxvan commentedComment #3
nicxvan commentedComment #5
nicxvan commentedComment #6
nicxvan commentedThis is ready for review, the failure seems random:
(Drupal\Tests\workspaces\FunctionalJavascript\WorkspacesMediaLibraryIntegration)Comment #7
nitinkumar_7 commentedReviewed the MR. The deprecation shims, CR links, and version metadata all look correct, and the call-site migration is complete and consistent (nice catch avoiding the double-deprecation in refreshTranslations()).
No functional concerns otherwise; the WorkspacesMediaLibraryIntegration failure looks unrelated/flaky as noted.
Comment #8
nitinkumar_7 commentedTwo things before this can move past Needs issue summary update:
parseJsFile() and rebuild() ended up public (with @internal) rather than protected as the issue's Proposed Resolution states, and rebuild() kept the $langcode parameter rather than dropping it. Only stripQuotes() matches the original proposal. Can you confirm this is the intended final approach (I'd guess protected would break direct test coverage) so the issue summary can be updated to match?
The change to locale_string_is_safe()'s @see link (3595086 → 3619103) looks unrelated to this issue's scope -- intentional fix or stray from a rebase?
Comment #9
daffie commentedIt looks good.
Just a couple of nitpicks.
Comment #10
nicxvan commentedThank you @daffie, I updated one of your suggestions and replied to the two about @internal, let me know if that works!
@nitinkumar_7 thank you for your review:
I was actually hoping for second opinions on this, that is why I left it in the IS and did it this way, it's also why I double marked them.
Yes, this was a correction for the CR the link is wrong. It's actually already fixed on 11.x, but we need to update main.
Comment #11
nitinkumar_7 commentedThanks for the clarification!
That makes sense to me. I’m fine with parseJsFile() and rebuild() remaining public with @internal if the intent is to preserve the direct test coverage, rather than changing them to protected as originally proposed.
And thanks for clarifying the locale_string_is_safe() @see change if it’s correcting the CR link and bringing main in line with the already-fixed 11.x version, that sounds intentional and appropriate.
With those points clarified, I have no further concerns from my side.
Comment #12
daffie commentedI have updated the IS and the CR.
All my remarks on the PR have been solved.
It all looks good to me.
For me it is RTBC.
Comment #15
catchThis looks fine to me. We already have an issue open to rework js parsing and this will hopefully make that a bit easier if anything.
Committed/pushed to main and cherry-picked to 11.x, thanks!