Phrase Substitution in UI
This topic describes how to make both simple and advanced phrase substitutions in the user interface.
Admin Console: System > Settings > Phrase Substitutions
How it Works
All substitutions are made at run time. The application keeps track of the phrases you want displayed and inserts your specified phrases in place of the default ones when users view applicable pages. Default phrases originate from internationalization (i18n) properties files used for localization. Your substitutions are linked to a specific theme, allowing for global changes or adjustments for particular parts of the user interface.
In the backend, these substitutions are remembered as "substitution rules" that utilize regular expressions for fine-tuning your changes.
Note: Because your phrase substitutions are part of your theme, they are overridden if you change your site’s theme. When you upgrade, they are overwritten, and you must recreate them.
Overview of Simple and Advanced Phrase Substitution
The simple substitution mechanism enables direct replacement of common phrases. For example, terms like "Documents" and "Discussions" can be renamed to "Articles" and "Conversations."
While the simple substitution accounts for upper- and lower-case versions, it does not always ensure grammatical correctness. For instance, substituting "article" for "document" might lead to awkward constructions—like "Create a article or upload a file" instead of "Create an article or upload a file."
Making Simple Substitutions
To define simple rules, follow these steps:
- In the Admin Console, navigate to System > Settings > Phrase Substitutions.
- Choose the relevant theme and locale for your substitution. A list of phrases available for substitution is presented.
- If the desired phrase is listed, enter your alternatives for both singular and plural versions.
- Click Save to complete the substitution. Changes take effect immediately without needing to restart the application or server.
After saving, you can view the rules on the Phrase Substitutions page to see the details of your substitution.
Note: Always test changes on an instance of the application that isn't in active use to avoid disrupting users.
Creating Advanced Substitution Rules
To create more precise substitution rules, use the following steps:
- In the Admin Console, go to System > Settings > Themes.
- Click the edit icon for the theme to which you want to add the rule.
- On the Edit Theme page, click Edit Rules.
- On the Phrase Substitution Rules page, click Add Rule.
- Specify the details for the new rule, including:
Rule option | Value | Description |
---|---|---|
Target | Value or key | Specify if you seek to replace a pattern within i18n values or keys. |
Operator | Equals, Contains, Starts With, Ends With, or Regular Expression | The operator applied to the substitution. |
Pattern | The original string | The exact text that should be replaced. |
Replace With | The replacement string | The text that will substitute the pattern. |
- After completing the configuration, click Save.
Viewing and Editing Substitution Rules
On the Phrase Substitution Rules page, you can:
- Edit an existing rule, specifying what you're substituting and what it will be replaced with.
- Add exceptions to existing rules.
- Delete substitution rules.
- View the results of your substitutions to see the context of the changes.