From 9dd58aefdac6a21a9df9f7cb593480e5528875e6 Mon Sep 17 00:00:00 2001 From: Matthew Batchelder Date: Sat, 28 Sep 2024 13:57:24 -0400 Subject: [PATCH] docs: Add an example with translations in the default directory --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index d539756..d3d5e6a 100644 --- a/README.md +++ b/README.md @@ -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();