This documentation explains how to use verbose localization to find translation keys for custom text in Discourse.
Required user level: Administrator
Finding a translation key using verbose localization
Verbose localization is a powerful tool in Discourse that helps administrators find translation keys for custom text more effectively. This is particularly useful when you need to translate text appearing in multiple places in the Discourse UI.
Summary
This guide covers:
- Enabling verbose localization.
- Using verbose localization to identify translation keys.
- Practical applications and common use cases.
Enabling verbose localization
Verbose localization can be enabled for all users globally or for individual sessions.
Enabling the setting for all users
- Navigate to your site settings page
a. Go to the admin sidebar
b. SelectAll Site Settings
b. Enterverbose
in the filter field of the settings page - Enable the
verbose localization
site setting.
Enabling the setting for an individual session
- Open your browserâs web inspector on your Discourse site.
- Go to the console tab.
- Enter the following JavaScript command at the prompt:
I18n.enableVerboseLocalizationSession()
- You should see a response similar to:
This session-specific approach ensures that other users wonât see translation markers when visiting the site.
Using verbose localization to find a translation key
When verbose localization is enabled, youâll see numbers displayed after all customizable text on your site.
Steps to identify a translation key
- Browse to the area containing the text you want to update. For example, if youâre looking to change the word âNameâ:
- Look for the associated translation number in your browserâs console:
- Note the identified translation key, such as
user.name.title
. - Go to the Admin sidebar and enter
site texts
into the Search bar - Enter the translation key into the search box:
- Click the textâs Edit button and update the text as needed.
Best practices
- Use session-specific verbose localization to avoid cluttering the UI for other users during translation tasks.
- Document frequently used translation keys for future reference.
- Regularly check for updates in the Discourse documentation to stay informed about new localization features.
Common issues and solutions
Issue: Translation markers visible to all users
Solution: Ensure you enable verbose localization exclusively for your session if other users shouldnât see it.
Issue: Difficulty in finding correct translation key
Solution: Use the console and verbose localization markers accurately, and cross-reference the Customize Site Texts page.
FAQs
Q: Can verbose localization be restricted to admin or staff?
A: Verbose localization numbers can be hidden from non-technical users by enabling it in individual sessions via the console.
Q: How can string translations be verified?
A: After identifying and updating the translation key, review the UI changes in a new browser session or tab.
Additional resources
Last edited by @Moin 2024-07-22T10:35:10Z
Check document
Perform check on document: