Hello there,
I have a problem with plural translations, too.
All of the translations are automatically saved, right? But when I translate plural stuff, they aren’t being saved.
How is it possible please? Is it some kind of bug?
Thanks for support 🙂
j-prause:
change this line in class-translationfile.php (in latest version it’s line #339):
$this->_set_header_from_string("Plural-Forms: \nX-Textdomain-Support: yes");
to:
$po_lang = 'en';
if (preg_match("/([a-z][a-z]_[A-Z][A-Z]).(mo|po)$/", $pofile, $hits)) {
$po_lang = $this->strings->_substr($hits[1],0,2);
}else{
$po_lang = $this->strings->_substr($_POST['language'],0,2);
}
$this->_set_header_from_string("Plural-Forms: \nX-Textdomain-Support: yes", $po_lang);
It should fix bad plural forms.
@mkubenka: I tried this one, but I see no changes.
I don’t think that problem is PEBKAC 😀
Official site seems to be dead
So what to do?
@ mkubenka:
change this line in class-translationfile.php (in latest version it’s line #339)
I tried it.
Now CL sets the correct plural form into .po file.
But still the plurals are not displayed correctly at website frontend.
As to me the .mo file generated by CL is not correct. After opening the .po file with Poedit and saving it then plurals display correctly.
@ Brozman:
what do you mean by
PEBKAC 😀
?
@j-prause:
hum, problems with .mo files is that header doesn’t have LTD (lang. translation domain), so function _is_valid_entry thinks it’s non-valid entry.
I changed function _is_valid_entry in class-translationfile.php (line #524):
function _is_valid_entry(&$entry, &$textdomain) {
return (
($this->strings->_strlen(str_replace("", "", $entry['T'])) > 0)
&&
(in_array($textdomain, $entry['LTD']) || empty($entry['LTD']))
);
}
Probably, not the best solution, anyway it works 🙂
@ mkubenka:
I can confirm, this works, so far. Thank you.
Will these changes become part of new plugin version?
Cheers.
@j-prause:
pebkac – problem exists between keyboard and chair 😀 so I’m the trouble.
@j-prause:
can you help me, too? because I’ve been trying what you’ve posted but it haven’t worked at all.
my plural forms are still unsaved and I’m going crazy about it.
@ Brozman:
What subject are you translating?
What stage are you at?
@ Brozman:
Have you managed your problem?
Sorry, I’ve just had tons of tests at school.
So my problem is that when I try to translate some plural stuff it is not saved, and I don’t know why.. Because I’m not programmer.
Well, I translate it and get back to overview page. After that I click on that translation and that plural phrase doesn’t appear there.
It’s very hard to explain for myself, because I’m just intermediate in english.
Should I rather make a video of my screen?
Thanks.
Make whatever you wish but you cannot place the video in a post here, I’m afraid. Send an e-mail to me: josef dot prause at gmail dot com.
Did you had any luck with those? I tried both fixes from above with version 1.99.24, but it’s still not working 🙁
If I manually edit the .po file and then generate the .mo file from the admin interface, it works. Otherwise the text that is supposed to be displayed is not displayed in neither the original, not the translated language…
Bug has been found and removed with version 1.99.25 comming soon.