ryancramerdesign/P21 — Issue #78: $textdomain include $rootPath when debug_backtrace() in __()
Author: anilex
Created: 2012-02-20 19:58:03+00:00
State: open

This occurs only when the site is using LanguageSupport module in the frontend and it is installed in a subfolder.
In __() function, debug_backtrace() return the $traces[0]['file'] with full path.

This cause the $textdomain to have
`/home/mydomain/public_html/templates/includes/inquiry_form.php`
and later to be converted to:
`--home--mydomain--public_html--templates--includes--inquiry_form-php.json`
which is not the correct translation file name:
`--templates--includes--inquiry_form-php.json`

Suggested fix:
`$textdomain = str_replace(wire('config')->paths->root, "/", $traces[0]['file']);`
instead:
`$textdomain = $traces[0]['file'];`

If this matter:
* `DEBUG_BACKTRACE_IGNORE_ARGS is 2`
* I haven't tested this on clean installation.