Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong removing multi line disabled translations #262

Closed
lbfeenix opened this issue Nov 16, 2020 · 3 comments
Closed

Wrong removing multi line disabled translations #262

lbfeenix opened this issue Nov 16, 2020 · 3 comments

Comments

@lbfeenix
Copy link
Contributor

lbfeenix commented Nov 16, 2020

Hi, I found one minor problem but for my usecase its not minor. If I have disabled multiline translations in .po file, so PoLoader can not load it correctly, load only first line of disabled. Will be possible fix PoLoader.php function loadString from line 26 with this or similar code?

        //Multiline
        while (substr($line, -1, 1) === '"'
            && $nextLine !== false
            && (substr(trim($nextLine), 0, 1) === '"' || substr(trim($nextLine), 0, 4) === '#~ "')
        ) {
            if (substr(trim($nextLine), 0, 1) === '"') { // Normal multiline
                $line = substr($line, 0, -1).substr(trim($nextLine), 1);
            }
            if (substr(trim($nextLine), 0, 4) === '#~ "') { // Disabled multiline
                $line = substr($line, 0, -1).substr(trim($nextLine), 4);
            }
            $nextLine = next($lines);
        }
@oscarotero
Copy link
Member

Hi, thank you for warning about this.
Do you want to work on a PR including test reproducing this error?

@lbfeenix
Copy link
Contributor Author

Hi, although I'm not new to using git or writing code, I'm using github for the first time, so I try create PR with some comment (I hope it have sense), but do not know how create some test here, or what type of test do you mean.

@oscarotero
Copy link
Member

v5.5.2 released including the fix for this issue.
Thanks for your contribution!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants