better error msg when smiley directory not writable#7713
better error msg when smiley directory not writable#7713live627 merged 5 commits intoSimpleMachines:release-2.1from
Conversation
|
Needs to use language strings for translation. Better fix would be to use sprintf to handle subsitions. |
|
Do you mean the way I have written the line right now adds a line return but it shouldn't, or it doesn't add a line return but should? By "substitutions" are you saying the sprintf call should lookup the correct translation? |
|
There should be no trailing newline
…On Mon, Mar 20, 2023 at 3:36 PM jeffythedragonslayer < ***@***.***> wrote:
Do you mean the way I have written the line right now adds a line return
but it shouldn't, or it doesn't add a line return but should? By
"substitutions" are you saying the sprintf call should lookup the correct
translation?
—
Reply to this email directly, view it on GitHub
<#7713 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AADJNN2FEDU744IRTXR6WKLW5DLVJANCNFSM6AAAAAAWAVQGOM>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
|
sprintf is used to write the translatable string, but you leave a place holder for the set name. So it can make sense which set this refers to. |
|
Sorry, I don't know where the trailing newline is. |
|
At the end of the file. Happens commonly if you edited the file on the browser or similar. |
|
Oh I see now, you mean the newline at the end of ManageSmiley.php I thought you meant a newline in the log file. |
|
I now mention which smiley set. If anyone knows of any good string localization examples in the code base I can learn from please let me know. |
live627
left a comment
There was a problem hiding this comment.
Thanks! I have been checking this code out, and a detailed message is not needed. I can discard my write-up showing you where to put the language entry.
Co-authored-by: John Rayes <live627@gmail.com>
|
That's too bad - that writeup would've really come in handy the next time I work on localization. |
|
Localization in SMF is pretty easy. Just put any user-facing strings into the $txt array in SMF's language files, and then refer to the string in your code via the $txt variable. For example, if you wanted to educate the user about how delicious cucumbers soaked in brine are, you could do the following:
If your changes to the code introduce the global $txt variable into a function that previously didn't use it, you will also need to declare it as a global variable at the top of the function, like this: |
|
Ooh excellent example @Sesquipedalian. I think this could make a good tutorial on the scripting help section of the forum, btw. |
fix #7617