Skip to content

Commit

Permalink
Fix script translation
Browse files Browse the repository at this point in the history
  • Loading branch information
TorbenLundsgaard committed Apr 14, 2024
1 parent 69fa092 commit 809523d
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/Admin/AbstractOptionsPage.php
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,9 @@ abstract public function enqueue_page_assets( string $hook ): void;
* @param string $script_handle The script handle.
* @param string $path The plugin path.
* @param string $url The plugin URL.
* @param string $domain The translation domain.
*/
protected function enqueue_assets( string $page_slug, string $script_handle, string $path = GTMKIT_PATH, string $url = GTMKIT_URL ) {
protected function enqueue_assets( string $page_slug, string $script_handle, string $path = GTMKIT_PATH, string $url = GTMKIT_URL, string $domain = 'gtm-kit' ) {

$deps_file = $path . 'assets/admin/' . $script_handle . '.asset.php';
$dependency = [];
Expand All @@ -177,6 +178,8 @@ protected function enqueue_assets( string $page_slug, string $script_handle, str
\wp_enqueue_script( 'gtmkit-' . $script_handle . '-script', $url . 'assets/admin/' . $script_handle . '.js', $dependency, $version, true );

$this->localize_script( $page_slug, $script_handle );

\wp_set_script_translations( 'gtmkit-' . $script_handle . '-script', $domain );
}

/**
Expand Down

0 comments on commit 809523d

Please sign in to comment.