Loco Translate
[resolved] Path resolving (4 posts)

  1. moreyummystuff
    Posted 2 years 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.


  2. timwhitlock
    Plugin Author

    Posted 2 years 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
    Posted 2 years ago #

    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.

  4. seayko
    Posted 2 years ago #

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

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Loco Translate
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic