Lesson 1: Changing wording
This lesson expands your knowledge of Elgg's language system.
Problem
There is wording that you want to change. Elgg says 'comments'
, but you prefer 'responses'
. Elgg says 'Register'
, but you prefer 'Sign up'
. You may think that those changes involve editing lots of files, but the solution is much easier than that.
Solution
Remember the elgg_echo()
function from last chapter that mapped strings such as 'hello:world'
to the proper phrase in the user's language ("Hello, World!" in English, "¡Hola, Mundo!" in Spanish, and so on)? Besides providing translations, we can also take advantage of elgg_echo()
to easily change wording. We do this by overriding the language mapping using a plugin.
Example
In this example, we will change the 'comment'
language to 'response'
language so that instead of displaying Post comment after a blog post like in the following screenshot:
It will display Post a response like the following screenshot:
Step 1: Create the plugin structure
Just as we...