aucor / dynamic-mo-loader

Better text domain loading with object cache support for WordPress
47 stars 13 forks source link

Support multiple plural forms #16

Open Biont opened 4 years ago

Biont commented 4 years ago

This mu-plugin assumes that only one plural form exists. This is known and described in comments here

However, this breaks translations for some locales, for example slovak/hungarian.

What would it take to make this work?

TeemuSuoranta commented 4 years ago

We have also found out that this plugin cannot for some reason handle plural formats. In the code there is some handeling of plurals but it doesn't seem to be working correctly (not sure if it ever has).

We went and tried to fix this before https://github.com/aucor/dynamic-mo-loader/commit/1798e37cd00dd6acea4dff4e14a9f9a428ec484b but it ended up causing other bigger bugs and had to revert it back to how it was before.

If you or anyone wants to try to solve this issue, I'll gladly take a PR but if not, it will take time before I give it another shot. Also referenced in here https://github.com/aucor/dynamic-mo-loader/issues/12

Edit: Examples of existing plural code are in functions like https://github.com/aucor/dynamic-mo-loader/blob/master/inc/mo_dynamic.php#L513 (like you linked)

Biont commented 4 years ago

I knew I saw something in my feed about a bugfix for plurals and found myself a bit puzzled when I went in to check.

I would like to try and fix it, but the reality is that I intended to do that for almost a full year now and the best thing I managed to do was create this issue. There's currently only one site we're having trouble with because of locales with multiple plural forms and I have not been able to justify spending the time to work on a fix yet.

On the other hand, I simply do not understand the code by looking at it, so I am certain that it would take a decent amount of time for me to get used to, debug and test (especially since it's probably pretty hard to set up automated testing)

TeemuSuoranta commented 4 years ago

Ain't that the truth. The base of this plugin was years ago part of another optimization plugin that has not been maintained for years. My ex-colleague extracted the MO optimization part toan independent plugin (this one) and has since moved to doing non-WordPress related things. So here I am, too, trying to maintain and keep this thing running.

I'll probably take a look into this issue again in future or will think of some long term solution as the code is very complicated and hardly documented so trying to change anything is a great adventure. In your case with only one site, I'd probably disable this plugin because the effect is not that critical.