Can’t translate JavaScript with specific extention
-
Hello,
I want to translate strings from JavaScript files with special extention (.tag in my case).
Loco Translate has “Scan JavaScript files with extensions” option on settings page. First of all I filled in there my custom file extention (.tag). After that I am gone to “Editor” page to “Sync” my new string. Loco Translate found my new string as expected and suggested to translate it. But after click “Save” button translated strings didn’t appear in JSON translation file and also weren’t shown on frontend.
I think the solution is near on the line 158 in /src/gettext/Compiler.php (Loco Translate version 2.6.9)
foreach( $po->exportRefs('\.js') as $ref => $fragment ){
Because it search strings just in files with .js extention.I changed this code to
foreach( $po->exportRefs('\.tag') as $ref => $fragment ){
In this way my strings appeared in JSON translation file and were shown on frontend.Please make it possible to translate strings of any JavaScript files with extentions specified in “Scan JavaScript files with extensions” in next update.
- The topic ‘Can’t translate JavaScript with specific extention’ is closed to new replies.