WordPress.org

Ready to get started?Download WordPress

Forums

Loco Translate
[resolved] Path resolving (4 posts)

  1. moreyummystuff
    Member
    Posted 12 months ago #

    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.

    http://wordpress.org/plugins/loco-translate/

  2. timwhitlock
    Member
    Plugin Author

    Posted 12 months ago #

    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.

  3. seayko
    Member
    Posted 7 months ago #

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

    Fixed it with:

    loco-translate/php/loco-posave.php

    replace (Line 14-16):

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

    with

    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.

  4. seayko
    Member
    Posted 7 months ago #

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

Reply

You must log in to post.

About this Plugin

About this Topic