Skip to content

Commit

Permalink
docs: Add an example with translations in the default directory
Browse files Browse the repository at this point in the history
  • Loading branch information
borkweb committed Sep 28, 2024
1 parent 6ecf7aa commit 9dd58ae
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -443,6 +443,12 @@ Note: You can provide the JS file extension (`other-asset-directory/something.js
You can specify translations for a JS asset like so:

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

// Specifying a different path.
Asset::add( 'my-thing', 'js/something.js' )
->with_translations( $textdomain, 'relative/path/to/json/lang/files' )
->register();
Expand Down

0 comments on commit 9dd58ae

Please sign in to comment.