Skip to content

Commit

Permalink
Default the textdomain to 'default'
Browse files Browse the repository at this point in the history
  • Loading branch information
borkweb committed Sep 28, 2024
1 parent 9dd58ae commit b8c857e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -452,6 +452,11 @@ Asset::add( 'my-thing', 'js/something.js' )
Asset::add( 'my-thing', 'js/something.js' )
->with_translations( $textdomain, 'relative/path/to/json/lang/files' )
->register();

// Using the 'default' textdomain and the default path of 'languages/'.
Asset::add( 'my-thing', 'js/something.js' )
->with_translations()
->register();
```

### Conditional enqueuing
Expand Down
2 changes: 1 addition & 1 deletion src/Assets/Asset.php
Original file line number Diff line number Diff line change
Expand Up @@ -1760,7 +1760,7 @@ public function use_asset_file( bool $use_asset_file = true ): self {
*
* @return self
*/
public function with_translations( string $textdomain, string $path = 'languages' ): self {
public function with_translations( string $textdomain = 'default', string $path = 'languages' ): self {
if ( ! $this->is_js() ) {
throw new InvalidArgumentException( 'Translations may only be set for JS assets.' );
}
Expand Down

0 comments on commit b8c857e

Please sign in to comment.