Translator ignoring entries that don't pass a parameter to it
-
In the template file I'm writing, I can use the internationalization function for entries that take a parameter (like
%1
or%2
). Example:[[nwodroll:again, {again}]]
works just fine, but[[nwodroll:no_rerolls]]
does not. I see examples of the latter all over the core NodeBB code, and the core NodeBB code actually works. So from that, I know I'm doing something wrong that causes this, but for the life of me I can't figure it out.Here's the repository: https://github.com/LukeLaupheimer/nodebb-plugin-nwod-roller
Any ideas?
-
@julian Unfortunately, I do not. There are no errors showing. What I get is just the raw text of the partial:
[[nwodroll:no-rerolls]]
.In the code, I figured surrounding the No Rerolls method in parentheses might impact it, but it didn't.I also tried using the translator object server-side and that worked beautifully! So there's clearly something wrong with my partials that I can't quite identify.
-
@julian I hacked it to work with this commit: https://github.com/LukeLaupheimer/nodebb-plugin-nwod-roller/commit/c54dbbe4182f2bc6ac6c1007e4f717827a4c7414
But something tells me that this is not the ideal approach, like, at all. File this under things that work, but shouldn't need to be done.
-
@LukeLaupheimer If you could add a failing test here, that would go a long way towards fixing
https://github.com/NodeBB/NodeBB/blob/master/tests/translator.js -
@julian I'll certainly give it a shot in my spare time--probably tomorrow night, during one of the usergroup meetings I attent. I'm a Rails guy for a living and I'm just kind of hacking my way through NodeJS land, and more specifically NodeBB.
I think most of the work involved will revolve around reproducing the error, since calls to translator without a param sent along the way so plainly work all over the rest of the software. Will be doing some research!
-
@julian I've made a pull request that creates a test and actually addresses the underlying problem on top of it! https://github.com/NodeBB/NodeBB/pull/4796
If there's something messed up about it feel free to tell me. Like I said, I'm new to the NodeJS world so I wouldn't be surprised if I did something incorrectly.