-
-
Notifications
You must be signed in to change notification settings - Fork 136
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
Jed format appears incorrect #90
Comments
mmm, interesting... |
I have it working with the patch, but other people who would like to use the utility with Jed will certainly desire this fixed. After I posted the initial issue, I noticed that the plural structure was not working as well. I edited the original post to reflect this. I understand your desire not to modify the phpArray structure. Maybe the array could be refactored in the Jed method just before it is Json’ed. |
Maybe a good solution is to provide a way to convert the old array structure to the new one. So, people upgrading this library can easily update their phpArray files. Maybe an oldPhpArray extractor or something like that. |
Hello, @g-johnson Before release this patch, can you test if Jed format works fine now, please? |
The \gettext\Generators\Jed: toString is inheriting the \gettext\Generators\PhpArray:toArray method which in turn uses the incorrect PhpArray:buildArray method. Cloning the buildArray method from PhpArray to Jed fixes this inheritance problem although there may me a more elegant way. Thank you for your prompt response to this issue... |
Ok, I made a mistake putting The only differente between Jed and PhpArray is the block you've put in this issue, so I've created a method with this code https://github.com/oscarotero/Gettext/blob/master/src/Generators/PhpArray.php#L59 and Jed generator extends phpArray overriding this method https://github.com/oscarotero/Gettext/blob/master/src/Generators/Jed.php#L22 |
The Jed Generator is working correctly now and Jed is translating both singular and plural text perfectly. Your prompt assistance was much appreciated! The issue can be closed. |
Good to know! |
The method “Gettext\Generators\Jed” does not appear to create a valid Jed Json structure. For non-plural translations it returns an extra empty string in the translation array:
To work properly with Jed apparently requires the following format:
This patch to src/Generators/PhpArray:toArray method seems to resolve the issue:
Doing something wrong or is a patch needed?
The text was updated successfully, but these errors were encountered: