Pony99CA wrote:So you're doing a code MOD which has run-time costs instead of just using a global search and replace in the language files?
It was mentioned that this easy method comes at forcing the server to do a find and replace on the language input on each load. So what is gained in easiness taxes the server a bit more. However, having said that, with modern CPUs this is very quick. The most efficient and optimized method? Nope. A major issue with modern computer power? Nope.
True I have spent some time on this, for fun, but the point was provide some code that would quickly change all the references to user (in any part of any word) without the need to spend a bunch of time on the language files. User, in some form (like username, users, user), appears throughout several of the language files, so one would need to hand process a lot of lines to accomplish what this code is doing in less than a second.
So why not use find and replace in Notepad++ or something may come to mind. This is dangerous when you use a computer to force blind changes. It might work for these files as I haven't vetted every line of code but for example if we look at this line from the main index.php file:
If we blindly replaced user using a global search in say Notepad++ with member we would get:
This could easily cause the script to fatal out, display errors, or not work in some way.
I say again it may be safe in the language files but we aren't talking about a Word document but code. A semicolon in the wrong place can cause a fatal crash much less altering a key variable or function. A global search and replace could easily modify unintended code.
What my edit does is ONLY replace text defined in the language array. There is no risk of changing important code, like a variable or function name, that phpBB needs to run. That is the difference.
Pony99CA wrote:The language files are intended to be edited (that's how translators translate phpBB), so why do a code MOD? That just seems backward to me.
I agree the point of the language files is to provide a way to alter the text into other languages. Obviously one can still do that. It would be the most efficient server resource wise. However the code provided allows for easier upgrading. Yes the code provided would need to be replaced but what if in the next version a new feature is added or altered that defines a new language entry?
If a translation was done one could easily over look that addition or additions. The above code will automatically alter any new text. Plus the above code can be alter to change user to anything even in other languages like German, French, Spanish, etc.
Sajaki wrote:You can also use the Word censoring acp to replace "user" with "member". This only works for Forum posts.
The point of the thread was to address changing user outside of posts. However I agree a filter works for forum posts.