Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi,
I was looking for a gettext like implementation so I could get the familiarity of gettext without being stuck to the rigour of gettext and needing locale's and translation files on disk.
Your project more or less fit the bill for that with a couple of adjustments, one of which was support for the plural-forms. So I added some support for that. I ended up using create_function. The placement of which is not really ideal for performance reasons, But the static setup of everything more or less forced that.
I'm not really a big fan of the everything static approach, so I'll might actually end up rewriting a bunch to give it state, but since adding plural-forms is kind of a thing I figured I'd point out these changes in case you where interested.
Obviously with the use of create_function it also creates an exploit vector if the source file is untrusted. But for my current use I can always trust my input. For more generic stuff either a filter would need to be added, or perhaps better a full parser that reads the plural-forms line and translates it to php code. Thinking about it that might not be all that difficult to write, so I might do that next weekend or somewhere next week. Should be safer.
Also refactored the loading of translation array from always needing a file to loadTranslationsArray which just takes the array as an argument. This because I don't want to bother with files.
Anyway, just wanted to let you know.