Support » Plugin: Loco Translate » Path resolving

  • Resolved moreyummystuff


    Hi there,

    It seems that the resolve_path function in loco-admin.php is somehow not managing to resolve the paths to .po files correctly when I click on a .po file to edit:

    Error: Bad file path ‘E:\\WPTest\\www.2/wp-content/E:\\WPTest\\www.2\\wp-content\\themes\\bonestheme/library/translation/default.po’

    When debugging that function I see that the first time it is called with a $path of “themes/bonestheme” it is ok, however the next call that asks for “E:\WPTest\wp-content\themes\bonestheme/library/translation/default.po” fails as it returns the $realpath as seen above in the error message.

    Obviously this is run localhost on a Windows machine (PHP ver 5.3.24).

    Thanks for your time.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author timwhitlock


    Thanks for spotting this, but I don’t have a Windows development environment so can’t support Windows. Feel free to submit a patch and I’ll happily give you credit.

    I had same error in Win-Env while saving PO-Files.

    Fixed it with:


    replace (Line 14-16):

    if( ‘/’ !== $path{0}){
    $path = WP_CONTENT_DIR.’/’.$path;


    if( ‘/’ !== $path{0} && ‘:\\’ !== $path{1}.$path{2}){
    $path = WP_CONTENT_DIR.’/’.$path;

    // if “*:\” is in path, there is no need to prepend WP_CONTENT_DIR in Windows. Cause $path contains full path. 😉

    Tested in Linux AND Windows. Works fine!

    EDIT: ATTENTION! Path of “Gettext msgfmt” should be working in Windows, otherwise content of translation-file will be cleared.
    Magic-Quotes should be disabled, too.

    Since Version 1.4 it’s running without my reported modification.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Path resolving’ is closed to new replies.