FriendsOfFlarum / upload

The file upload extension with insane intelligence for your Flarum forum.
https://discuss.flarum.org/d/4154
MIT License
177 stars 96 forks source link

Extract error message strings to be translatable #211

Closed kalinjul closed 4 years ago

kalinjul commented 4 years ago

I extracted three error message strings because i needed them to be translatable via Linguist. I guess this makes sense for everyone.

lfpoulain commented 4 years ago

Exactly what I was looking for :)

clarkwinkelmann commented 4 years ago

Or maybe even upload_errors in the namespace, so we have some context as to what the errors refer to.

And validation_error could be invalid_file or could_not_detect_mime for example to better reflect what it is.

ghost commented 4 years ago

I changed the namespaces as suggested and removed the trans() method, which was initially copied from AbstractTemplate.php, i thought you may want it that way (if there's something very different in this case, you may explain or just ignore as I don't really know PHP). Also added the trailing newline and removed $msg variable.

clarkwinkelmann commented 4 years ago

I had not noticed that two translations shared the same value... But I guess in this context it's easier for us to reuse translations than doing the effort to make two different keys. Those errors should rarely appear and won't be super helpful in troubleshooting anyway.